Get started
API Endpoint
https://opnl.in/api/v1/
The Link Shortener (OPNL.in) is a web-based service designed to convert long URLs into shortened, easily shareable links. It provides users with a simple, efficient tool to reduce the character length of a URL while maintaining the link's original function. This service is ideal for social media sharing, email campaigns, or simplifying lengthy URLs, etc.
To use this API, you need an API key. Please contact us at ratan.dahat@selftech.in to get your own API key.
get shortlink
# Here is a curl example
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://opnl.in/api/v1/opnl-short-link',
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(
'long_link' => 'https://www.selftech.in/contact'
),
CURLOPT_HTTPHEADER => array(
'opnlkey: ol-PFAb3O0*********',
'secret: mEFgF1niz9L6PGuOgaeCet3Cgj**************'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
To get ShortLink you need to make a POST call to the following url :
https://opnl.in/api/v1/opnl-short-link
Result example :
{
"status": true,
"link": "https://opnl.in/4H****",
"message": "ShortLink has been created."
}
HEADERS
| Field | Type | Description |
|---|---|---|
| opnlkey | String | Your API App Key. (shared by Link Shortener - opnl.in provider) |
| secret | String | Your API App Secret. (shared by Link Shortener - opnl.in provider) |
BODY PARAMETERS
| Field | Type | Description |
|---|---|---|
| long_link | String | A uniqe link like (https://www.selftech.in/contact) |
Errors
The Link Shortener - opnl.in API uses the following error codes:
| Error Code | Meaning |
|---|---|
| 500 | An error occurred while processing your request. |
| 400 | The HTTP 400 Bad Request client error response status code indicates that the server would not process the request due to something the server considered to be a client error. |
| 422 |
Unvalid opnlkey secret for this domain. This error appears if you use an API key non specified for your domain. Developper or Universal API keys doesn't have domain checker.
|