Claude API Postman Collection Setup Guide
If you're searching for a Claude API Postman collection setup guide, you're probably trying to test requests before writing code, or you want a repeatable way to debug prompts, headers, and responses without spinning up a script every time. This guide walks through building that collection from scratch — environment variables, authentication headers, request bodies, and streaming — plus how to adapt it if you're calling Claude through an API gateway like SubToAPI instead of directly.
There's no official pre-built Claude Postman collection to download, which is why most developers end up building a small one themselves. It takes about ten minutes and pays for itself the first time you need to debug a malformed request.
Why Use Postman for Claude API Testing
Postman gives you a visual way to inspect headers, test different system prompts, and save request variants without touching your codebase. It's especially useful for:
- Verifying your API key and headers are correct before integrating into code
- Testing prompt variations quickly (temperature, max tokens, system prompts)
- Debugging streaming responses chunk by chunk
- Sharing a working request with a teammate who isn't deep in the codebase yet
Step 1: Create a New Collection
Open Postman and create a new collection — call it something like "Claude API" or "Claude Testing." Collections let you group related requests and share environment variables across all of them, which matters once you have separate requests for messages, streaming, and tool use.
Step 2: Set Up an Environment
Before adding requests, create a Postman environment with these variables:
| Variable | Example Value | |---|---| | base_url | https://api.anthropic.com/v1 | | api_key | your API key | | api_version | 2023-06-01 |
Using variables instead of hardcoding values means you can switch between providers (direct Anthropic access, a proxy, or a service like SubToAPI) by changing one environment, not every request.
Step 3: Configure Headers
Claude's API expects three headers on every request:
x-api-key: {{api_key}}
anthropic-version: {{api_version}}
content-type: application/json
In Postman, set these at the collection level under the "Headers" tab so every request inherits them automatically. That way you only update the API key once if it rotates.
Step 4: Build the Messages Request
Create a POST request to {{base_url}}/messages with this body:
{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Explain what a Postman collection is in two sentences."
}
]
}
Save this request as "Basic Message." It's your baseline — if this works, your auth and headers are correct, and any issues in later requests are related to the specific payload, not your setup.
Step 5: Add a Streaming Request
Duplicate the basic message request and add "stream": true to the body. Postman doesn't render server-sent events as nicely as a terminal, but you can still see the raw chunked response in the response body panel, which is useful for confirming that streaming is actually enabled and formatted as expected before you write client code.
{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"stream": true,
"messages": [
{ "role": "user", "content": "Write a haiku about debugging." }
]
}
Step 6: Add a Tool Use Request
Tool use requests need a tools array alongside messages. Save a separate request for this since the payload shape is different enough to warrant its own template:
{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"tools": [
{
"name": "get_weather",
"description": "Get current weather for a location",
"input_schema": {
"type": "object",
"properties": {
"location": { "type": "string" }
},
"required": ["location"]
}
}
],
"messages": [
{ "role": "user", "content": "What's the weather in Lisbon?" }
]
}
Run this and check the response for a tool_use content block — that confirms Claude is correctly invoking your schema.
Step 7: Save Example Responses
Once a request works, click "Save Response" → "Save as Example" in Postman. This gives you a reference for what a healthy response looks like, which is invaluable when you're debugging six months later and can't remember the expected shape.
Using Postman Against an API Gateway Instead
If you're accessing Claude through a gateway rather than directly, the collection setup is nearly identical — you just swap the base URL and auth header. For example, if you're using SubToAPI to turn your Claude access into a standard HTTPS API with its own key management and usage tracking, your environment would use:
base_url:https://api.subtoapi.app/v1- Header:
Authorization: Bearer {{subtoapi_key}}
The request bodies for messages, streaming, and tools stay the same shape, since SubToAPI mirrors the Claude Messages API format. This is useful if your team needs per-app keys (sub_live_...) and usage metadata without each developer managing raw provider credentials. See /docs/quickstart for the exact header format and /docs/messages for the full request reference if you want to mirror this setup for your own team's Postman workspace.
Step 8: Export and Share the Collection
Once your requests are working, export the collection (File → Export) as a JSON file and commit it to your repo under something like docs/postman/claude-api.postman_collection.json. Anyone on the team can import it and immediately have working requests, as long as they fill in their own API key in a local environment file that stays out of version control.
Tips for Keeping the Collection Useful
- Never commit real API keys — use Postman environments and
.gitignorethe environment export if it contains secrets - Add a
pre-request scriptto log the request body to the console for quick debugging - Create folders inside the collection for "Messages," "Streaming," and "Tools" so it scales as you add more test cases
FAQ
Is there an official Claude API Postman collection?
No, Anthropic doesn't publish one. Developers typically build a small custom collection, which takes about 10 minutes following the steps above.
What headers does the Claude API require in Postman?
Three: x-api-key, anthropic-version, and content-type: application/json. Setting these at the collection level avoids repeating them on every request.
Can I use the same Postman collection for a gateway like SubToAPI?
Yes — keep the same request bodies and just change the base_url and auth header to match the gateway's format. Check /docs for the exact header syntax.