Skip to content

Create Link

Creates a new short link that redirects to the given destination URL. Optionally specify a custom slug, labels, routing rules, and an expiration date.

POST /v1/links
links:write

Request Body

ParameterTypeRequiredDescription
urlstringYesDestination URL. Must be a valid HTTP or HTTPS URL.
custom_slugstringNoCustom short code (3 – 64 characters, alphanumeric and hyphens). If omitted, a random 7-character code is generated.
labelsstring[]NoArray of labels for organizing links (max 10).
routing_rulesobject[]NoConditional routing rules (e.g. geo-based redirects). See Smart Routing for schema details.
expires_atstringNoISO 8601 datetime after which the link returns 410 Gone.

Request Examples

Terminal window
curl -X POST https://xqr.co/api/v1/links \
-H "Authorization: Bearer xqr_pk_a1b2c3d4.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/summer-sale?utm_source=qr",
"custom_slug": "summer24",
"labels": ["campaign", "summer"],
"expires_at": "2026-09-30T23:59:59Z"
}'

Response

201 Created
{
"data": {
"id": "d47f2e1a-8c3b-4a5d-9e6f-1234567890ab",
"short_url": "https://xqr.co/summer24",
"short_code": "summer24",
"destination": "https://example.com/summer-sale?utm_source=qr",
"enabled": true,
"labels": ["campaign", "summer"],
"routing_rules": [],
"scan_count": 0,
"last_scan_at": null,
"expires_at": "2026-09-30T23:59:59Z",
"created_at": "2026-03-21T14:30:00Z",
"updated_at": "2026-03-21T14:30:00Z"
},
"meta": {
"request_id": "req_8f3a2b1c4d5e6f70",
"rate_limit": {
"limit": 600,
"remaining": 599,
"reset": 1742572800
}
}
}

Was this page helpful?