Skip to content

API reference

Lumberjack API v1: API keys, links, routing rules, statistics, QR codes and export, with errors, rate limits, pagination and retries.

Updated

Overview

The Lumberjack API lets your own software create and manage short links, their routing rules and password, read their statistics, download their QR codes and export your data.

Every route lives under the base URL below. Requests and responses are JSON, except QR codes and CSV exports. A request body is limited to 1 MB.

The API follows the same rules as your account: every destination goes through the same safety checks, a link may be pending or held exactly as in your client area, and the features, quotas and limits of your plan apply.

Fields may be added to objects at any time; nothing is removed or renamed in /v1. Every response carries an X-Request-Id header (req_ followed by 20 letters and digits), repeated in error.request_id.

Base URL
https://api.l-k.io/v1

Authentication

Send an API key in the Authorization header, and only there: Authorization: Bearer lj_live_…. A key is lj_live_ followed by 32 letters and digits.

Keys are created in your client area, under Settings → API, by the owner or an admin of the organization, once it has reached trust level 2. A key can expire after 1 to 365 days, or never. It is shown only once: we keep only a fingerprint of it.

A key belongs to one organization. At each request, it acts with the role that the member who created it holds at that moment: if the role changes, the key follows.

Never put a key in a web page: the API answers servers, not browsers, and sends no CORS headers.

A missing, malformed, unknown, revoked or expired key is answered with 401 authentication (code RSAKKO001), without saying which. A suspended key is answered with 403 permission (code RSAKKO002) and a reason: velocity, under_review, account_not_verified, account_deletion_scheduled or organization_frozen. account_not_verified means the account has fallen below trust level 2: the key becomes usable again by itself once level 2 is back.

Repeated failed authentications from one address are refused for a while with 429.

Example
curl https://api.l-k.io/v1/account \
  -H "Authorization: Bearer lj_live_…"

Scopes and roles

A key carries one or more scopes. A route outside the scopes of the key answers 403 permission (code RSAKKO004), with the missing scope in error.scope.

The role of the member who created the key applies as well: owners, admins and editors can write, viewers can only read, and the export needs an owner or an admin.

  • account:read: the account of the key.
  • links:read: list and read links, their rules and their health, and export the data.
  • links:write: create, update, pause and resume links, replace their rules, set or remove their password.
  • links:delete: delete links.
  • stats:read: statistics of a link.
  • qr:read: QR code of a link.

Errors

Every error has the same shape, shown below. type tells you what to do; code is the Lumberjack code, for example RSLIKO010; param names the field, parameter or JSON path at fault; doc_url points to the description of the type; request_id identifies the request.

Depending on the case, the error also carries reason, scope, upgrade_url, limit, existing (the link that already holds an external_id), items (every refused item of a bulk creation), scheduled_at or frozen_at.

  • invalid_request (400): the body cannot be read, a field or parameter is unknown or repeated, a value is out of bounds, or the cursor is invalid. Fix the request; do not send it again as is.
  • authentication (401): the key is missing, malformed, unknown, revoked or expired.
  • permission (403): the key lacks the scope or is suspended, your plan lacks the feature (upgrade_url), or the role of the key’s creator is too low.
  • not_found (404): the link, channel or route does not exist, or belongs to another organization.
  • conflict (409): the external_id or the alias is taken, the Idempotency-Key was used with another request or is still in progress, the link is blocked or deleted, the account deletion is scheduled, or the organization is frozen or read-only.
  • unsafe_destination (422): our safety checks refused the destination (reason). Use another destination.
  • unprocessable (422): a rule, an alias or the QR options are invalid (param gives the path).
  • quota_exceeded (403): a quota or limit of your plan is reached: monthly links, active links, daily creations or links created in bulk per day. See upgrade_url.
  • account_under_review (423): your account is under review; link creation, bulk included, destination changes, setting a password and replacing the rules are suspended until the review ends.
  • rate_limited (429): too many requests. Wait the number of seconds given in Retry-After.
  • server_error (500): an unexpected error on our side; the request may or may not have taken effect. Retry later, with the same Idempotency-Key for a write.
  • unavailable (503): a service Lumberjack depends on does not answer, and nothing was changed. Retry after the number of seconds given in Retry-After.
Example
{
  "error": {
    "type": "invalid_request",
    "code": "RSV1KO001",
    "message": "Unknown field: colour",
    "param": "colour",
    "doc_url": "https://api.l-k.io/v1/docs#invalid_request",
    "request_id": "req_7f3KQ0aZbC9dE1fG2hJk"
  }
}

Rate limits

Limits are counted per organization, all its keys together, in three classes: reads (every GET) and writes (every other method) per minute, and links created in bulk per UTC day.

The limits depend on your plan: see our plans page, or api_limits in GET /account.

Each authenticated response carries X-RateLimit-Limit (requests allowed per minute for its class), X-RateLimit-Remaining (requests left in the sliding minute) and X-RateLimit-Reset (seconds before the class is fully available again).

Beyond the limit, the API answers 429 rate_limited (code RSV1KO003) with a Retry-After header, in seconds. A refused request is not counted.

Rendering QR codes has its own limit per minute, counted for the member who created the key and shared with the client area.

Pagination

GET /links returns one page at a time: data, next_cursor and has_more. The total is not returned. To read every link, send next_cursor back as cursor while has_more is true.

limit sets the size of a page, from 1 to 100 (25 by default).

A cursor is bound to the sort, the order and the filters it was issued for: send it with the same parameters, or the API answers 400 invalid_request with param set to cursor. A cursor does not expire.

Example
curl "https://api.l-k.io/v1/links?limit=100" \
  -H "Authorization: Bearer lj_live_…"

curl "https://api.l-k.io/v1/links?limit=100&cursor=<next_cursor>" \
  -H "Authorization: Bearer lj_live_…"

Retries and Idempotency-Key

POST /links, POST /links/bulk and PUT /links/ext_{external_id} accept an Idempotency-Key header: 1 to 64 letters, digits, _ or -. Send the same value when you retry the same request, and the links are created only once.

  • A value is kept for 24 hours and shared by all the keys of the organization.
  • Same route and same body: the stored response is returned again, with the header Idempotent-Replayed: true.
  • Same value with another route or another body: 409 conflict (code RSIDKO001).
  • First request still in progress: 409 conflict (code RSIDKO002); retry a little later. An attempt left unfinished for 60 seconds can be taken over.
  • A 5xx response is not stored: retry with the same value.
Example
curl https://api.l-k.io/v1/links \
  -H "Authorization: Bearer lj_live_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: menu-2026" \
  -d '{"destination": "https://example.com/menu", "title": "Menu 2026", "external_id": "menu-2026"}'

Every route that returns a link returns this object.

  • id: public identifier of the link, used as {link} in the paths.
  • domain, code, short_url: host name, code and full short URL of the link.
  • is_custom_alias: true when the code was chosen with alias.
  • kind: url.
  • destination: where the link leads.
  • title, note, tags: your own labels.
  • channel: null, or { id, name, kind }, where kind is print, email, web, social, signage or other.
  • external_id: your own identifier, unique in the organization, or null.
  • status: active, paused (by you), disabled (by Lumberjack), banned or deleted.
  • activation: { status, public_at, reason }, where status is public, pending (public at public_at after a clean check) or held (under human review).
  • password_protected, printed_copies, rules_count.
  • clicks: { total, last_at }.
  • created_at, updated_at: date and time, ISO 8601.

Account

Returns the organization of the key, its plan tier, its trust level, the links created this month and the API limits.

  • organization: { id, name, kind }, where kind is personal or team.
  • tier: free, print, studio, or an older tier.
  • trust_level: from 1 to 3; through a key, only 2 or 3 can be seen.
  • usage: month_created (links created this calendar month, UTC, bulk included, in every organization of the owner of this one) and monthly_limit (null: no monthly limit).
  • api_limits: read_per_min, write_per_min and bulk_per_day, or null.

GET /v1/account

Scope
account:read
Success
200
Errors
401, 403, 429, 500, 503

Returns the links one page at a time (see Pagination). Deleted links appear only with status=deleted. An unknown or repeated parameter answers 400.

  • cursor: next_cursor of the previous page.
  • limit: 1 to 100, 25 by default.
  • q: start of a code, or text in the title, the destination or a tag (100 characters at most).
  • tag: one tag (30 characters at most).
  • channel: a channel id, or none.
  • status: active, paused, disabled, banned or deleted.
  • domain: host name of the links’ domain; an unknown host name returns an empty page.
  • sort: created_at (default) or updated_at.
  • order: desc (default) or asc.

GET /v1/links

Scope
links:read
Success
200
Errors
400, 401, 403, 429, 500, 503
Example
curl "https://api.l-k.io/v1/links?status=active&tag=menu&limit=50" \
  -H "Authorization: Bearer lj_live_…"

The destination goes through the safety checks; the link may start pending or held (see activation). Returns 201 and the link.

An external_id already used in the organization, deleted links included, answers 409 conflict with the existing link in error.existing. An unknown field answers 400.

  • destination (required): http or https URL, 4096 characters at most.
  • alias: your own code, if your plan includes custom aliases: 5 to 15 letters, digits, - or _.
  • title (1500 characters at most) and note (3000 characters at most).
  • tags: up to 10 tags of 1 to 30 characters.
  • channel_id: id of one of your channels; an unknown channel answers 404.
  • printed_copies: number of printed copies, from 0 to 10 million.
  • password: 6 to 300 characters.
  • rules: routing rules, in the format of Routing rules below.
  • external_id: your own identifier, unique in the organization: 1 to 100 printable ASCII characters, without a space at either end.

POST /v1/links

Scope
links:write
Success
201
Errors
400, 401, 403, 404, 409, 422, 423, 429, 500, 503
Idempotency-Key
Accepted
Example
curl https://api.l-k.io/v1/links \
  -H "Authorization: Bearer lj_live_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: menu-2026" \
  -d '{"destination": "https://example.com/menu", "title": "Menu 2026", "tags": ["menu"], "printed_copies": 1000, "external_id": "menu-2026"}'

Create links in bulk

Creates 1 to 100 links in one request, all or nothing. The body is { "links": [ … ] }; each item takes the fields of POST /links.

The whole batch is checked before the first link is created. If a single item is refused (shape, feature, alias or external_id taken, quota, safety check), nothing is created: the error has the code RSBLKO001 and lists every refused item in error.items, with its index. Its type follows the reason of the refusal.

Needs the bulk feature of your plan; the links count in the daily bulk limit. Returns 201 and { "data": [ … ] }, in the order of the batch.

POST /v1/links/bulk

Scope
links:write
Success
201
Errors
400, 401, 403, 404, 409, 422, 423, 429, 500, 503
Idempotency-Key
Accepted
Example
curl https://api.l-k.io/v1/links/bulk \
  -H "Authorization: Bearer lj_live_…" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: flyers-2026" \
  -d '{"links": [{"destination": "https://example.com/a", "external_id": "flyer-a"}, {"destination": "https://example.com/b", "external_id": "flyer-b"}]}'

If no link of the organization has this external_id, the link is created (201, same checks as POST /links). Otherwise, the given fields are updated (200, same checks as PATCH).

  • The alias of an existing link cannot change (409).
  • password and rules of an existing link change through their own routes: sending them, or another domain, answers 400.
  • A deleted link is never brought back (409, with the link in error.existing).
  • An external_id in the body must be the one in the path (400 otherwise).

PUT /v1/links/ext_{external_id}

Scope
links:write
Success
200, 201
Errors
400, 401, 403, 404, 409, 422, 423, 429, 500, 503
Idempotency-Key
Accepted
Example
curl -X PUT https://api.l-k.io/v1/links/ext_menu-2026 \
  -H "Authorization: Bearer lj_live_…" \
  -H "Content-Type: application/json" \
  -d '{"destination": "https://example.com/menu-winter", "title": "Winter menu"}'

Returns the link, whatever its status. In the paths, {link} is the code of the link, for example a1B2c3. A link that does not exist, or belongs to another organization, answers 404.

GET /v1/links/{link}

Scope
links:read
Success
200
Errors
401, 403, 404, 429, 500, 503
Example
curl https://api.l-k.io/v1/links/a1B2c3 \
  -H "Authorization: Bearer lj_live_…"

Updates the given fields: destination, title, note, tags, channel_id, printed_copies and external_id (null clears it). At least one field is needed, and any other field answers 400.

A new destination goes through the safety checks. Pause and resume have their own routes.

PATCH /v1/links/{link}

Scope
links:write
Success
200
Errors
400, 401, 403, 404, 409, 422, 423, 429, 500, 503
Example
curl -X PATCH https://api.l-k.io/v1/links/a1B2c3 \
  -H "Authorization: Bearer lj_live_…" \
  -H "Content-Type: application/json" \
  -d '{"destination": "https://example.com/menu-2027"}'

The link becomes a tombstone with the status deleted; its code is never given to anyone else. A blocked link cannot be deleted (409). Returns 204, without a body.

DELETE /v1/links/{link}

Scope
links:delete
Success
204
Errors
401, 403, 404, 409, 429, 500, 503
Example
curl -X DELETE https://api.l-k.io/v1/links/a1B2c3 \
  -H "Authorization: Bearer lj_live_…"

Pause and resume

Visitors of a paused link see a page saying that the link is paused. Neither route works on a blocked or deleted link (409). Both return the link.

Resuming counts like a creation for the active link limit of the free plan. A link disabled by our moderation cannot be resumed here (409).

POST /v1/links/{link}/pause

Scope
links:write
Success
200
Errors
400, 401, 403, 404, 409, 429, 500, 503

POST /v1/links/{link}/resume

Scope
links:write
Success
200
Errors
400, 401, 403, 404, 409, 429, 500, 503
Example
curl -X POST https://api.l-k.io/v1/links/a1B2c3/pause \
  -H "Authorization: Bearer lj_live_…"

Routing rules

GET returns the default destination and the rules, in priority order. PUT replaces all the rules at once, atomically, and returns them as stored, with their ids.

The order of the array is the priority. Several destinations in one rule split the visitors by weight. Keep the id of an existing destination to update it in place. A destination missing from the body is archived.

Each condition needs its feature in your plan. An invalid rule answers 422 unprocessable, with the path in param.

While your account is under review, PUT answers 423 account_under_review, even if no destination changes.

  • default_destination: the default destination of the link.
  • rules: up to 20 rules, each with label (80 characters at most), enabled (true by default), conditions and 1 to 10 destinations (destination, weight from 0.01 to 100, 100 by default, and id for an existing one). A link has at most 50 active destinations, counted over its enabled rules.
  • countries: ISO 3166-1 alpha-2 codes, such as FR; languages: ISO 639-1 codes, such as fr.
  • devices and os: device types and operating systems.
  • zone: IANA time zone, such as Europe/Paris; time_from and time_to: HH:MM; days: 1 (Monday) to 7.
  • from and to: YYYY-MM-DD HH:MM.

GET /v1/links/{link}/rules

Scope
links:read
Success
200
Errors
401, 403, 404, 429, 500, 503

PUT /v1/links/{link}/rules

Scope
links:write
Success
200
Errors
400, 401, 403, 404, 409, 422, 423, 429, 500, 503
Example
curl -X PUT https://api.l-k.io/v1/links/a1B2c3/rules \
  -H "Authorization: Bearer lj_live_…" \
  -H "Content-Type: application/json" \
  -d '{"default_destination": "https://example.com/menu", "rules": [{"label": "France, evening", "enabled": true, "conditions": {"countries": ["FR"], "zone": "Europe/Paris", "time_from": "18:00", "time_to": "23:00"}, "destinations": [{"destination": "https://example.com/soir", "weight": 100}]}]}'

Password

PUT protects the link with a password of 6 to 300 characters, sent as { "password": "…" }; DELETE removes it. Both need the password protection feature of your plan and return the link.

PUT /v1/links/{link}/password

Scope
links:write
Success
200
Errors
400, 401, 403, 404, 409, 423, 429, 500, 503

DELETE /v1/links/{link}/password

Scope
links:write
Success
200
Errors
401, 403, 404, 409, 429, 500, 503

Statistics

Human clicks, robots apart, as a continuous series in the time zone tz. from and to are local dates, both included; by default, the last 30 days.

Before tz_applied_from, days are UTC days: raw clicks are kept 13 months.

On the free plan, or without a plan, interval is limited to day and the period to the last 30 days; beyond that, the API answers 403 permission.

  • from, to: YYYY-MM-DD.
  • tz: IANA time zone name, UTC by default.
  • interval: day (default), week or month. A period covers at most 366 days by day, 1096 days by week and 3653 days by month.
  • Response: series (period, clicks, uniques, bots, partial) and totals (clicks, bots, uniques_sum). uniques is null when it was not measured.

GET /v1/links/{link}/stats

Scope
stats:read
Success
200
Errors
400, 401, 403, 404, 429, 500, 503
Example
curl "https://api.l-k.io/v1/links/a1B2c3/stats?from=2026-10-01&to=2026-10-31&tz=Europe/Paris&interval=week" \
  -H "Authorization: Bearer lj_live_…"

Breakdown

Clicks by dimension (required): country, device, os, browser, referrer, language or rule. Same from, to and tz as the statistics; limit from 1 to 100, 20 by default. The period covers at most 366 days. The breakdown is not available on the free plan, or without a plan (403 permission).

Response: rows (key, clicks and share of the total), with total, other and unknown. With dimension=rule, each row also gives label, position, destination_host and archived.

GET /v1/links/{link}/stats/breakdown

Scope
stats:read
Success
200
Errors
400, 401, 403, 404, 429, 500, 503
Example
curl "https://api.l-k.io/v1/links/a1B2c3/stats/breakdown?dimension=country&limit=10" \
  -H "Authorization: Bearer lj_live_…"

Destination health

Last known state of each destination of the link, the default one and those of the rules, in the destinations array: role (default or rule), label, destination, state, announced, last_status, failing_since, last_checked_at, last_ok_at and held_by_policy. The response also gives monitored and muted for the link.

GET /v1/links/{link}/health

Scope
links:read
Success
200
Errors
401, 403, 404, 429, 500, 503

QR code

The QR code of the link, rendered with its saved QR options. Needs the QR feature of your plan.

  • format: svg (default) or png.
  • px: target side of the PNG in pixels, from 256 to 4096, 1024 by default. The actual side is a multiple of the number of modules.
  • print_mm: printed side in millimetres, from 5 to 2000. Without px, the PNG targets this side at the dpi resolution (beyond 4096 pixels: 422); the SVG takes this size.
  • dpi: from 150 to 600, 300 by default: resolution used with print_mm, written in the PNG when dpi is given, or when print_mm is given without px.
  • ec (L, M, Q or H), margin (4 to 10 modules), fg and bg (#RRGGBB), logo (none, default, or custom: followed by the URL of the logo, which must be a PNG or JPEG image of the Lumberjack CDN, 512 KB at most, else 422 with code RSQRKO002) and logo_size (10 to 40, in % of the side of the symbol): override the saved QR options for this rendering. Colors other than black on white, or a custom logo, need the custom QR feature of your plan (403). A logo given without ec raises a saved L or M to H; only an explicit ec of L or M with a logo answers 422 (code RSQRKO001).
  • download: 0 (default) or 1. With 1, the image is sent as a file to save, after a readability check; a code that would not scan reliably answers 422 (code RSQRKO001).
  • Header X-QR-Size: the side in pixels for a PNG, in modules, quiet zone included, for an SVG.

GET /v1/links/{link}/qr

Scope
qr:read
Success
200
Errors
400, 401, 403, 404, 422, 429, 500, 503
Example
curl "https://api.l-k.io/v1/links/a1B2c3/qr?format=png&px=1024" \
  -H "Authorization: Bearer lj_live_…" \
  -o a1B2c3.png

Export

Every link of the organization, deleted and blocked ones included, with its rules and its daily clicks, streamed. Same format as the export of your client area (format_version 1). Needs an owner or an admin.

Raw clicks need the detailed export feature of your plan.

  • format: json (default, one document) or csv (one file per part).
  • part: all, links, rules, daily or clicks.
  • from, to: YYYY-MM-DD.

GET /v1/export

Scope
links:read
Success
200
Errors
400, 401, 403, 429, 500, 503
Example
curl "https://api.l-k.io/v1/export?format=csv&part=links" \
  -H "Authorization: Bearer lj_live_…" \
  -o links.csv

Service routes

Three routes answer without a key: GET /health returns { "status": "ok" } when the API is up, GET /openapi.json returns the complete OpenAPI 3.1 specification of the API, and GET /docs renders it as a reference page, the one doc_url points to.

GET /v1/health

Scope
None, no key needed
Success
200
Errors
500

GET /v1/openapi.json

Scope
None, no key needed
Success
200
Errors
500

GET /v1/docs

Scope
None, no key needed
Success
200
Errors
500
Example
curl https://api.l-k.io/v1/health

Back to top