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
| Scope | Allows |
|---|---|
links:read | list and read links, resolve URLs |
links:write | create, edit, pause, resume and delete links |
analytics:read | read 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
| Status | error.code | Meaning |
|---|---|---|
| 401 | missing_api_key | header missing |
| 401 | invalid_api_key | invalid format or secret, or a key for another product |
| 401 | api_key_revoked / api_key_expired | revoked or expired key |
| 403 | api_key_suspended | suspended by the team; contact support |
| 403 | ip_not_allowed | the IP is not in the allow list |
| 403 | insufficient_scope | the required permission is missing |