# HTTP POST

The **HTTP POST** tool enables authenticated AI agents to invoke mutating HTTP requests (`POST`, `PUT`, `PATCH`, `DELETE`) against external public REST APIs — sending request bodies and allowed custom headers while inspecting exact status codes, headers, and response payloads.

Tool Identifier: `http-post` (exposes function `http_post`)

> Only need read-only raw HTML/JS/JSON retrieval? See **[HTTP GET](http-get.md)** (`http-get`). Need clean rendered article prose? See **[HTTP Text](fetch.md)** (`http-text`).

## Capabilities

When paired with **[HTTP GET](http-get.md)** for discovering endpoints and schemas, **HTTP POST** lets agents perform full REST API interactions:

- **Mutating REST Calls**: Issue `POST` (default), `PUT`, `PATCH`, or `DELETE` requests to external public HTTP/HTTPS APIs.
- **Payloads & Headers**: Send UTF-8 request bodies (defaulting `Content-Type` to `application/json` when non-empty body text is supplied without an explicit type) alongside custom headers such as `Accept` or `Idempotency-Key`.
- **Bounded Response Inspection**: Supports the same `offset`/`max_length` pagination and bounded `search`/`context_chars` filtering as `http_get`, returning `3xx`, `4xx`, and `5xx` responses cleanly for agent reasoning.

## Parameters

Agents call `http_post` with structured arguments:

- `url` (required): Public `http://` or `https://` URL to target.
- `method` (optional, default `POST`): Mutating HTTP method (`POST`, `PUT`, `PATCH`, or `DELETE`).
- `body` (optional): UTF-8 request payload string (e.g., serialized JSON or form data; max 1 MiB).
- `content_type` (optional): Request `Content-Type` header (defaults to `application/json` when `body` is non-empty and not otherwise set in `headers`).
- `headers` (optional): JSON object mapping header names to string values.
- `offset` / `max_length` (optional): Character offset and maximum slice length for response pagination.
- `search` / `context_chars` (optional): Case-insensitive pattern filter and surrounding character context for large responses.

## How to Enable

### In the UI

When configuring an agent in the [Agent Builder](/agents/new) or editing an existing agent, check the box for:
☑️ **HTTP POST 📤**

### In Agent YAML

Add `http-post` to the `tools` array:

```yaml
tools:
  - http-post
```

## Example Prompts & Use Cases

- **Discover & Submit to a REST API**: Enable `http-get` and `http-post` and prompt: _"Inspect https://example.com/ with `http_get` to find the confirmation API endpoint in its JavaScript bundle, then call `http_post` to submit code `ZURICH`."_
- **Update a Public Webhook or Resource**: _"Send a `PUT` request with JSON payload `{...}` to https://api.example.com/v1/items/42 and confirm whether it returns HTTP 200."_

## Access & Behavior

- **Authenticated Users Only**: `http-post` is only available to signed-in users and API-key authenticated callers. It is not available to anonymous chat or widget visitors.
- **No Automatic Redirects**: Unlike `http_get`, `http_post` does not follow HTTP redirects automatically (`3xx` responses and their `location` header are returned directly to the agent).
- **Locked Identity**: Outbound requests send the standard AIsh.li [User-Agent](../user-agent.md) header, which callers cannot override via `headers`.

## Related Tools

- 📡 **[HTTP GET](http-get.md)**: Discover REST endpoints from raw HTML and JavaScript using read-only `GET`/`HEAD`.
- 🌐 **[HTTP Text](fetch.md)**: Read clean prose documentation without HTML markup.
- 📖 **[Connected Tools Overview](index.md)**
