Sample cURL Request

curl --location 'https://blx.ist/api/shorten' \
--header 'Authorization: YOUR_API_KEY_HER' \
--form 'url="https://fayvaz.com"'

Sample Php cURL Request

$curl = curl_init();
curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://blx.ist/api/shorten',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => array('url' => 'https://fayvaz.com'),
    CURLOPT_HTTPHEADER => array(
        'Authorization: YOUR_API_KEY_HER'
    ),
));
$response = json_decode(curl_exec($curl));
curl_close($curl);
echo $response;

Sample Php Guzzle Request

$client = new Client();
$headers = [
    'Authorization' =>
        'YOUR_API_KEY_HER'
    ];
$options = [
    'multipart' => [
        [
            'name' => 'url',
            'contents' => 'https://fayvaz.com'
        ]
]];
$request = new Request('POST', 'https://blx.ist/api/shorten', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();

Sample NodeJs - Axious Request

const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();
data.append('url', 'https://fayvaz.com');

let config = {
     method: 'post',
     maxBodyLength: Infinity,
     url: 'https://blx.ist/api/shorten',
     headers: {
         'Authorization': 'YOUR_API_KEY_HER',
         ...data.getHeaders()
     },
     data : data
};

axios.request(config)
.then((response) => {
     console.log(JSON.stringify(response.data));
})
.catch((error) => {
     console.log(error);
});

Sample Success Json Response

{
    "status": "success",
    "url": "https://fayvaz.com",
    "short_url": "https://blx.ist/aa302"
}

Sample Error Json Response

{
    "status": "error",
    "message": "Url is not valid"
}