Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

Claude API Quickstart: Create a Key and Send Your First Request

Create a Claude API key, store it safely, configure a Messages API request in Postman, understand the response, and avoid common authentication, JSON, and billing mistakes.

Table of Contents

The Claude API lets an application send messages to Anthropic models and use the returned content inside a product, workflow, or internal tool. This guide uses Postman to show the underlying HTTP request before you move to an official software development kit.

Model IDs, prices, account screens, and rate limits change. Use Anthropic's current quickstart and Messages API reference as the source of truth.

 

What you need

  • An Anthropic Console account with API access
  • An API key created for a specific project or workspace
  • Available billing credit or an approved organization billing method
  • Postman, curl, or another HTTP client
  • Basic familiarity with JSON

Claude subscriptions and Claude API billing are separate products. Having access to the Claude chat application does not necessarily include API usage.

1. Configure billing

Open the Anthropic Console billing area and review the available funding or invoicing options for your account. Do not rely on an old minimum-purchase amount; the current Console shows the applicable terms.

Opening billing settings in the Anthropic Console

Entering billing information for Anthropic API usage

 

After setup, confirm that the Console displays the expected balance or billing status.

Anthropic Console API billing status

2. Create an API key

Open API Keys in the Console.

API Keys section in the Anthropic Console

Select Create Key.

Create API key control in the Anthropic Console

Give the key a name that identifies its environment and purpose, such as postman-development. Assign it to the narrowest suitable workspace.

Naming an Anthropic API key

Copy the secret once and store it in a password manager or secrets manager. Do not put it in source code, screenshots, chat messages, browser-side JavaScript, mobile apps, public repositories, or shared documentation.

Copying a newly created Anthropic API key

If a key is exposed, disable or delete it and create a replacement. Rotating the secret is safer than trying to determine whether it was used.

Managing existing Anthropic API keys

3. Create a Postman request

The Messages API endpoint is:

https://api.anthropic.com/v1/messages

Check the current reference before using the endpoint in production.

Messages API endpoint in Anthropic documentation

Create a new request in Postman.

Starting an API request in Postman

New request control in Postman

Select HTTP.

Selecting an HTTP request in Postman

Paste the endpoint into the request URL field.

Messages API URL entered in Postman

4. Add the required headers

A direct HTTP request normally includes:

x-api-key: {{ANTHROPIC_API_KEY}}
anthropic-version: 2023-06-01
content-type: application/json

Use the API version required by the current documentation. Do not invent a newer date.

Required headers in the Claude Messages API documentation

Open Postman's Headers tab.

Headers tab in Postman

Add the three headers.

Adding Claude API request headers in Postman

Store the secret in a Postman environment variable rather than pasting it into a collection that may be exported or synchronized.

Claude API headers configured in Postman

5. Change the method to POST

The Messages endpoint accepts a POST request.

POST method shown in the Messages API reference

Change Postman's method selector from GET to POST.

Selecting POST in Postman

6. Understand an empty-body error

If you send the request before adding JSON, the API should reject it because required fields are missing.

Sending an incomplete Claude API request

Error response for an incomplete Messages API request

Read the HTTP status and structured error message. A 400 usually points to invalid or missing request data; 401 indicates an authentication problem; 429 indicates a rate or usage limit. Use the returned error details rather than guessing.

7. Add the JSON body

The current reference provides examples for curl and SDKs.

Claude Messages API request example

A minimal Postman body has this shape:

{
  "model": "CURRENT_MODEL_ID",
  "max_tokens": 256,
  "messages": [
    {
      "role": "user",
      "content": "Explain what an API is in two sentences."
    }
  ]
}

Replace CURRENT_MODEL_ID with a model ID copied from the current Anthropic documentation or Console. Model display names and API identifiers are not always interchangeable.

Copying the JSON request body from Anthropic documentation

In Postman, open Body, select raw, choose JSON if the selector is available, and paste the object.

JSON request body entered in Postman

8. Send the request and read the response

Select Send.

Sending a complete Claude API request

A successful response returns an HTTP 200 status and a JSON message object. Text appears inside content blocks rather than as an unstructured page.

Successful Claude API response in Postman

Each successful call consumes billable input and output tokens according to the selected model's current price. Set usage alerts and limits before testing loops or production traffic.

9. Change the user message

Edit only the content value and send again.

Changing the user message in a Claude API request

The response content should reflect the new request.

Claude API response to an updated user message

10. Add system instructions

The optional top-level system field describes persistent behavior for that request. It is not placed as a message with a system role in the Messages API.

System parameter in the Claude Messages API reference

{
  "model": "CURRENT_MODEL_ID",
  "max_tokens": 256,
  "system": "Answer in concise plain language. If a required fact is missing, say so.",
  "messages": [
    {
      "role": "user",
      "content": "Explain what an API is in two sentences."
    }
  ]
}

Adding system instructions to a Postman request

Send the request again.

Sending a request with Claude system instructions

Compare the output, but test across many representative inputs before concluding that an instruction is reliable.

Claude response after system instructions were added

11. Treat sampling controls as test parameters

The reference may expose parameters such as temperature. Their permitted range and interaction with other settings can change, so follow the current API reference.

Temperature parameter in the Claude API reference

Temperature setting in a Postman Claude request

Higher randomness is not the same as higher quality. For extraction, classification, or policy-driven responses, consistency is usually more important. Evaluate several outputs with a fixed test set.

Move from Postman to production

  • Use an official Anthropic SDK where practical.
  • Keep the API key on a trusted server, never in client-side code.
  • Set timeouts, retry only transient failures, and use exponential backoff.
  • Validate user input and model output.
  • Log request identifiers and errors without logging secrets or unnecessary personal data.
  • Enforce per-user limits and monitor cost.
  • Use version control for prompts and evaluation cases.
  • Define a fallback when the API is unavailable or uncertain.

Common problems

  • 401: check that the key is active, correctly loaded, and sent in x-api-key.
  • 400: validate JSON, required fields, model ID, and parameter types.
  • 404: check the endpoint and model availability for the account.
  • 429: slow the request rate and inspect account or workspace limits.
  • Unexpected output: reduce ambiguity, add examples, and evaluate the prompt against representative cases.

Once the basic request works, save it as a development example, replace the secret with an environment variable, and build tests before connecting it to real customer or business data.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.