Skip to content

Codes API

Codes API

Version 1 · Base path /api/v1 · JSON in, JSON out · Keys from Settings, API

Make, read, retarget and delete your dynamic codes from a script. Call it from a server, never from a browser page: the API sends no CORS headers.

On this page

Authentication

Send an API key as a bearer token: Authorization: Bearer <key>. Make keys under Settings, API. A key is shown once when it is made and cannot be shown again.

A key acts as one role in one workspace: a read key can list and read; a read and write key can also make, retarget and delete. It never has more standing than the person who made it, and it stops working the moment it is revoked.

Plans, editing and limits

Reading, listing, retargeting and deleting codes that already exist work on every plan. Editing is never capped by plan.

Making codes also has a daily allowance per workspace, set by the plan. It resets at 00:00 UTC. A batch that would go past it is refused whole.

403Making codes, single or batch, needs a plan that includes API access, and a batch must fit the plan's batch size. A 403 with plan_required or plan_limit says which.
423When a code's editing is paused, retargeting it answers 423 edits_locked and the code keeps redirecting. Deleting is never locked.
429A create past the day's allowance answers 429 daily_limit with Retry-After in seconds, until 00:00 UTC.
429Requests are limited per key and per workspace. A 429 carries Retry-After in seconds.

List your codes

GET/api/v1/codes

Newest first. Needs a read key. Pass nextCursor back as cursor for the next page.

Query

NameTypeNotes
limitinteger1 to 100, default 50
cursorstringFrom the previous page's nextCursor
Request
curl "https://app.keptscan.com/api/v1/codes?limit=2" \
  -H "Authorization: Bearer $API_KEY"

Responses

StatusMeaning
200{ codes: Code[], nextCursor: string | null }
400invalid_request, invalid_cursor
401 · 429 · 503See Errors
Show responseHide response
Response · 200
{
  "codes": [
    {
      "shortCode": "K3M9X2QA",
      "url": "https://kptqr.com/K3M9X2QA",
      "destination": "https://shop.example/spring-menu",
      "label": "Spring menu",
      "folderId": null,
      "folder": null,
      "state": "live",
      "redirectsUntil": null,
      "createdAt": "2026-10-09T09:30:00Z"
    }
  ],
  "nextCursor": "MjAyNi0xMC0wOQ"
}

Make a code

POST/api/v1/codes

Needs a read and write key and a plan that includes API access. The destination is optional, so a code can be printed before it points anywhere.

Body · NewCode

FieldTypeNotes
destinationstring | nullAn http:// or https:// web address, up to 2048 characters
labelstringUp to 120 characters
folderIdinteger | nullA folder in your workspace
Request
curl -X POST "https://app.keptscan.com/api/v1/codes" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destination":"https://shop.example/spring-menu","label":"Spring menu"}'

Responses

StatusMeaning
201The code was made: { shortCode, url, destination, label, folderId }
400invalid_json, invalid_request; field names the input
403insufficient_scope, plan_required, plan_limit, email_unverified
422invalid_destination, destination_blocked
423creation_locked: new codes cannot be made while the plan is not active
429daily_limit: the workspace has made the new codes its plan allows today. rate_limited or busy: see Errors
401 · 503See Errors
Show responseHide response
Response · 201
{
  "shortCode": "K3M9X2QA",
  "url": "https://kptqr.com/K3M9X2QA",
  "destination": "https://shop.example/spring-menu",
  "label": "Spring menu",
  "folderId": null
}

Make many codes in one request

POST/api/v1/codes/batch

Needs a read and write key, a plan that includes API access, and a batch within the plan's batch size, never more than 1000. Items succeed or fail one by one: created and rejected each carry the index of the item in your request.

Body

FieldTypeNotes
itemsNewCode[]1 to 1000 items; the request body stays under 1 MB
Request
curl -X POST "https://app.keptscan.com/api/v1/codes/batch" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"items":[{"destination":"https://shop.example/a"},{"destination":"ftp://shop.example/b"}]}'

Responses

StatusMeaning
201At least one code was made: { created: (Created & { index })[], rejected: { index, error, message }[] }
200No item could be made; see rejected
400invalid_json, invalid_request, batch_too_large
403insufficient_scope, plan_required, plan_limit, email_unverified
413payload_too_large: the request body is over 1 MB
423creation_locked
429daily_limit: the batch would take the workspace past the new codes its plan allows today, so nothing in it is made. rate_limited or busy: see Errors
401 · 503See Errors
Show responseHide response
Response · 201
{
  "created": [
    {
      "index": 0,
      "shortCode": "K3M9X2QA",
      "url": "https://kptqr.com/K3M9X2QA",
      "destination": "https://shop.example/spring-menu",
      "label": "",
      "folderId": null
    }
  ],
  "rejected": [
    {
      "index": 1,
      "error": "invalid_destination",
      "message": "The destination must be an http or https address."
    }
  ]
}

Read one code

GET/api/v1/codes/{code}

{code} is the 8-character short code. The answer is the same for a code that is not yours and one that never existed.

Request
curl "https://app.keptscan.com/api/v1/codes/K3M9X2QA" \
  -H "Authorization: Bearer $API_KEY"

Responses

StatusMeaning
200The Code object
404No such code on your account
401 · 429 · 503See Errors
Show responseHide response
Response · 200
{
  "shortCode": "K3M9X2QA",
  "url": "https://kptqr.com/K3M9X2QA",
  "destination": "https://shop.example/spring-menu",
  "label": "Spring menu",
  "folderId": null,
  "folder": null,
  "state": "live",
  "redirectsUntil": null,
  "createdAt": "2026-10-09T09:30:00Z"
}

Point a code somewhere else

PATCH/api/v1/codes/{code}

Needs a read and write key. Works on every plan. The change is live everywhere within propagationSeconds.

Body

FieldTypeNotes
destinationstringRequired. An http:// or https:// web address, up to 2048 characters
Request
curl -X PATCH "https://app.keptscan.com/api/v1/codes/K3M9X2QA" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destination":"https://shop.example/summer-menu"}'

Responses

StatusMeaning
200{ shortCode, destination, propagationSeconds }
400invalid_json, invalid_request
403insufficient_scope: the key can read but not change codes
404No such code on your account
422invalid_destination, destination_blocked
423edits_locked: editing is paused; the code keeps redirecting until redirectsUntil
401 · 429 · 503See Errors
Show responseHide response
Response · 200
{
  "shortCode": "K3M9X2QA",
  "destination": "https://shop.example/summer-menu",
  "propagationSeconds": 60
}

Delete a code

DELETE/api/v1/codes/{code}

Needs a read and write key. Works on every plan and is never locked. Anything printed with the code stops working, and its address is never given to anyone else.

Request
curl -X DELETE "https://app.keptscan.com/api/v1/codes/K3M9X2QA" \
  -H "Authorization: Bearer $API_KEY"

Responses

StatusMeaning
200{ shortCode, deleted: true }
403insufficient_scope
404No such code on your account
401 · 429 · 503See Errors
Show responseHide response
Response · 200
{
  "shortCode": "K3M9X2QA",
  "deleted": true
}

The Code object

FieldTypeNotes
shortCodestring8 characters
urlstringThe address printed codes point at
destinationstring | nullWhere a scan is sent
labelstring
folderIdinteger | null
folderstring | nullThe folder's name
statelive | locked | lapsedlive redirects and can be edited; locked redirects but editing is paused; lapsed shows the not-active page
redirectsUntildate-time | nullThe one date a code redirects until, when it is redirecting under a notice
createdAtdate-time
Example · Code
{
  "shortCode": "K3M9X2QA",
  "url": "https://kptqr.com/K3M9X2QA",
  "destination": "https://shop.example/spring-menu",
  "label": "Spring menu",
  "folderId": null,
  "folder": null,
  "state": "live",
  "redirectsUntil": null,
  "createdAt": "2026-10-09T09:30:00Z"
}

Errors

Every error is { error, message, field? }. error is a stable code to branch on; message is for people and may change.

StatusCodeMeaning
400invalid_json · invalid_request · invalid_cursor · batch_too_largefield names the input
401—The key is missing, malformed, unknown or revoked. One answer for all of them, with WWW-Authenticate
403insufficient_scope · plan_required · plan_limit · email_unverifiedThe key can read but not change; the plan does not include this; the plan's codes are all in use; the email is not verified
404—No such code on your account
413payload_too_largeThe request body is over 1 MB
422invalid_destination · destination_blockedThe address is not http(s), or is blocked
423edits_locked · creation_lockedEditing is paused for this code (it keeps redirecting until redirectsUntil); new codes cannot be made while the plan is not active
429rate_limited · busy · daily_limitToo many requests, other creates for the workspace are still running, or the workspace has used its new-codes allowance for the day (daily_limit, until 00:00 UTC). Nothing was made. Try again after the seconds in Retry-After
503unavailable · create_timeoutunavailable: nothing changed; it is safe to try again. create_timeout: a create ran out of time and the code may have been made, so list your codes before trying again
Example · 423 error
{
  "error": "edits_locked",
  "message": "Editing is paused for this code."
}