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.
API keys
Section titled “API keys”- Where it goes: the
X-API-Keyheader 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.
Credits
Section titled “Credits”- 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-Chargedheader, also inmeta.creditsin the body. - What is left: the
X-Credits-Remainingheader, read inside the same transaction that debits the call, so it does not drift when calls run concurrently. The SDK exposes it asmeta.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_creditswith the currentbalanceand apricing_url. An agent that readsX-Credits-Remainingcan see this coming and stop before it does.
Errors
Section titled “Errors”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:
erroris a stable code. Branch on it, never on the text ofhint.hintsays what to do next, in one sentence.docs_urllinks to the page of that code on this site.next_stepis a command that resolves the error, when one exists.request_idis the id of the call (below).- Some codes add fields of their own:
kindto say which of several causes happened,lineandcolumnto point at a position in the document,balance,retry_after_seconds,upstream_status,errorswith 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.
Request id
Section titled “Request id”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.