Authorization header. API keys give programmatic access to all data in your workspace, so keep them secret: never commit them or ship them in client-side code.
Create an API key
- In Ditto, open Developers. If the page offers to Enable Developer Integrations, enable them first. Plans that do not include developer integrations can start a trial from this page.
- Under API keys, click + Create API key.
- Give the key a name and click Create.
- Copy the key now. It is not shown again after you close the dialog.
Authenticate a request
Pass the key in theAuthorization header with the token scheme:
The CLI, the MCP server, and agents
API keys are for calling the REST API directly and for CI. The developer-facing tools log in with your Ditto account instead, so no key is needed on a developer’s machine:- The CLI logs in through your browser with
npx @dittowords/cli login. Only a CI job without a browser needs an API key, set asDITTO_TOKEN. See Install and log in. - The MCP server logs you in with OAuth the first time a client connects. It accepts
Authorization: token <your-api-key>for CI and headless clients. See Connect the Ditto MCP. - The Ditto Specs CLI has no login flow yet and reads
DITTO_TOKEN. See Specs CLI setup.