Minify API

Minify long URL and returns the corresponding short URL and key.
Endpointhttps://minified.cc/api/minify.json
Request
POST Parameters
path(required) Long URL that needs to be shortened.
token (optional) Custom short URL token. If token is empty or not specified, it will generate an 8 characters random string unique token.
Headers
signature

(required) Long URL that needs to be shortened.

This is used as a verification for the API request and the POST parameters passed. It is generated by hashing (HMAC-SHA256) the POST parameters (sorted by key) and using minified.cc as the hashing key.

You may refer to this simple PHP request snippet:

<?php

$data = ['path' => 'https://example.com/path.html', 'token' => 'example'];
ksort($data);

$body = http_build_query($data);
$signature = hash_hmac('sha256', $body, 'minified.cc');
$endpoint = 'https://minified.cc/api/minify.json';

$resource = curl_init();
curl_setopt($resource, CURLOPT_URL, $endpoint);
curl_setopt($resource, CURLOPT_POST, true);
curl_setopt($resource, CURLOPT_POSTFIELDS, $body);
curl_setopt($resource, CURLOPT_RETURNTRANSFER, true);
curl_setopt($resource, CURLOPT_HTTPHEADER, array('Signature: ' . $signature));

$response = curl_exec($resource);
curl_close($resource);

print_r(json_decode($response));
Response
{
  "error": false,
  "url": {
    "token": "example",
    "path": "https://example.com/path.html"
  }
}

Expand API

Expand key to the corresponding short and long URLs.
Endpointhttps://minified.cc/api/expand.json
Request
GET Parameters
token(required) Short URL's token string to be expanded.
Response
{
  "error": false,
  "url": {
    "token": "example",
    "path": "https://example.com/path.html"
  }
}

Error Response

General API error response structure.
{
  "error": true,
  "message": "An error has occurred.", // example error message
}