Errors and rate limits
Errors#
The HTTP status code tells you whether a request succeeded: 2xx is success, 4xx and 5xx are
failures. Every error response has the same body:
{
"message": "Invalid API key",
"error_code": "api_key_invalid",
"error_uid": "3f9c2a1"
}
message— what went wrong. The text may change, so do not compare it in your code.error_code— the code of the problem. Every error has one. Use it in your code to tell errors apart. A code does not change within v1; a new API version may change or drop it. See Error codes.error_uid— the identifier of this error in Lynked's logs. Quote it when you contact Lynked support.
A 422 Unprocessable Entity also lists the problems per request field in errors:
{
"message": "email: This value is not a valid email address.",
"errors": {
"email": [{ "message": "This value is not a valid email address." }]
},
"error_code": "undefined",
"error_uid": "3f9c2a1"
}
| Status | Meaning |
|---|---|
401 Unauthorized | The API key is missing, invalid or revoked. |
403 Forbidden | The Public API is disabled, or a feature the request needs is turned off (for example customer notes). |
404 Not Found | The resource does not exist. |
409 Conflict | The request conflicts with the current state: a request with the same Idempotency-Key is still running (see Idempotency), the order is no longer in progress, and so on. error_code says which. |
422 Unprocessable Entity | The request is invalid: errors lists the fields and why, or error_code names a value Lynked cannot use (an unknown seller, barcode or reward). |
429 Too Many Requests | The rate limit is exceeded, see below. |
500 Internal Server Error | Something failed on Lynked's side. Retry later; if it persists, contact support with the error_uid. |
Rate limits#
The limit is 120 requests per minute, shared by all API keys.
Over the limit, requests get 429 Too Many Requests. How many seconds to wait before trying again
is in the body as retry_after and in the Retry-After header (the same value):
{
"message": "Too many requests",
"error_code": "rate_limit_exceeded",
"retry_after": 30,
"error_uid": "3f9c2a1"
}
Error codes#
error_code | Status | Meaning |
|---|---|---|
api_key_missing | 401 | The Authorization: Bearer lk_live_… header is missing. |
api_key_invalid | 401 | The API key is unknown or revoked. |
public_api_disabled | 403 | The Public API is disabled. |
idempotency_key_invalid | 422 | Idempotency-Key is not a UUID. |
idempotency_key_reused | 422 | The Idempotency-Key was already used with a different request. |
idempotency_key_in_progress | 409 | A request with the same Idempotency-Key is still running. |
rate_limit_exceeded | 429 | The rate limit is exceeded. |
invalid_cursor | 422 | The cursor of a list request is not one Lynked gave. |
customer_not_found | 404 | No such customer. |
customer_lookup_invalid | 422 | Find a customer with exactly one of email, phone or barcode. |
customer_identity_conflict | 409 | The phone and the email belong to different Lynked accounts. |
customer_notes_disabled | 403 | Customer notes are turned off. |
customer_note_not_found | 404 | No such note about this customer. |
customer_group_not_found | 404 | No such customer group. |
customer_not_deletable | 409 | The customer cannot be deleted; only customers you created through the API can be. |
reward_not_found | 422 | The customer has no such reward at this business. |
seller_not_found | 422 | No such seller. |
barcode_not_found | 422 | No customer or staff member has this barcode. |
order_not_found | 404 | No such order. |
order_not_from_api | 409 | Only orders created through the API can be completed or canceled through it. |
order_not_in_progress | 409 | The order is already completed or canceled. |
staff_not_found | 404 | No such staff member. |
staff_lookup_invalid | 422 | Find a staff member with exactly one of email or barcode. |
staff_barcode_not_found | 422 | The staff member has no such barcode. |
staff_cash_not_allowed | 422 | The business does not allow staff cash. |
insufficient_cash_balance | 422 | The staff member's cash balance is lower than the cash to use. |
webhook_subscription_not_found | 404 | No such webhook subscription. |
webhook_subscription_duplicate | 409 | The URL is already subscribed to one of these event types. |
webhook_subscription_limit_reached | 422 | An event type already has 5 subscriptions. |
internal_server_error | 500 | Something failed on Lynked's side. Retry later; if it persists, contact support with the error_uid. |
undefined | any | The error has no specific code yet (for example a validation error); go by the HTTP status and message. |
New codes are added as the API grows. Treat an unknown code by its HTTP status.