Hypercache

API documentation

Overview

Our API allows you to access and cache your files to our service using time based API key (Key will change every 7 days).

Making requests

All requests must be done via GET/POST method.

HTTP response codes

Status code Meaning Additional
200 Success
401 Invalid API key or insufficient permissions.
403 Invalid or missing input data Specific field is stated in the returned error.
404 Invalid endpoint
429 Rate limit reached The API has endpoint specific rate limiting.


[GET] /GetApiKey

Get API key

1# API endpoint URL: https://hypercache.net/api/GetApiKey

2# Examples

2.1# PHP + cURL
<?php

$ch = curl_init();
    curl_setopt_array($ch, [
    CURLOPT_URL => "https://hypercache.net/api/GetApiKey",
    CURLOPT_HEADER => false,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => false,
    CURLOPT_TIMEOUT => 10,
]);
    
$curl_response = curl_exec($ch);
$curl_error = curl_error($ch);
curl_close($ch);

if ($curl_error)
{
    echo "cURL Error #:" . $curl_error;
}
else
{
    echo $curl_response;
}
2.2# Shell + cURL
curl -X GET \
  https://hypercache.net/api/GetApiKey
2.3# Node + Request
const request = require('request');

const options = {
    method: 'GET',
    url: 'https://hypercache.net/api/GetApiKey',
};

request(options, function (error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

3# Response

{
  "status": (bool) true|false,
  "message": "string",
  "response": [
    "key": string,
    "permission": []
  ]
}


[POST] /GetTorrent

Checks whether torrent with given hash exists

1# API endpoint URL: https://hypercache.net/api/GetTorrent

2# HTTP: Authentication

Username Password
API_KEY leave empty

Hypercache uses Basic authentication, which means you must pass the following to the request header:

Authentication: Basic base64(API_KEY:)

The extra : is required, because it separates the username and the password, but in our case the password is empty.

3# Request Body schema

Request name Request value Explanation
info_hash string = "INFO_HASH" It must be a valid info_hash value

4# Examples

4.1# PHP + cURL
<?php
$auth_key = base64_encode('API_KEY:'); //DO NOT REMOVE ":"!
    
$request_body = [
    'info_hash' => 'REPLACE_INFO_HASH',
];
    
$request_header = [
    "Authorization: Basic {$auth_key}",
];

$ch = curl_init();
    curl_setopt_array($ch, [
    CURLOPT_URL => "https://hypercache.net/api/GetTorrent",
    CURLOPT_HEADER => false,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $request_body,
    CURLOPT_HTTPHEADER => $request_header,
    CURLOPT_TIMEOUT => 10,
]);
    
$curl_response = curl_exec($ch);
$curl_error = curl_error($ch);
curl_close($ch);

if ($curl_error)
{
    echo "cURL Error #:" . $curl_error;
}
else
{
    echo $curl_response;
}
4.2# Shell + cURL
curl -X POST \
  -H "Authorization: Basic REPLACE_BASIC_AUTH" \
  -F "info_hash=REPLACE_INFO_HASH" \
  https://hypercache.net/api/GetTorrent
4.3# Node + Request
const request = require('request');

const options = {
    method: 'POST',
    url: 'https://hypercache.net/api/GetTorrent',
    headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'},
    body: {
        'info_hash': 'REPLACE_INFO_HASH'
    }
};

request(options, function (error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

5# Response

{
  "status": (bool) true|false,
  "message": "string"
}


[POST] /UploadTorrent

1# API endpoint URL: https://hypercache.net/api/UploadTorrent

2# HTTP: Authentication

Username Password
API_KEY leave empty

Hypercache uses Basic authentication, which means you must pass the following to the request header:

Authentication: Basic base64(API_KEY:)

The extra : is required, because it separates the username and the password, but in our case the password is empty.

3# Request Body schema

Request name Request value Explanation
torrent file = "/location/to/your_file.torrent",
mime = "application/x-bittorrent",
name = "torrent_name.torrent",
It must be a valid torrent file

4# Examples

4.1# PHP + cURL
<?php
$auth_key = base64_encode('API_KEY:'); //DO NOT REMOVE ":"!
    
$request_body = [
    'torrent' => new CurlFile('/location/to/your_file.torrent', 'application/x-bittorrent', 'torrent_name.torrent'),
];
    
$request_header = [
    "Authorization: Basic {$auth_key}",
    "Content-Type: multipart/form-data",
];

$ch = curl_init();
    curl_setopt_array($ch, [
    CURLOPT_URL => "https://hypercache.net/api/UploadTorrent",
    CURLOPT_HEADER => false,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => $request_body,
    CURLOPT_HTTPHEADER => $request_header,
    CURLOPT_TIMEOUT => 10,
]);
    
$curl_response = curl_exec($ch);
$curl_error = curl_error($ch);
curl_close($ch);

if ($curl_error)
{
    echo "cURL Error #:" . $curl_error;
}
else
{
    echo $curl_response;
}
4.2# Shell + cURL
curl -X POST \
  -H "Authorization: Basic REPLACE_BASIC_AUTH" \
  -F "torrent=@/location/to/your_file.torrent" \
  https://hypercache.net/api/UploadTorrent
4.3# Node + Request
const request = require('request');

const options = {
    method: 'POST',
    url: 'https://hypercache.net/api/UploadTorrent',
    headers: {'Content-Type': 'multipart/form-data', Authorization: 'Basic REPLACE_BASIC_AUTH'},
    body: {
        'torrent': fs.createReadStream('/location/to/your_file.torrent')
    }
};

request(options, function (error, response, body) {
    if (error) throw new Error(error);

    console.log(body);
});

5# Response

{
  "status": (bool) true|false,
  "message": "string"
}

Remember, Google is your friend.