Skip to content

Concepts

Six operations, one contract. Whatever you call, the key goes in the same header, the cost comes back in the same headers, an error has the same shape and every response carries an id you can quote.

  • Where it goes: the X-API-Key header of every request to /v1/md/* and /v1/url-to-md.
  • Where it comes from: the dashboard. Keys start with mdsk_. An account can have several keys; all of them spend the same balance.
  • Revoking: done in the dashboard. A revoked, unknown or malformed key returns unauthorized, always with the same body, so the response never tells whether a key exists.
  • Where to keep it: server side. In a terminal, the environment variable MDSCRIBE_API_KEY; in a hosted app, a secret of your platform, read by a backend function. A key in a published client is a key anyone can use.
  • One balance per account. Every successful call debits it. The price of each operation is published in the OpenAPI document (x-credits) and on each operation page; the pricing page lists them side by side.
  • What this call cost: the X-Credits-Charged header, also in meta.credits in the body.
  • What is left: the X-Credits-Remaining header, read inside the same transaction that debits the call, so it does not drift when calls run concurrently. The SDK exposes it as meta.creditsRemaining.
  • Errors are not charged. An error response carries no X-Credits-Remaining: its absence means nothing was debited, not that the balance is unknown.
  • When it runs out: calls return insufficient_credits with the current balance and a pricing_url. An agent that reads X-Credits-Remaining can see this coming and stop before it does.

Every error response has the same shape. The fields, what they mean and the full list of codes are on the error codes page; the short version:

  • error is a stable code. Branch on it, never on the text of hint.
  • hint says what to do next, in one sentence.
  • docs_url links to the page of that code on this site.
  • next_step is a command that resolves the error, when one exists.
  • request_id is the id of the call (below).
  • Some codes add fields of their own: kind to say which of several causes happened, line and column to point at a position in the document, balance, retry_after_seconds, upstream_status, errors with one entry per failed diagram.

The HTTP status says how serious it is: 4xx means the request or the account has to change; 5xx means something failed on our side, and the response then also carries a report_url.

Every response, success or error, carries an id in the X-Request-Id header and in meta.request_id (or request_id in an error body). It is how we find your call in our logs. Quote it when you write to support@markdownscribe.com or open an issue: it tells us exactly which call you mean, without you having to send the document.