---
docId: doc_53cd154d782a41cc9e2cf0b7dbb13d77
title: Replace the draft
description: "Replace the draft with a complete configuration without changing the publication."
api:
  group: agentes/borrador
  auth: bearer
  operations:
    - operationId: replaceDraft
      method: PUT
      path: '/v1/agents/{agentId}/draft'
      postmanName: Replace the draft
---

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

# Replace the draft

Replace the whole draft with a complete [configuration](/api-reference/agents/configuration). First read `config` with [Get the draft](/api-reference/agents/drafts/get), then send it complete, with all 15 sections. **The publication does not change.**

To change only some fields, use [Update the draft](/api-reference/agents/drafts/update).

## Example

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

```bash
curl -X PUT https://api.platic.ai/v1/agents/$AGENT_ID/draft \
  -H "Authorization: Bearer $PLATIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "config": { ... } }'
```

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

```ts
const { config } = await platic.agents.draft.get("agent_123");
await platic.agents.draft.replace("agent_123", { config });
```

</Ways.Way>
</Ways>

## Path parameters

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

## Request body

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `config` | object | The complete [configuration](/api-reference/agents/configuration), with its 15 sections. `instructions` is a string | ✓ |
| `note` | string | Version note, up to 500 characters | - |

```json
{
  "config": {
    "description": "Helps people who want to buy",
    "instructions": "You are the sales assistant for Acme Store."
  },
  "note": "Complete configuration"
}
```

The example shows two of the 15 required sections.

## Response

The fields are those from [Update the draft](/api-reference/agents/drafts/update#response):

```json
{
  "status": "success",
  "data": {
    "changed": true,
    "draft": { "versionId": "v6", "number": 6 },
    "version": {
      "versionId": "v6",
      "number": 6,
      "basedOnVersionId": "v5",
      "restoredFromVersionId": null,
      "copiedFrom": null,
      "createdAt": "2026-10-28T12:08:00.000Z",
      "createdBy": { "kind": "api_key", "keyId": "k3yId" },
      "source": "api",
      "via": null,
      "note": "Complete configuration"
    }
  }
}
```

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | The body doesn't have the expected shape, for example `config` is missing |
| `403` | `FORBIDDEN` | The credential can't edit this agent |
| `404` | `AGENT_NOT_FOUND` | The agent doesn't exist in the workspace or was deleted |
| `409` | `CONFLICT` | Someone else changed this at the same time. Try again |
| `422` | `INVALID_CONFIG` | The configuration is incomplete, has a name from the [earlier shape](/api-reference/agents/configuration#if-you-used-the-earlier-shape) or contains an invalid value. `details.issues` lists the field path for each problem |
| `422` | `INVALID_SUBAGENT_LINK` | `subagents` links an agent that doesn't exist in the workspace, or the same agent |
| `422` | `UNSUPPORTED_REASONING_EFFORT` | `model` or a model in `fallbackModels` asks for a [reasoning level](/api-reference/agents/configuration#reasoning-level) it doesn't accept. `details.supportedEfforts` lists the supported values |
| `422` | `MODEL_FALLBACKS_REQUIRE_OWN_KEY` | `fallbackModels` adds a fallback the draft didn't have and the workspace has no own key connected. Keeping, removing or reordering the ones it already has, or emptying the list, doesn't need a key. See [fallback models](/api-reference/agents/configuration#fallback-models) |

## Notes

- If the configuration is the same as the draft's, it answers `changed: false` without creating a version.
- To see which sections ended up different, use [Compare versions](/api-reference/agents/versions/compare).
- The format of `details.issues` is in [Validation](/api-reference/agents/configuration#validation).
