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

> ## Agent Instructions
> Automate.ax automations are TypeScript programs.
> Use Bun for installation and command examples.
> Use Automate.ax for the product name and automate.ax for the package, CLI, and domain.
> Treat documented public APIs as current; do not invent transitional or deprecated names.

# Respond to HTTP request

> Return a custom response to a waiting Automate.ax HTTP request.

`respondToHttpRequest` completes a request received by `onHttpRequest` with
`waitForResponse: true`. Use it to return a custom status, headers, and body to
the caller.

## Example

```ts automations/http-response.automation.ts theme={null}
import { automation, onHttpRequest, respondToHttpRequest } from "automate.ax"

export default automation("Respond with JSON", () => {
  onHttpRequest({ scope: "automation", waitForResponse: true })

  respondToHttpRequest({
    status: 200,
    headers: { "content-type": "application/json" },
    body: JSON.stringify({ accepted: true }),
  })
})
```

## Inputs

| Input     | Type                     | Required | Default | Description                       |
| --------- | ------------------------ | -------- | ------- | --------------------------------- |
| `body`    | `string \| Blob \| null` | No       | No body | Response payload.                 |
| `headers` | `Record<string, string>` | No       | `{}`    | Response headers.                 |
| `status`  | `number`                 | No       | `200`   | HTTP status from 100 through 599. |

Every input accepts a compatible signal. The action returns `Signal<void>`.

The ingress request waits up to ten seconds. If this action does not produce a
response in time, the caller receives `504`, although the automation may keep
running. Pair this action only with a waiting HTTP trigger in the same execution
context.
