What Content-Type header should be used when making requests to the Claude API?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Claude API requests are JSON — so the Content-Type must be application/json. This is standard for REST APIs that exchange JSON payloads.
Full explanation below image
Full Explanation
The Anthropic API expects request bodies in JSON format, so the Content-Type header must be 'application/json'. This is standard for modern REST APIs. The Anthropic Python SDK handles this automatically. For raw HTTP requests (curl, requests library without the SDK), developers must set this header manually. Option A (text/plain) would indicate unstructured text — the API would likely reject or misparse it. Option C (multipart/form-data) is for file uploads through HTML forms. Option D (application/xml) is for XML payloads, which the Anthropic API doesn't use.