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.
Create a link#
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#
| Field | Meaning |
|---|---|
slug | The short URL after the prefix. Optional — a random one is made. |
name | A name for you in the dashboard. |
deep_link_url | Your app receives its path and query; desktop browsers open it. |
url_prefix | Which prefix the link lives on: default or a prefix id. |
attribution_window | Seconds 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_at | An ISO date after which the link stops working. |
Endpoints#
| Method | Path | What it does |
|---|---|---|
| POST | /v1/links | Create a link |
| POST | /v1/links/bulk | Create up to 1,000 links in one request |
| GET | /v1/links?q=&campaign=&cursor=&limit= | List links, newest first |
| GET | /v1/links/:id | Get a link |
| PATCH | /v1/links/:id | Change a link (send only the fields to change) |
| DELETE | /v1/links/:id | Disable a link |
| GET | /v1/links/:id/qr | The 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" } }| Status | When |
|---|---|
| 400 | A field is invalid — the message says which. |
| 401 | Missing or wrong API key. |
| 402 | Your plan doesn't include this (e.g. creating links on Free). |
| 403 | email_not_verified: verify the workspace owner's email first. link_disabled_for_abuse: CodeOnAir disabled this link and it can't be edited. |
| 404 | The link doesn't exist in this app. |
| 409 | The short URL is already taken on that prefix. |
| 422 | unsafe_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. |
| 429 | More 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. |