Introduction
This document describes the API available. You agree to abide by the terms and conditions by interacting with the API.
Base URL: https://api.abbr.ninja/api/v1
Create/Retrieve URI
Shorten URI
curl "https://api.abbr.ninja/api/v1/shorten" \
-X POST -H "Content-Type:application/json" \
-d '{"uri":"https://example.com/"}'
Response:
200 OK:
{
"id": "UjqxAn7",
"html_safe_uri": "https://example.com/",
"raw_uri": "https://example.com/",
"encoded_uri": "https://example.com/"
}
400 Bad Request:
{ "msg": "Invalid URI." }
Create a shorten URI from the long URI. id can be used for retrieving the original URI.
HTTP Request
POST /shorten
Body
| Parameter | Description |
|---|---|
| uri | The URI to be shorten. |
Retrieve Original URI
curl "https://api.abbr.ninja/api/v1/retrieve?id=UjqxAn7"
Response:
200 OK:
{
"html_safe_uri": "https://example.com/",
"raw_uri": "https://example.com/",
"encoded_uri": "https://example.com/"
}
400 Bad Request:
{ "msg": "Undefined id." }
404 Not Found:
{ "msg": "ID not found." }
This endpoint retrieves the original URI associated with a valid ID.
HTTP Request
GET /retrieve?id=<ID>
Query String Parameters
| Parameter | Description |
|---|---|
| ID | The ID returned when the original URI is shorten. |
Server Status
Query Current Server Status
curl "https://api.abbr.ninja/api/v1/status"
Response:
200 OK:
{ "status": "Ok" }
Query server status. status can be either Ok, Maintenance or Down.
HTTP Request
GET /status
HTTP Status Codes
| Status Code | Description | |
|---|---|---|
| 200 | OK | All is well. |
| 301 | Moved Permanently | Redirect to the shorten link. |
| 400 | Bad Request | Your request is invalid. |
| 404 | Not Found | Invalid endpoint or no shortened link. |
| 429 | Too Many Requests | Rate limited. See the rate limit section for more information. |
| 500 | Internal Server Error | Server backend issue. |
| 503 | Service Unavailable | Server under maintenance. |