Build API Docs with Apidog
  1. Example: Anthropic
Build API Docs with Apidog
  • Overview
  • REST API Documentations
    • Basics
      • API-Design First Approach
      • Specify an endpoint
      • Components
      • Common parameters
      • Global parameters
      • Schemas
        • Overview
        • Create a new schema
        • Build a schema
        • Generate Schemas from JSON etc.
    • Advanced features
      • Custom endpoint fields
      • Endpoint status
      • Appearance of parameter lists
      • Endpoint unique idenfication
    • Example: Pet Store
      • Get user info
      • Find pet by ID
      • Add a new pet to the store
      • Update an existing pet
      • Deletes a pet
      • Finds Pets by status
  • SOAP API Documentations
    • How to Use Apidog to Write SOAP API Documentation
    • Example: WebService
      • WebService: Number To Words
      • SOAP: Add integers
      • SOAP/WSDL: Ebay
    • Example: Mastercard
      • Purchase Request
      • Submit a purchase request
  • GraphQL Documentation
    • How to Write GraphQL API Documentation Using Apidog
    • Example: Github
      • Introduction to GraphQL
      • Queries
      • Public schema
  • WebSocket Documentations
    • How to Use Apidog to Write WebSocket API Documentation
    • Example: Coinbase
      • Overview
      • Channel
  • SSE API Documentations
    • Example: Anthropic
      • Streaming Messages
      • Messages
        POST
  • gRPC API Documentations
    • How to Use Apidog for gRPC API Documentation and Testing
    • Example: Proto Documentation
      • Protocol Documentation
  1. Example: Anthropic

Messages

POST
/v1/messages
Send a structured list of input messages with text and/or image content, and the model will generate the next message in the conversation.
The Messages API can be used for either single queries or stateless multi-turn conversations.

Request

Header Params

Body Params application/json

Examples

Responses

🟢200Success
application/json
Body

🟠400Bad Request
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/v1/messages' \
--header 'anthropic-beta;' \
--header 'anthropic-version: 2023-06-01' \
--header 'x-api-key: $ANTHROPIC_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "claude-3-7-sonnet-20250219",
    "max_tokens": 1024,
    "messages": [
        {
            "role": "user",
            "content": "Hello, world"
        }
    ]
}'
Response Response Example
200 - Example 1
{
    "content": [
        {
            "text": "Hi! My name is Claude.",
            "type": "text"
        }
    ],
    "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
    "model": "claude-3-7-sonnet-20250219",
    "role": "assistant",
    "stop_reason": "end_turn",
    "stop_sequence": null,
    "type": "message",
    "usage": {
        "input_tokens": 2095,
        "output_tokens": 503
    }
}
Modified at 2025-03-25 05:47:01
Previous
Streaming Messages
Next
How to Use Apidog for gRPC API Documentation and Testing
Built with