Replace the draft

SDK platic.agents.draft.replace()

Replace the whole draft with a complete configuration. First read config with Get the draft, then send it complete, with all 15 sections. The publication does not change.

To change only some fields, use Update the draft.

Example

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

Path parameters

ParameterTypeDescriptionRequired
agentIdstringAgent id✓

Request body

FieldTypeDescriptionRequired
configobjectThe complete configuration, with its 15 sections. instructions is a string✓
notestringVersion note, up to 500 characters-
{
  "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:

{
  "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

Statusdetails.codeWhen
400INVALID_REQUESTThe body doesn't have the expected shape, for example config is missing
403FORBIDDENThe credential can't edit this agent
404AGENT_NOT_FOUNDThe agent doesn't exist in the workspace or was deleted
409CONFLICTSomeone else changed this at the same time. Try again
422INVALID_CONFIGThe configuration is incomplete, has a name from the earlier shape or contains an invalid value. details.issues lists the field path for each problem
422INVALID_SUBAGENT_LINKsubagents links an agent that doesn't exist in the workspace, or the same agent
422UNSUPPORTED_REASONING_EFFORTmodel or a model in fallbackModels asks for a reasoning level it doesn't accept. details.supportedEfforts lists the supported values
422MODEL_FALLBACKS_REQUIRE_OWN_KEYfallbackModels 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

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.
  • The format of details.issues is in Validation.