← All updates

A rejected API key now says so, instead of asking for payment

A request carrying an API key we no longer accept now returns 401 with code invalid-api-key. It used to come back as a payment challenge, which told people with a stale or mistyped key that their document needed paying for.

apiauth

An API key we don't recognise — revoked, deleted, expired, mistyped, or issued for a different environment — now gets a 401 with error: "Invalid API key" and code: "invalid-api-key". Before, it came back as a 402 payment challenge on /api/v1/md, /api/v1/markdown, /api/v1/render and /api/v1/enhance, or as a generic 401 Authentication required on /api/v1/canvas — neither said the key was the problem, and a plugin could report it to you as a payment problem.

The response is meant to be enough to recover from: message says the header carried a token the server doesn't recognise, and the body includes a device_authorization block with the device-flow URLs a client uses to sign in again (the same flow makespdf login runs). You can also create a new key in Settings, API Keys and keep using it the same way. This applies to /api/v1/md, /api/v1/markdown, /api/v1/render, /api/v1/enhance and /api/v1/canvas.

Two things are unchanged. A request with no Authorization header behaves exactly as before, including the anonymous markdown and canvas rendering when it is switched on. And a wallet caller sending a PAYMENT-SIGNATURE header still takes the payment path on the endpoints that accept one — a stale key alongside a signature does not block a payment.