---
docId: doc_94876e64b26c4b37a270ab01cddcfebf
title: Publish a version
description: Puts the draft's version into production. From the next incoming message, the agent answers with it.
api:
  group: agentes/publicacion
  auth: bearer
  operations:
    - operationId: publish
      method: POST
      path: '/v1/agents/{agentId}/publication'
      postmanName: Publish a version
---

<script>
  import { Ways } from '$lib/components';
</script>

# Publish a version

Apply the draft to your customer conversations. Send the request without a body to publish it, or use `versionId` to choose another version. The agent uses it from the next incoming message.

## Example

<Ways tabs="api,sdk">
<Ways.Way name="api">

```bash
curl -X POST https://api.platic.ai/v1/agents/$AGENT_ID/publication \
  -H "Authorization: Bearer $PLATIC_API_KEY"
```

</Ways.Way>
<Ways.Way name="sdk">

```ts
await platic.agents.publish("agent_123");
```

</Ways.Way>
</Ways>

## Path parameters

| Parameter | Type | Description | Required |
|-----------|------|-------------|----------|
| `agentId` | string | Agent id | ✓ |

## Request body

The body is optional. Without a body, it publishes the draft's version. To publish an exact version or leave a note:

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `versionId` | string | Version to publish, for example `v5`. Defaults to the draft's | - |
| `note` | string | Publication note, up to 500 characters | - |

```json
{
  "versionId": "v5",
  "note": "Shorter answers"
}
```

## Response

The new publication, with the fields from [Get the publication](/api-reference/agents/publications/get#response-fields).

```json
{
  "status": "success",
  "data": {
    "agentId": "Xq8mTe2LwP4kZ1aB9cDf",
    "publication": { "versionId": "v5", "number": 5 },
    "last": {
      "publicationId": "p3",
      "action": "publish",
      "versionId": "v5",
      "previousVersionId": "v3",
      "createdAt": "2026-10-28T12:30:00.000Z",
      "createdBy": { "kind": "api_key", "keyId": "k3yId" },
      "source": "api",
      "via": null,
      "note": "Shorter answers"
    }
  }
}
```

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `403` | `FORBIDDEN` | The credential can't edit this agent. Publishing needs the same permission as editing |
| `404` | `AGENT_NOT_FOUND` | The agent doesn't exist in the workspace or was deleted |
| `404` | `VERSION_NOT_FOUND` | `versionId` doesn't exist on that agent |
| `409` | `COPY_INCOMPLETE` | The agent is a copy whose files didn't finish connecting. See [Copy an agent](/api-reference/agents/copy#copy-the-files-too) |
| `409` | `CONFLICT` | Someone else changed this at the same time. Try again |
| `422` | `INVALID_SUBAGENT_LINK` | A link in that version points to an agent that no longer exists, or the links would form a cycle. It isn't published |
| `422` | `INVALID_ESCALATION` | An escalation that version connects or turns on, compared to the published one, doesn't exist in the workspace or is archived. `details.escalations` lists each one with `escalationId` and `reason`: `not_found` or `archived`. It isn't published |
| `503` | `SUPPORT_SERVICE_UNAVAILABLE` | That version's escalations couldn't be checked. It isn't published; try again |

## Notes

- Publishing doesn't move the draft: you can keep editing.
- If the draft is already the published version, the same version is published again and there is one more entry in the [publication history](/api-reference/agents/publications/list).
- If you publish from an AI assistant connected to the [Platica MCP](/mcp/tools#agents), do it only when the person asks explicitly. Each publication is recorded with who made it and from where.
- To evaluate the version with scenarios before publishing it, see [Agent evals](/api-reference/evals/runs/start). To review what changes, [compare the versions](/api-reference/agents/versions/compare).
- If the published version doesn't work as you expected, go back to the previous one with [Roll back](/api-reference/agents/publications/rollback).
