Authentication
All API requests must be authenticated. Include your API key in the `Authorization` header of your request as a Bearer token.
Authorization: Bearer YOUR_API_KEY
You can find your API key in your account settings on the dashboard.
Endpoint: Create a Link
This endpoint allows you to programmatically shorten a long URL.
Method: POST
URL: https://api.pocolink.com/v1/links
Request Body (JSON)
{
"url": "https://www.yourwebsite.com/your-long-url-to-shorten",
"custom_slug": "my-cool-api-link"
}
url
(string, required): The original URL you want to shorten.custom_slug
(string, optional): A custom back-half for your link. If not provided, a random one will be generated.
Success Response (201 Created)
{
"success": true,
"link": {
"id": "lnk_12345",
"short_url": "https://pocolink.com/my-cool-api-link",
"long_url": "https://www.yourwebsite.com/your-long-url-to-shorten",
"created_at": "2025-08-20T10:00:00Z"
}
}
Error Response (400 Bad Request)
{
"success": false,
"error": "The custom slug 'my-cool-api-link' is already taken."
}
Webhooks (Coming Soon)
We are working on webhooks that will notify your application in real-time when a link is clicked. Stay tuned!