# Execute a Bot by id

Canonical page: https://docs.ovok.com/primitives/execute-bot-by-id

Execute a stored Bot by its FHIR ID. The request body supplies the Bot's input; its code determines the output, so the response can vary between Bots.

| Method | Path |
| --- | --- |
| `POST` | `/fhir/R4/Bot/:id/$execute` |

## Request [#request]

```bash
curl --request POST \
  --url "https://api.sandbox.ovok.com/fhir/R4/Bot/${BOT_ID}/\$execute" \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{"input":"example"}'
```

| Request part | Description |
| --- | --- |
| `:id` | ID of the Bot resource to execute. |
| Body | JSON input consumed by the Bot. The required shape is defined by the Bot implementation. |

## Response [#response]

The response body and content type are defined by the Bot's result. An asynchronous invocation may return `202 Accepted` and a job location when requested with `Prefer: respond-async`.

| Outcome | Description |
| --- | --- |
| Synchronous result | The Bot's output is returned by the operation. |
| Asynchronous result | Follow the job URL supplied in the response to retrieve completion status. |
| Execution error | The response describes the runtime or input failure; details depend on the Bot. |
