# Replay draft rules

Source: https://immiscible.fly.dev/docs/api/post-api-w-wid-mandates-replay

`POST /api/w/:wid/mandates/replay`

What draft rules would have decided on the requests the agents really made, each decided again in order with limits adding up (see [test a rule before it is live](https://immiscible.fly.dev/docs/concepts/mandates.md#replay)). Drafts are checked as a create would check them, and never stored or signed; nothing is written. Only agents you can manage are replayed. A draft that does not validate is `400 invalid_draft` naming it (`mandates[0]: ...`). At most 20 drafts and 92 days.

## Authentication

Session cookie. A signed-in person: the console's session cookie. Every state-changing request also carries the header `x-immiscible-csrf: 1`, and the member's role decides what it may do. Bearer tokens are ignored on these routes, so no machine credential can reach them.

## Path parameters

- `wid` (string, required): Workspace id

## Request

curl:

```bash
curl -X POST "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/mandates/replay" \
  -H "cookie: __Host-sid=$IMMISCIBLE_SESSION" \
  -H "x-immiscible-csrf: 1" \
  -H "content-type: application/json" \
  -d '{
    "since": "2026-09-10T00:00:00Z",
    "mandates": [
      {
        "id": "mdt_7a1c",
        "agentId": "agt_21b7",
        "kind": "payment",
        "title": "Weekly groceries",
        "currency": "GBP",
        "perTransaction": 15000,
        "perPeriod": 30000,
        "period": "week"
      }
    ]
  }'
```

Node:

```ts
const res = await fetch('https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/mandates/replay', {
  method: 'POST',
  headers: {
    cookie: `__Host-sid=${process.env.IMMISCIBLE_SESSION}`,
    'x-immiscible-csrf': '1',
    'content-type': 'application/json',
  },
  body: JSON.stringify({
    since: '2026-09-10T00:00:00Z',
    mandates: [
      {
        id: 'mdt_7a1c',
        agentId: 'agt_21b7',
        kind: 'payment',
        title: 'Weekly groceries',
        currency: 'GBP',
        perTransaction: 15000,
        perPeriod: 30000,
        period: 'week',
      },
    ],
  }),
});
const data = await res.json();
console.log(res.status, data);
```

Python:

```python
import os
import requests

res = requests.post(
    "https://immiscible.fly.dev/api/w/$IMMISCIBLE_WORKSPACE/mandates/replay",
    headers={
        "cookie": f"__Host-sid={os.environ['IMMISCIBLE_SESSION']}",
        "x-immiscible-csrf": "1",
        "content-type": "application/json",
    },
    json={
        "since": "2026-09-10T00:00:00Z",
        "mandates": [
            {
                "id": "mdt_7a1c",
                "agentId": "agt_21b7",
                "kind": "payment",
                "title": "Weekly groceries",
                "currency": "GBP",
                "perTransaction": 15000,
                "perPeriod": 30000,
                "period": "week",
            },
        ],
    },
)
print(res.status_code, res.json())
```

## Response

```json
{
  "requests": 41, "changed": 6,
  "totals": { "allow": 29, "approval_required": 6, "deny": 6 },
  "recorded": { "allow": 35, "approval_required": 6, "deny": 0 },
  "flips": { "allow to deny": 6 },
  "signals": { "over_period": 6 },
  "examples": { "over_period": [{ "actionId": "act_9d2f", "at": "2026-09-28T10:02:11Z", "summary": "Weekly shop from Ocado", "amount": 8840, "currency": "GBP", "target": "ocado.com", "recorded": "allow", "replayed": "deny" }] },
  "note": "A replay decides each recorded request again, in order. Bank-detail checks and the monthly allowance are not replayed; data releases are decided without the vault. Nothing is stored or signed."
}
```
