LemuAIDocs

Getting Started · 5 min read

Errors

The error shape, HTTP status codes and common error codes returned by the LemuTickets API

Open in ChatGPTOpen in ClaudeMarkdown

Error format#

Every error from the LemuTickets API has the same shape:

JSON
{
  "error": {
    "type": "validation_error",
    "code": "invalid_fields",
    "message": "Some fields are invalid",
    "field_errors": {
      "title": "Field required",
      "requester.email": "Input should be a valid string"
    },
    "request_id": "4f1d9c2b7a6e4e0f8c3b1a2d5e6f7a8b"
  }
}
FieldDescription
typeThe kind of error. One type per HTTP status (see the table below).
codeA stable, specific reason, for example version_mismatch or duplicate_external_id. Use this in your code.
messageA plain-language description for people. It can change; do not match on it.
field_errorsOnly when specific fields are wrong: an object from field name to problem. Nested fields use dots, for example custom_fields.order_id.
dataOnly on some errors: extra details, such as current_version on a version conflict or retry_after on a rate limit.
request_idThe id of this request, also in the X-Request-Id header. Include it when you contact support.

The OAuth token endpoint is the one exception: it returns errors in the standard OAuth format.

Status codes#

StatustypeMeaning
401unauthorizedNo credentials, or the key or token is wrong, revoked or expired
403forbiddenThe credentials are valid but not allowed to do this
404not_foundThe id or key does not exist, or you are not allowed to see it
409conflictThe request clashes with something that already exists
412precondition_failedThe ticket changed since you read it (If-Match)
422validation_errorThe body or a parameter is invalid
429rate_limitedToo many requests; see rate limits
500Something went wrong on our side

A ticket in a project you cannot access returns 404, not 403, so the API never confirms that it exists.

Common error codes#

StatuscodeWhen
401unauthenticatedNo API key or token was sent
401invalid_api_keyThe API key is wrong, revoked or expired
401invalid_tokenThe OAuth access token is wrong, revoked or expired
403missing_capabilityThe key or token lacks a scope. data.missing lists the scopes needed
403ip_not_allowedThe request came from an IP address that is not allowed
403transition_forbiddenThe workflow only lets certain roles, or the assignee, make this transition
403transition_conditionThe ticket does not meet the transition's conditions
404ticket_not_foundNo ticket with this key or id that you can see
404project_not_foundNo project with this key or id
404attachment_not_foundNo attachment with this id that you can see
404webhook_not_foundNo webhook with this id
409duplicate_external_idA ticket with this external_id already exists. data has its ticket_id and key
409idempotency_mismatchAn Idempotency-Key was reused with a different body
412version_mismatchThe ticket's version is not the one in If-Match. data.current_version has the current one
422invalid_fieldsThe body or a query parameter failed validation. See field_errors
422missing_titleThe ticket title is empty
422project_archivedThe project is archived and takes no new tickets
422invalid_typeThe ticket type does not exist in this project
422invalid_statusThe status does not exist in this ticket's workflow
422invalid_priorityPriority is not p1, p2, p3 or p4
422invalid_sourcesource is not one of the allowed values
422invalid_assigneeThe assignee is not an active member of your organization
422invalid_teamThe team does not exist
422invalid_requesterThe requester does not exist
422invalid_custom_fieldsOne or more custom field values are wrong. See field_errors
422invalid_if_matchIf-Match is not a version number
422invalid_transitionThe ticket cannot move to that status from its current status
422transition_validationThe transition needs fields or a comment you did not send. See field_errors
422missing_targetA transition request had neither to_status nor transition_id
422empty_commentThe comment body is empty
422invalid_linkA ticket cannot link to itself
422invalid_minutesLogged minutes are not between 1 and 1440
422missing_userThe caller is not a user (for example a client credentials token), so user_id is required
422file_too_largeThe file is over 25 MB
422blocked_file_typeThe file is an executable or script type that is not allowed
422invalid_eventsA webhook event name or pattern matches no event
422invalid_urlA webhook URL is not http:// or https://
422private_addressA webhook URL points at a private or local address
422tql_syntaxThe TQL query could not be parsed. data.position points at the problem
422tql_fieldThe TQL query uses a field that does not exist
429rate_limitedToo many requests. The Retry-After header and data.retry_after say how many seconds to wait

New codes can be added over time. Handle unknown codes by falling back to the HTTP status.

Handling errors#

  • Retry 429 after the number of seconds in Retry-After.
  • Retry 500 and other 5xx responses with exponential backoff. They are usually temporary. A 5xx can come back without the JSON body above, so check the status before parsing. Use an idempotency key on creates so a retry never makes a duplicate.
  • On 412, get the ticket again, check that your change still applies, and retry with the new version.
  • On 409 duplicate_external_id, the ticket already exists: use the key in data instead of creating another.
  • Do not retry other 4xx responses without changing the request. Read code and field_errors to see what to fix.