> ## Documentation Index
> Fetch the complete documentation index at: https://docs.asteragents.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Call API Tool

> Make HTTP requests to any API endpoint and process the response

## What it does

The Call API tool lets your agents make HTTP requests to any API endpoint. Perfect for integrating with third-party services, fetching data from APIs, or sending data to external systems.

## Key features

* Support for all HTTP methods (GET, POST, PUT, PATCH, DELETE, etc.)
* Send custom headers (Authorization, Content-Type, etc.)
* Send request bodies and query parameters
* Automatic JSON response parsing
* Built-in error handling for failed requests

## Parameters

| Parameter      | Type   | Required | Description                                                  |
| -------------- | ------ | -------- | ------------------------------------------------------------ |
| `endpoint_url` | string | Yes      | The URL of the API endpoint to call                          |
| `request_type` | string | Yes      | HTTP method (GET, POST, PUT, PATCH, DELETE)                  |
| `headers`      | object | No       | HTTP headers to include (e.g. Authorization, Content-Type)   |
| `body`         | object | No       | Request body for POST/PUT/PATCH, or query parameters for GET |

## Common use cases

### Fetch data from a REST API

```
endpoint_url: "https://api.example.com/users"
request_type: "GET"
headers: {
  "Authorization": "Bearer your-token"
}
```

Get data from external APIs for analysis or processing.

### Send data to an API

```
endpoint_url: "https://api.example.com/users"
request_type: "POST"
headers: {
  "Authorization": "Bearer your-token",
  "Content-Type": "application/json"
}
body: {
  "name": "John Doe",
  "email": "john@example.com"
}
```

Create or update records in external systems.

### Update existing data

```
endpoint_url: "https://api.example.com/users/123"
request_type: "PUT"
headers: {
  "Authorization": "Bearer your-token",
  "Content-Type": "application/json"
}
body: {
  "status": "active"
}
```

Modify existing records through API calls.

### Delete resources

```
endpoint_url: "https://api.example.com/users/123"
request_type: "DELETE"
headers: {
  "Authorization": "Bearer your-token"
}
```

Remove data from external systems.

## Security best practices

* Store API keys and tokens securely, not in plain text
* Use HTTPS endpoints whenever possible
* Validate API responses before processing
* Implement proper error handling for failed requests
* Be mindful of rate limits on external APIs

## Troubleshooting

**"Connection failed" or "Timeout"**

* Check that the API endpoint URL is correct and accessible
* Verify network connectivity
* Confirm the API service is running

**"Authentication failed" or "401 Unauthorized"**

* Verify your API key or token is correct
* Check that authentication headers are properly formatted
* Ensure your API credentials haven't expired

**"Invalid request" or "400 Bad Request"**

* Validate your request parameters and body format
* Check the API documentation for required fields
* Ensure Content-Type headers match your data format

**"Rate limit exceeded" or "429 Too Many Requests"**

* Reduce the frequency of API calls
* Implement delays between requests
* Check the API's rate limiting documentation

## Related tools

* [Scrape URL](/tools/scrape_url) - Extract content from web pages
* [Send Email](/tools/send_email) - Send emails through SMTP
