Trimline is in private beta. Public launch: June 2027.Join the waitlist →
Docs / Core concepts

Errors

Status codes, the error object, and how to handle and retry failures safely.

Beta. The Trimline API is available to private beta customers. Endpoints may change before general availability in June 2027, and every breaking change is announced in the changelog. Request access.

Trimline uses conventional HTTP status codes. Codes in the 2xx range mean the request succeeded, 4xx codes mean something about the request needs fixing, and 5xx codes mean something went wrong on our side.

Error object

Every error response has the same shape, so you can handle errors in one place.

{
  "error": {
    "type": "invalid_request_error",
    "code": "parameter_invalid",
    "message": "notice_deadline[lte] must be a date in YYYY-MM-DD format.",
    "param": "notice_deadline[lte]",
    "request_id": "req_Q2m8xVb41Kd",
    "doc_url": "https://trimline.tech/docs/errors/#parameter_invalid"
  }
}
typeenumThe broad category of the error. See the table below.
codestringA stable, machine-readable code. Branch on this, not on message.
messagestringA human-readable explanation. The wording may change, so don’t parse it.
paramstring, nullableThe request parameter the error relates to, if there is one.
request_idstringInclude this whenever you contact support. It’s also returned in the Request-Id header.

HTTP status codes

StatusMeaning
200 OKThe request succeeded.
201 CreatedA new object was created.
400 Bad RequestThe request was malformed or a parameter was invalid.
401 UnauthorizedNo API key was sent, or the key is invalid or revoked.
403 ForbiddenThe key is valid but lacks the required scope.
404 Not FoundThe object doesn’t exist, or belongs to the other environment.
409 ConflictThe object’s state doesn’t allow this action, such as approving a draft that was already sent.
422 UnprocessableThe request was well-formed but couldn’t be carried out, for example because a mailbox connection has expired.
429 Too Many RequestsYou’ve hit a rate limit. Retry after the time given in the Retry-After header.
500, 502, 503Something went wrong on our side. These are rare, and safe to retry with backoff.

Error types

TypeWhen it happens
authentication_errorThe key is missing, malformed, expired or revoked.
permission_errorThe key doesn’t have the scope this endpoint requires.
invalid_request_errorA parameter is missing or invalid, or the object wasn’t found.
state_errorThe object isn’t in a state that allows this action.
connection_errorA connected mailbox or finance account needs to be reauthorized.
rate_limit_errorToo many requests in a short period.
api_errorAn unexpected problem on our side.

Common codes

CodeWhat to do
parameter_missingAdd the parameter named in param.
parameter_invalidCheck the type and format against the endpoint reference.
resource_missingCheck the ID, and check you’re using a key for the right environment.
insufficient_scopeCreate a key with the scope listed in message.
draft_not_pendingThe draft was already approved, sent, held or discarded. Fetch it to see its current status.
notice_deadline_passedThe contract can no longer be cancelled for this term. Negotiation is still possible, but you have less leverage.
connection_expiredAsk the account owner to reconnect the mailbox from the dashboard.
idempotency_key_reusedThe same key was sent with a different request body. Generate a new key.

Retrying safely

Retry 429 and 5xx responses with exponential backoff and jitter, starting at about 500 ms. Don’t retry other 4xx errors without changing the request. For POST requests, always send an idempotency key so that a retry can’t approve the same draft twice.

Something unclear or missing? Email developers@trimline.tech.