> For the complete documentation index, see [llms.txt](https://fourohtwo.gitbook.io/fourohtwo-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fourohtwo.gitbook.io/fourohtwo-docs/creators/webhooks.md). Agents can also search and read this documentation through its [MCP server](https://fourohtwo.gitbook.io/fourohtwo-docs/~gitbook/mcp).

# Webhooks and call history

Fourohtwo can send a signed `POST` to your server for every paid call to your APIs, every payout, and alerts about the agent wallets you manage. Use it to grant credits, record revenue or alert your team.

## Set it up

1. Open **Dashboard → Settings → Webhook** and enter an `https://` URL.
2. Copy the **signing secret**. It starts with `whsec_`.
3. Press **Send test event** to check that your endpoint answers with a `2xx`.

## Events

| Event                   | Sent when                                                                                                                               |
| ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
| `payment.settled`       | An agent's payment for one of your APIs settled, in USDG on Robinhood Chain or USDC on Base.                                            |
| `payout.sent`           | A withdrawal from your balance reached your wallet.                                                                                     |
| `listing.down`          | A directory endpoint on a domain you claimed stopped answering our check.                                                               |
| `listing.up`            | It answers again.                                                                                                                       |
| `listing.price_changed` | Its price changed in your discovery feed.                                                                                               |
| `listing.reported`      | Someone reported it. `data.hidden` says whether it's hidden until review.                                                               |
| `agent.limit_near`      | An agent wallet you manage has spent 80% of its 24h limit. At most once a day per agent.                                                |
| `agent.blocked`         | An agent wallet you manage tried a call its rules refuse (paused, allowlist, per-call or daily limit). At most every 6 hours per agent. |
| `ping`                  | You pressed **Send test event**.                                                                                                        |

Calls that fail are never charged, so they never send `payment.settled`.

```json
{
  "id": "evt_6f1c0a…",
  "type": "payment.settled",
  "createdAt": "2026-11-25T06:12:44.120Z",
  "data": {
    "callId": "0xagent…:0xnonce…",
    "api": { "id": "api_…", "slug": "weather", "name": "Weather forecast" },
    "path": "/forecast/london",
    "payer": "0x7099…79c8",
    "amountUsdg": "0.01",
    "creatorShareUsdg": "0.0095",
    "feeUsdg": "0.0005",
    "txHash": "0x…",
    "network": "eip155:4663",
    "latencyMs": 182
  }
}
```

## Verify the signature

Every request has an `x-fourohtwo-signature` header like `t=1795586000,v1=5f2c…`. `v1` is the HMAC-SHA256 of `t`, a dot and the raw request body, keyed with your secret. Reject requests where it doesn't match, or where `t` is more than five minutes old.

```js
import { createHmac, timingSafeEqual } from "node:crypto";

export function verify(rawBody, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const expected = createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
  return fresh && timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1 ?? ""));
}
```

```python
import hmac, hashlib, time

def verify(raw_body: bytes, header: str, secret: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    expected = hmac.new(secret.encode(), f"{parts['t']}.".encode() + raw_body, hashlib.sha256).hexdigest()
    return abs(time.time() - int(parts["t"])) < 300 and hmac.compare_digest(expected, parts.get("v1", ""))
```

Use the raw body exactly as received. Parsing and re-serializing the JSON changes it and breaks the signature.

## Delivery

* Each event is sent once, with one retry after a short wait if your endpoint doesn't answer `2xx` within 5 seconds.
* Use the event `id` to ignore duplicates.
* After 50 failed deliveries in a row the webhook pauses. Fix the endpoint and save the URL again to turn it back on.
* The last 15 deliveries, with status and timing, are listed under the webhook in Settings.

## Call history

**Dashboard → Calls** lists every paid call to your APIs: time, path, agent, amount, result, response time and settlement transaction. Filter by API or result, and download the last 30 days as CSV.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://fourohtwo.gitbook.io/fourohtwo-docs/creators/webhooks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
