Create Link
POST /api/v1/links
Create a new short link. You can optionally provide a custom short code.
Request Body
json
{
"url": "https://example.com/very-long-url",
"code": "my-custom-code",
"title": "Optional label"
}| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The destination URL (must be a valid URL) |
code | string | No | Custom short code. Auto-generated if omitted. Must be 3-50 characters, alphanumeric with hyphens. |
title | string | No | Optional label for your own reference |
Response
201 Created
json
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"short_code": "my-custom-code",
"short_url": "https://shrinkr.nl/my-custom-code",
"original_url": "https://example.com/very-long-url",
"title": "Optional label",
"created_at": "2026-03-01T12:00:00Z"
}Errors
| Code | Error Code | Description |
|---|---|---|
400 | INVALID_URL | The URL is not valid |
400 | INVALID_CODE | The short code format is invalid |
401 | UNAUTHORIZED | Missing or invalid authentication |
403 | LINKLIMITREACHED | You've reached your plan's link limit |
409 | CODE_TAKEN | The short code is already in use |
Example
bash
curl -X POST https://shrinkr.nl/api/v1/links \
-H "Authorization: Bearer sk_shrinkr_a1b2c3d4e5f6g7h8i9j0k1l2" \
-H "Content-Type: application/json" \
-d '{
"url": "https://docs.example.com/getting-started",
"code": "docs-start",
"title": "Documentation"
}'Notes
- If
codeis omitted, a random 8-character alphanumeric code is generated - Short codes are case-sensitive
- Short codes must be unique across all users
- The URL must include a protocol (
http://orhttps://)