Authentication and scopes

All requests use an API key sent in the Authorization header (or X-Api-Key).

curl https://lnk.ec/api/v1/links -H "Authorization: Bearer $LNK_API_KEY"
curl https://lnk.ec/api/v1/links -H "X-Api-Key: $LNK_API_KEY"

Format

Keys look like lk_<product>_<id>_<secret>. For example lk_lnk_... is an lnk key. The server stores only a hash: we cannot recover a lost secret, only rotate it.

Scopes

ScopeAllows
links:readlist and read links, resolve URLs
links:writecreate, edit, pause, resume and delete links
analytics:readread clicks

Always request the minimum scope. When it is missing the response is 403 insufficient_scope with error.details.requiredScope.

Expiry and rotation

  • Every key has an expiry date (90 days by default, 365 at most).
  • Rotating creates a new key and keeps the old one alive for a grace window you choose (1 h to 7 days) so you can switch without downtime. If the key may have leaked, tick Revoke the current key immediately (API: revokeOld: true): there is no grace window and the old key stops working at once.
  • You can revoke a key at any time; it stops working immediately.
  • Optional: restrict a key to specific IP addresses.

Best practices

  • Never put a key in browser code, mobile apps or repositories.
  • Use one key per application and environment, with a descriptive name.
  • Rotate regularly and revoke keys you no longer use.
  • If you suspect a leak, revoke the key and create another.

Authentication errors

Statuserror.codeMeaning
401missing_api_keyheader missing
401invalid_api_keyinvalid format or secret, or a key for another product
401api_key_revoked / api_key_expiredrevoked or expired key
403api_key_suspendedsuspended by the team; contact support
403ip_not_allowedthe IP is not in the allow list
403insufficient_scopethe required permission is missing