Skip to main content
Every response from the OpenType API carries an x-request-id header that names that one request. Use it to connect a line in your logs to the request that produced it, and quote it whenever you report a problem: it is the fastest way to find a specific request. This page is for anyone writing a client, a logging wrapper, or a bug report.

How the id is chosen

Allowed characters are ASCII letters, digits, ., _ and -, from 1 to 128 of them. A UUID such as 3f0c1a9b-2e4f-4a8c-8d1e-2f3a4b5c6d7e is valid as it is.

Where the id appears

  • The x-request-id response header, on every response. Success, error, preflight, and refusals made before the body is read (such as an oversized body) all carry it.
  • error.request_id in every JSON error body. It is the same value as the header.
  • Not in plain-text errors. A few framework-level rejections on the keys, usage and billing routes have a text body instead of JSON: malformed JSON, a missing Content-Type, an unknown field. An unknown path gets an empty body. Their body has no request_id, but the x-request-id header is still there. Read it from the header. See Errors.
Browsers can read the header from JavaScript: it is the one response header the API exposes to cross-origin callers.

Send your own id

Sending your own id lets you search your logs and ours with the same string, and ties an OpenType request to the job, ticket or trace that caused it.

Choosing ids

  • Make each attempt unique. An id names one HTTP request. When you retry, send a new request id (for example with an attempt suffix), even when you keep the same Idempotency-Key.
  • Do not confuse it with Idempotency-Key. The request id is for tracing and changes nothing about how a request is processed. The Idempotency-Key on POST /v1/runs decides whether a request is a replay. See Idempotency.
  • Keep secrets out of it. The id is echoed in response headers and error bodies. Never put a key, a token, or personal data in one.

Quote it when you report a problem

1

Log it on every failure

Log the x-request-id header next to the status and error.code. Log it from the failing attempt, not from a later retry: each attempt has its own id.
2

Collect the context

Note the route, the time in UTC, the status, the code, and for runs the run_id if you have one.
3

Quote the id

Include the request id in your report. One id identifies one request, which is what makes it findable.

What goes wrong