Skip to content
CodeOnAir
Docs menu

Create links from your server

Create, list, update and disable AppLinks from your backend with the CodeOnAir REST API — authentication, fields, paging, errors and limits.

Use the REST API to create links from your backend — one per user for referrals, one per product, or thousands at once from a CSV. Requests are JSON over HTTPS.

Authentication#

Generate an API key in Settings → App credentials (it's shown once) and send it on every request. Each key belongs to one app.

Header
Authorization: Bearer sk_live_…
Important
Keep the key on your servers. If it leaks, generate a new one — the old key stops working at once.
Request
curl -X POST https://app.codeonair.com/v1/links \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{
    "slug": "summer",
    "name": "Summer sale",
    "deep_link_url": "https://shop.example/sale?code=SUMMER",
    "url_prefix": "default",
    "campaign": "summer-2026",
    "og_title": "50% off this week"
  }'
Response · 201 Created
{
  "id": "lnk_…",
  "url": "https://shop.codeonair.com/summer",
  "slug": "summer",
  "path": "/sale",
  "params": { "code": "SUMMER" },
  "campaign": "summer-2026",
  "behavior": { "ios": "app", "android": "app" },
  "og": { "title": "50% off this week", "description": null, "image": null },
  "disabled": false,
  "created_at": "2026-10-20T10:00:00.000Z"
}

Fields#

FieldMeaning
slugThe short URL after the prefix. Optional — a random one is made.
nameA name for you in the dashboard.
deep_link_urlYour app receives its path and query; desktop browsers open it.
url_prefixWhich prefix the link lives on: default or a prefix id.
attribution_windowSeconds an install is credited to the link (default 3600).
campaign, utm — for grouping and analytics.
og_title, og_description, og_image — the link preview. Empty ones come from your website.
ios_fallback_url, android_fallback_url, web_fallback_url — where to go instead of the stores or your website.
expires_atAn ISO date after which the link stops working.

Endpoints#

MethodPathWhat it does
POST/v1/linksCreate a link
POST/v1/links/bulkCreate up to 1,000 links in one request
GET/v1/links?q=&campaign=&cursor=&limit=List links, newest first
GET/v1/links/:idGet a link
PATCH/v1/links/:idChange a link (send only the fields to change)
DELETE/v1/links/:idDisable a link
GET/v1/links/:id/qrThe link's QR code

Paging#

Lists return { "data": [...], "next_cursor": "…" }. Pass next_cursor back as ?cursor= for the next page; it's null on the last page.

Errors and limits#

Errors use HTTP status codes and a JSON body with a stable code you can switch on:

Error response
{ "error": { "code": "slug_taken", "message": "A link with that slug already exists on this URL prefix" } }
StatusWhen
400A field is invalid — the message says which.
401Missing or wrong API key.
402Your plan doesn't include this (e.g. creating links on Free).
403email_not_verified: verify the workspace owner's email first. link_disabled_for_abuse: CodeOnAir disabled this link and it can't be edited.
404The link doesn't exist in this app.
409The short URL is already taken on that prefix.
422unsafe_destination: Google Safe Browsing flags a destination. destination_not_allowed: an IP-address or private host, a URL shortener (bit.ly, tinyurl.com…) or a blocked domain — link straight to the final page.
429More than 600 requests a minute with one key — slow down and retry. new_account_rate_limited: a Free workspace in its first 7 days can create 30 links an hour and 100 a day; paid plans aren't limited.
Stuck? Write to support@codeonair.com with your App ID and what you tried — we reply within a working day.