# Report a transaction

`POST /v1/swaps/:swapId/steps/:stepId`

Tells Circuitry which transaction ran a step of a swap, so that the swap's status changes immediately. A report is optional. Without it, Circuitry finds the account's transactions on the chain within a few seconds.

Report from your server, because API keys never go to browsers.

## Request

```bash
curl https://api.circuitry.company/v1/swaps/k17aervc9b9sq4ja60esj941ps8gb1r2/steps/swap \
  -H "Authorization: Bearer $CIRCUITRY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "transactionHash": "0x3f07a1c2e9d8b7f6a5e4d3c2b1a09f8e7d6c5b4a39281706f5e4d3c2b1a09f8e" }'
```

| Field | Meaning |
| --- | --- |
| `swapId` | In the path. The swap's `id` |
| `stepId` | In the path. The step's `id`: `approve`, `permit2`, or `swap` |
| `transactionHash` | The hash of the transaction that ran the step, as `0x` followed by 64 hexadecimal digits |

Circuitry checks the transaction before it records it:

* If the account sent the transaction itself, the transaction must make exactly the step's call: the same `to`, `data`, and `value`.
* If a smart account ran the step, for example in an ERC-4337 bundle, the transaction must show the step's effects for the account. These effects are the exact approval, the exact Permit2 allowance, or the swap's transfers within `input.maximum` and `output.minimum`. A `calls` step must show the effect of every call in the one transaction.
* If the transaction isn't in a block yet, the step becomes `submitted`, and Circuitry checks the transaction when it is.

## Response

The swap, as [Retrieve a swap](/reference/get-swap#response) returns it. A second report of the same transaction returns the swap and changes nothing.

## Errors

| Status | Code | Meaning |
| --- | --- | --- |
| 400 | `invalid_request` | `transactionHash` is missing or malformed. `param` names it |
| 404 | `swap_not_found` | No swap with this ID belongs to the API key's app |
| 404 | `step_not_found` | The swap has no step with this ID |
| 409 | `step_already_submitted` | Another transaction already ran this step |
| 409 | `transaction_mismatch` | The transaction doesn't run this step. `param` is `transactionHash` |
| 409 | `quote_expired` | Circuitry stopped its checks of the swap, and the transaction isn't in a block yet. Report the transaction again when it is in a block |

This endpoint can also return the errors in [Failed authentication](/authentication#failed-authentication), `rate_limited`, and `internal_error`.
