This documentation is not accurate and is currently under development.

API Request/Response Formats

Understanding the correct format for API requests and responses is crucial for successful integration with Fewzen AI. This guide provides detailed information on the structure and data types used in our API communications.

Fewzen AI API Request/Response Flow

General Format

Fewzen AI API uses JSON for both request bodies and response payloads. All API requests should include the following headers:

Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

Replace YOUR_API_KEY with your actual Fewzen AI API key.

Request Formats

Chat Request Format

Example request body for initiating a chat:

{
  "agent_id": "string",
  "messages": [
    {
      "role": "user",
      "content": "string"
    }
  ],
  "max_tokens": number,
  "temperature": number
}
  • agent_id: The ID of the AI agent to chat with
  • messages: An array of message objects, each with a role and content
  • max_tokens: (Optional) Maximum number of tokens in the response
  • temperature: (Optional) Controls randomness in responses (0.0 to 1.0)

Response Formats

Success Response Format

Example success response for a chat request:

{
  "id": "string",
  "created": number,
  "agent_id": "string",
  "messages": [
    {
      "role": "assistant",
      "content": "string"
    }
  ]
}
  • id: A unique identifier for this response
  • created: Timestamp of when the response was generated
  • agent_id: The ID of the agent that generated the response
  • messages: An array of message objects, typically containing the AI's response

Data Types

Fewzen AI API uses the following data types in requests and responses:

  • string: A sequence of characters
  • number: An integer or floating-point number
  • boolean: true or false
  • array: An ordered list of values
  • object: A collection of key-value pairs
  • null: Represents a null or empty value

Best Practices

Validate Input
Always validate your input data before sending requests to ensure it matches the expected format and data types.
Handle Errors Gracefully
Implement proper error handling in your application to gracefully handle and log any API errors.
Use Appropriate Content-Type
Always set the Content-Type header to application/json for requests with JSON payloads.
Respect Rate Limits
Be mindful of API rate limits and implement appropriate throttling or queueing mechanisms in your application.

Ready to Start Making API Requests?

Now that you understand the request and response formats for the Fewzen AI API, you're ready to start integrating our powerful AI capabilities into your applications.

Explore API Endpoints