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

# HTTP

> Connect to any API or webhook using the HTTP integration for custom integrations in your workflows.

## How to set up HTTP

### Authentication

The HTTP integration supports flexible header-based authentication:

1. Add the HTTP integration in Cargo
2. Configure headers for authentication:
   * **Public headers**: Visible values (Content-Type, etc.)
   * **Secret headers**: Encrypted values (API keys, tokens)

**Common authentication patterns:**

**API Key:**

```
Key: Authorization
Value: Bearer your-api-key
Type: Secret
```

**Basic Auth:**

```
Key: Authorization
Value: Basic base64(username:password)
Type: Secret
```

**Custom headers:**

```
Key: X-API-Key
Value: your-api-key
Type: Secret
```

## HTTP actions

### Call

Make HTTP requests to any API endpoint.

**Required fields:**

* **URL**: The endpoint URL (supports template expressions)
* **Method**: POST, PUT, PATCH, GET, or DELETE
* **Body format**: Form, JSON, or Text

**Optional fields:**

* **Headers**: Additional request headers (merged with connector headers)

**Body formats:**

**Form:**
Map attributes to values for form-encoded requests.

**JSON:**
Raw JSON body with template expression support.

**Text:**
Plain text body with template expression support.

**Use cases:**

* Send data to third-party APIs
* Trigger webhooks
* Integrate with any REST API
* Custom CRM integrations

### Browse

Fetch and render web page content.

**Required fields:**

* **URL**: The web page URL

**Use case:** Extract content from web pages for analysis or processing.

## HTTP data models

### Listen webhook

Receive incoming webhook data from external systems.

**Configuration:** No additional configuration required.

When configured, Cargo provides a unique webhook URL. External systems can POST data to this URL to trigger workflows.

**Use cases:**

* Receive form submissions
* Process payment notifications
* Handle CRM webhooks
* Integrate with Zapier/Make

### Fetch URL

Periodically fetch data from a URL endpoint.

**Required fields:**

* **URL**: The API endpoint that returns JSON

**Optional fields:**

* **Path**: JSON path to the results array (e.g., "results", "data.items")
* **Deduplication key**: Unique field for deduplication (default: "id")
* **Headers**: Additional request headers

**Requirements:**

* Endpoint must return JSON
* Response should be an array or contain an array at the specified path
* Results should be in reverse chronological order

**Use cases:**

* Sync data from external APIs
* Monitor RSS-like feeds
* Pull data from custom systems

## Example: Posting to a Slack-like webhook

```
URL: https://hooks.example.com/services/xxx/yyy/zzz
Method: POST
Body format: JSON
Body:
{
  "text": "New lead: {{first_name}} {{last_name}} from {{company}}",
  "channel": "#sales-alerts"
}
```

## Example: Calling a REST API

```
URL: https://api.example.com/v1/contacts
Method: POST
Headers:
  Content-Type: application/json
Body format: JSON
Body:
{
  "email": "{{email}}",
  "firstName": "{{first_name}}",
  "lastName": "{{last_name}}",
  "company": "{{company_name}}"
}
```

## Best practices

* Store sensitive credentials (API keys, tokens) as Secret headers
* Use template expressions to dynamically build URLs and bodies
* Set appropriate Content-Type headers for your request format
* Handle pagination when fetching large datasets
* Use the deduplication key to prevent duplicate processing
* Test endpoints with sample data before full deployment
