# How to Configure an HTTP API Request Body in ZazzyAgent

Some APIs need information sent inside the request itself.

This information is called the **request body**.

For example, when sending a new lead to a CRM, the API may expect:

```json
{
  "name": "Rahul",
  "email": "rahul@example.com",
  "phone": "+919999999999"
}
```

ZazzyAgent can use information collected during a conversation as part of an API request.

## When is a request body needed?

A request body is commonly used with APIs that create or update information.

Examples:

*   Create a lead
    
*   Submit a booking
    
*   Create a support ticket
    
*   Update customer information
    
*   Send an enquiry
    
*   Create an order-related record
    

A GET request will often rely on URL parameters instead, while POST and PUT requests commonly use request body data. The external API documentation determines the exact requirement.

## Request body vs parameters

These are different.

### URL or query parameter

```text
/orders?order_id=12345
```

### Request body

```json
{
  "order_id": "12345"
}
```

The API documentation tells you which format it expects.

Sending the correct value in the wrong location can result in an error.

## Prepare the data before the API call

A good flow usually collects and saves the required information first.

For example:

```text
Customer
   ↓
User Input
   ↓
Name
Email
Phone
Requirement
   ↓
HTTP API
   ↓
CRM
```

This allows the same API configuration to work for different customers.

## Create the API integration

Open the HTTP API integration area in ZazzyAgent.

Create a new integration or open an existing one.

Choose the HTTP method required by the external API.

Enter the endpoint.

Then configure the request data or body according to the API's specification.

## Static vs dynamic values

Request-body fields can contain information that stays the same or information that changes for every customer.

### Static value

Example:

```json
{
  "source": "ZazzyAgent"
}
```

Every API request sends the same value.

### Dynamic value

Example:

```json
{
  "name": "#LEAD_USER_FIRST_NAME#"
}
```

The value comes from customer data available to the automation.

Dynamic values are what make one API configuration usable across many conversations.

## Example: Lead submission

Suppose your automation collects:

```text
Name
Email
Phone
Requirement
```

The receiving CRM expects:

```json
{
  "name": "Rahul",
  "email": "rahul@example.com",
  "phone": "+919999999999",
  "requirement": "Website redesign"
}
```

The flow can collect those values and send them through the API.

The important part is that the names and structure match what the external API expects.

## Match the API's field names

Suppose the API requires:

```json
{
  "first_name": "Rahul"
}
```

Do not assume this is equivalent to:

```json
{
  "name": "Rahul"
}
```

The external system may expect one specific field name.

Always check the API documentation.

## Nested JSON data

Some APIs require nested objects.

For example:

```json
{
  "customer": {
    "name": "Rahul",
    "email": "rahul@example.com"
  }
}
```

Others may require:

```json
{
  "customer_name": "Rahul",
  "customer_email": "rahul@example.com"
}
```

These structures are not interchangeable.

Understand the expected JSON structure before configuring the integration.

## Sending numbers and text

The API may distinguish between:

```json
{
  "quantity": 5
}
```

and:

```json
{
  "quantity": "5"
}
```

One is a number.

The other is text.

Follow the data type required by the API.

The same principle applies to:

*   Boolean values
    
*   Dates
    
*   Arrays
    
*   Objects
    
*   Numbers
    
*   Text
    

## Example: Booking request

Imagine your flow collects:

```text
Customer Name
Service
Date
Time
```

The booking API may require:

```json
{
  "customer_name": "Rahul",
  "service": "Dental Cleaning",
  "date": "2026-09-25",
  "time": "15:00"
}
```

The automation becomes:

```text
Collect booking details
        ↓
Save customer input
        ↓
HTTP API
        ↓
Booking system
        ↓
Confirmation
```

## Validate data before calling the API

Don't send incomplete information when the API requires mandatory fields.

For example:

```text
Customer provides phone
        ↓
Email missing?
     ↙       ↘
   Yes        No
   ↓           ↓
Ask email    Call API
```

Using conditions before the API call can prevent unnecessary failed requests.

See [How to Use Conditions in ZazzyAgent Flow Builder](https://blog.zazzyagent.com/how-to-use-conditions-zazzyagent-flow-builder) for conditional routing.

## Handle special characters carefully

Customer input can contain:

*   Apostrophes
    
*   Quotes
    
*   Line breaks
    
*   Emojis
    
*   Symbols
    
*   Multiple languages
    

Your API integration should send data in the format expected by the receiving system.

Always test with realistic customer input rather than only simple words.

## Don't expose internal request data

The customer does not need to see the technical request.

Avoid sending something like:

```json
{
  "customer_id": "12345",
  "internal_source": "zazzyagent",
  "api_key": "..."
}
```

in a customer-facing reply.

The API request and the customer message are separate parts of the automation.

## How to troubleshoot request-body errors

### 400 Bad Request

Check:

*   Field names
    
*   Required fields
    
*   JSON structure
    
*   Data types
    
*   Missing values
    

### 401 or 403

Check authentication and headers.

### 404

Check the endpoint URL.

### API accepts request but does the wrong thing

Compare the body with the external API's required schema.

A field mapped to the wrong property can produce unexpected results even when the request technically succeeds.

## Test with real values

Don't test only:

```text
Name = Test
Phone = 123
Email = test@test.com
```

Also test:

```text
Name = Rahul O'Brien
```

and realistic phone numbers, long requirements, optional fields, and missing information.

The goal is to verify that your automation works with actual customer data.

## A practical request architecture

```text
Customer
   ↓
User Input
   ↓
Save Data
   ↓
Validate Data
   ↓
HTTP API
   ↓
Request Body
   ↓
External System
   ↓
API Response
   ↓
Next Flow Step
```

This pattern works for CRM submissions, booking requests, ticket creation, lead capture, and many other integrations.

For the broader setup, see [HTTP API in ZazzyAgent: Complete Guide to External API Automation](https://blog.zazzyagent.com/http-api-zazzyagent-guide).

For response handling, see [How to Use API Response Data in ZazzyAgent](https://blog.zazzyagent.com/how-to-use-api-response-data-zazzyagent).

## Best practice

Treat the request body as a contract between ZazzyAgent and the external application.

Before publishing the automation, verify:

```text
Field name
Field value
Data type
JSON structure
Required fields
```

A correctly configured request body is what allows your flow to pass useful customer information into another system.
