Skip to content
Docs

Creating an Anthropic API key

This guide is part of the Publicus connection catalog. Once you have the credentials, connect the service and Publicus stores them for you.

Distilled from Anthropic’s own documentation: Authentication and API overview. Retrieved 2026-07-03.

An API key is a long-lived secret you generate in the Claude Console and pass on every request. It grants the same access as the workspace it belongs to. Best for local development, prototyping, scripts, and single-tenant servers where you control secret storage.

  1. Sign in to the Claude Console.
  2. Go to Settings → API keys (platform.claude.com/settings/keys).
  3. (Optional) Use workspaces to scope the key by project or environment and to control spend. A key is bound to one workspace.
  4. Create the key, give it a name, and copy the generated secret (it starts with sk-ant-api03-). The full secret is shown only once — store it in a secrets manager.

Using the key:

  • Send it in the x-api-key request header.
  • Every request must also send anthropic-version (for example, 2023-06-01), and requests with a body must send content-type: application/json. See API versions.

Example (Authentication):

Terminal window
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-4-8",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello, Claude"}]
}'

Operational notes:

  • API keys have no expiry. Rotate them periodically and revoke any key you suspect has leaked (Settings → API keys in the Console).
  • To verify a key without spending inference tokens, call GET https://api.anthropic.com/v1/models with the same two headers — it lists the models the key can use and returns no billable output.
  • The official client SDKs read ANTHROPIC_API_KEY from the environment and add the x-api-key, anthropic-version, and content-type headers for you.

Open Connections under Credentials, choose Anthropic, and pick Anthropic API key. Publicus asks for exactly the fields listed above and keeps them in your workspace’s secret storage.

See also: Anthropic in the catalog.

This guide is maintained by Publicus and published under CC BY 4.0.