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"
}
FieldTypeRequiredDescription
urlstringYesThe destination URL (must be a valid URL)
codestringNoCustom short code. Auto-generated if omitted. Must be 3-50 characters, alphanumeric with hyphens.
titlestringNoOptional 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

CodeError CodeDescription
400INVALID_URLThe URL is not valid
400INVALID_CODEThe short code format is invalid
401UNAUTHORIZEDMissing or invalid authentication
403LINKLIMITREACHEDYou've reached your plan's link limit
409CODE_TAKENThe 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 code is 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:// or https://)