# Deploy a Bot

Canonical page: https://docs.ovok.com/primitives/deploy-bot

Deploy source code to a Bot resource. Deployment is an administrative action; use a Bot configured for a supported runtime and ensure the code is reviewed before publishing it.

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

## Request [#request]

The request body is JSON containing the Bot source and optional filename.

```bash
curl --request POST \
  --url "https://api.sandbox.ovok.com/fhir/R4/Bot/${BOT_ID}/\$deploy" \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{"filename":"index.js","code":"export async function handler() { return { ok: true }; }"}'
```

| Body field | Type | Description |
| --- | --- | --- |
| `code` | string | Source code to deploy. It may be omitted when the Bot already contains code. |
| `filename` | string | Source filename; defaults to `index.js`. |

## Response [#response]

| HTTP status | Meaning |
| --- | --- |
| `200 OK` | Deployment completed. The response may include deployment or runtime information. |
| Error response | Invalid Bot configuration, unsupported runtime, or deployment failure; inspect the returned `OperationOutcome` or error details. |

Only users with the required Bot administration permissions should deploy code.
