---
docId: doc_68dae43dfcef451f81f02bb20e74044a
title: Validate changes
description: Checks changes against the draft without saving anything. It tells you whether they could be saved and then published.
api:
  group: agentes/borrador
  auth: bearer
  operations:
    - operationId: validateDraft
      method: POST
      path: '/v1/agents/{agentId}/draft/validate'
      postmanName: Validate draft changes
---

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

# Validate changes

Check changes before [saving them to the draft](/api-reference/agents/drafts/update). Nothing is saved: read `valid`, `publishable` and `issues` to see what needs fixing.

## Example

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

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

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

```ts
await platic.agents.draft.validate("agent_123", { instructions: "Answer in Spanish." });
```

</Ways.Way>
</Ways>

## Path parameters

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

## Request body

| Field | Type | Description | Required |
|-------|------|-------------|----------|
| `description`, `instructions`, `model`, `modelPriority`, `fallbackModels`, `memory`, `fileAttachments`, `scheduledTasks`, `multilingual`, `workingMessage`, `subagents`, `assistance`, `schedule`, `guardrails`, `followUp` | depends on the section | The same sections you would send to [Update the draft](/api-reference/agents/drafts/update), directly in the body. See [partial changes](/api-reference/agents/configuration#partial-changes) | - |

```json
{
  "guardrails": { "conversationStrikeThreshold": 50 }
}
```

## Response

Validation returns `200` even when it finds problems. The result is in `data`.

```json
{
  "status": "success",
  "data": {
    "valid": false,
    "publishable": false,
    "issues": [
      {
        "path": ["guardrails", "conversationStrikeThreshold"],
        "message": "Number must be less than or equal to 10",
        "code": "INVALID_CONFIG",
        "stage": "save"
      }
    ]
  }
}
```

| Field | Description |
|-------|-------------|
| `valid` | Whether the changes could be saved |
| `publishable` | Whether the result could be published afterwards |
| `issues` | One item per problem. Empty when there are none |
| `issues[].path` | Path of the problem inside the configuration. For the instructions it is `["instructions"]` |
| `issues[].message` | Explanation of the problem |
| `issues[].code` | `INVALID_CONFIG`, `INVALID_SUBAGENT_LINK`, `UNSUPPORTED_REASONING_EFFORT` or `MODEL_FALLBACKS_REQUIRE_OWN_KEY`. The last two are about `model` and `fallbackModels`: a [reasoning level](/api-reference/agents/configuration#reasoning-level) the model doesn't accept, or a new [fallback](/api-reference/agents/configuration#fallback-models) without a connected provider key of your own. Both have `stage: "save"` |
| `issues[].stage` | `save`: prevents saving. `publish`: it can be saved, but not published |

## Errors

| Status | `details.code` | When |
|--------|----------------|------|
| `400` | `INVALID_REQUEST` | The body doesn't have the expected shape |
| `404` | `AGENT_NOT_FOUND` | The agent doesn't exist in the workspace or was deleted |

## Notes

<Collapsible summary="How issues are grouped and when they prevent publishing">

- It doesn't create a version or move the draft.
- Unknown fields and invalid values are checked first. If any are found, `issues` contains only those problems. Otherwise, it includes model, fallback and subagent problems together. Saving the draft would report only the first of these.
- A link the draft already had to a deleted agent doesn't prevent saving: it has `stage: "publish"`.
- A problem with `stage: "publish"` shows up when the links to subagents would form a cycle on publishing. The changes can be saved (`valid: true`), but that version couldn't be published (`publishable: false`).

</Collapsible>
