Errors
All errors share one JSON format and a stable error.code. Handle errors by code, not by the message text.
{
"error": {
"code": "invalid_request",
"message": "\"url\" must be a valid absolute URL.",
"status": 400,
"details": { "field": "url" }
},
"requestId": "req_3f9a1c7e5b2d4a6f80"
}Codes
| Status | code | What to do |
|---|---|---|
| 400 | invalid_request, invalid_json | fix the request; details.field names the field |
| 401 | missing_api_key, invalid_api_key, api_key_revoked, api_key_expired | check or renew the key |
| 403 | insufficient_scope | create a key with the scope in details.requiredScope |
| 403 | content_policy_required | accept the content policy once in the dashboard |
| 403 | verification_required | the account needs additional verification; complete it in the dashboard |
| 403 | account_inactive, api_key_suspended, ip_not_allowed | contact support or check the IP list |
| 404 | not_found | the link does not exist or belongs to another account |
| 409 | title_taken, short_code_taken | use another title or short code |
| 422 | url_not_allowed, url_shortener_not_resolved | destination not allowed |
| 429 | rate_limited, daily_quota_exceeded | wait for Retry-After |
| 5xx | internal_error, upstream_unavailable, service_unavailable | retry with backoff; if it persists, contact support with the requestId |
Pagination
Lists use a cursor: pass nextCursor as cursor to get the next page; it is null when there are no more. limit accepts 1 to 100 (default 20).