# Make the setup test call

Source: https://immiscible.fly.dev/docs/api/post-v1-cli-test

`POST /v1/cli/test`

One real request through the gate as the agent (a £1 payment for an agent that pays, otherwise a local tool call), answered by its own rules. The action is recorded as a test, so nobody is notified, and it tidies up after itself: a question for a person is cancelled at once, and an allow is settled as cancelled, which withdraws its receipt. The idempotency key is fixed per agent and the rules as they stand, so calling it again makes no second record (`replay: true`), and once a rule changes (a second owner confirms it) the test is made afresh rather than replayed. `immiscible init` uses it.

## Authentication

Agent key. An agent-scoped key (`ask_...`) bound to exactly one agent, or an OAuth access token (`aat_...`) issued to an MCP client for that agent, sent as `Authorization: Bearer`. An agent key may ask, poll and settle. It can never approve, widen a mandate or lift a freeze.

## Request

curl:

```bash
curl -X POST "https://immiscible.fly.dev/v1/cli/test" \
  -H "authorization: Bearer $IMMISCIBLE_AGENT_KEY"
```

Node:

```ts
const res = await fetch('https://immiscible.fly.dev/v1/cli/test', {
  method: 'POST',
  headers: {
    authorization: `Bearer ${process.env.IMMISCIBLE_AGENT_KEY}`,
  },
});
const data = await res.json();
console.log(res.status, data);
```

Python:

```python
import os
import requests

res = requests.post(
    "https://immiscible.fly.dev/v1/cli/test",
    headers={
        "authorization": f"Bearer {os.environ['IMMISCIBLE_AGENT_KEY']}",
    },
)
print(res.status_code, res.json())
```

## Response

```json
{
  "governed": true,
  "decision": "approval_required",
  "reasons": [
    "This agent has not paid example.com before. A person must approve new merchants."
  ],
  "actionId": "act_fb509fba037d83dcc80898b4",
  "kind": "payment",
  "tidied": "earlier",
  "replay": true,
  "agent": {
    "id": "agt_15cf4adcf8235ff0b0100202",
    "name": "Invoice agent",
    "status": "active"
  },
  "workspace": {
    "id": "ws_fa833074ebeb45e8",
    "name": "Quayside"
  }
}
```
