# Test an AI action

```http
POST https://trydimmi.com/api/v1/ai/actions/{action}/tests
```

## Authorization

Send an API token as `Authorization: Bearer <token>`.
The token needs: `ai:actions`.

## Path parameters

- `action` (string, required): Id of the AI agent action, starting with aac_, such as aac_01jx2m8k4t. Find it with GET /ai/actions.

## Body

- `confirm_side_effects` (boolean): Must be true for a live test of a write.
- `contact` (object)
  - `attributes` (object): Older name for custom_attributes, read only when custom_attributes is left out. Attribute keys and values of the stand-in customer, such as {"plan": "pro"}.
  - `custom_attributes` (object): Attribute keys and values of the stand-in customer the test runs as, such as {"plan": "pro"}.
  - `email` (string): Email address of the stand-in customer the test runs as, treated as verified, such as ada@example.com.
  - `external_id` (string): Your own system's id for the stand-in customer the test runs as, such as user_123.
- `input` (any): Sample input matching the action's input_schema.
- `mode` (string): dry_run (default) or live.
- `version` (string): An optional text of at most 16 characters that is accepted but not used: a test always runs the action's working copy. Leave it out.

## Response 201 (Created)

- `data` (object, required)
  - `call_id` (string | null, required): Id of the call recorded for a live test, such as aax_... Null for a dry run or a test that was stopped before sending.
  - `confirmation_text` (string, required): The sentence a customer would be asked to confirm. Same text as summary.
  - `error_code` (string | null, required): Why the test failed or was blocked, such as invalid_arguments, identity_unavailable, auth_failed or not_found. Null when it went through.
  - `latency_ms` (integer, required): How long the request took, in milliseconds. 0 when nothing was sent.
  - `object` (string, required): The kind of record this is, the same for every record of its kind, such as article.
  - `request` (any, required): The request as it was or would be sent, with placeholders filled in. Null when it could not be built.
  - `response` (any, required): What the API or MCP server answered in a live test. Null for a dry run.
  - `result` (any, required): The shaped result the model would read from the response. Null for a dry run.
  - `status` (string, required): How the test went: rendered (dry run built the request), succeeded, failed, or blocked (the request could not be built).
  - `summary` (string, required): Plain sentence of what the call would do, built from the sample arguments.
  - `validation_errors` (string[] | null, required): What was wrong with the sample arguments when they did not fit the action's input schema. Empty when they fit.
  - `warnings` (string[] | null, required): Notes about the test. Currently always an empty list.

## Response default (Error)

- `code` (string, required): Stable code for programs to tell errors apart, such as validation_failed or internal_error.
- `errors` (object): Each rejected field mapped to its messages. Only present when the input was invalid.
- `message` (string, required): What went wrong, in words safe to show a person.

## Example request

```bash
curl --request POST \
  --url 'https://trydimmi.com/api/v1/ai/actions/{action}/tests' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "confirm_side_effects": true,
  "contact": {
    "attributes": {
      "<key>": null
    },
    "custom_attributes": {
      "<key>": null
    },
    "email": "<string>",
    "external_id": "<string>"
  },
  "input": null,
  "mode": "<string>",
  "version": "<string>"
}'
```

## Example response

```json
{
  "data": {
    "call_id": "<string>",
    "confirmation_text": "<string>",
    "error_code": "<string>",
    "latency_ms": 123,
    "object": "<string>",
    "request": null,
    "response": null,
    "result": null,
    "status": "<string>",
    "summary": "<string>",
    "validation_errors": [
      "<string>"
    ],
    "warnings": [
      "<string>"
    ]
  }
}
```

---

Index of all dimmi docs: https://trydimmi.com/llms.txt (full text: https://trydimmi.com/llms-full.txt)
