On this page
drafts.rebase
Rebase the draft onto the live version after a head change (keeps its definition; 409 head_moved when live moved again)
Request
POST /api/v1/agents/{agent_id}/draft/rebase
- MCP:
drafts_rebase - SDK:
client.drafts.rebase(SDK path arguments usepath; MCP usesparams). - Minimum API key role: member.
- Idempotency: natural.
Use the request schema below. Read IDs from earlier operation results.
Input schema
json
{
"parameters": [
{
"name": "agent_id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 256,
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DraftsRebaseRequest"
}
}
}
}
}
Responses
json
{
"200": {
"description": "Rebase the draft onto the live version after a head change (keeps its definition; 409 head_moved when live moved again)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DraftsEditResponse200"
}
}
}
},
"4XX": {
"description": "Typed error (ApiError)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"5XX": {
"description": "Typed error (ApiError)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
Referenced schemas
json
{
"components": {
"schemas": {
"DraftsRebaseRequest": {
"type": "object",
"properties": {
"draft_id": {
"type": "string",
"format": "uuid"
},
"head_version": {
"type": "integer",
"minimum": 0,
"maximum": 2147483647
}
},
"required": [
"draft_id",
"head_version"
],
"additionalProperties": false
},
"DraftsEditResponse200": {
"type": "object",
"properties": {
"agent": {
"type": "object",
"properties": {
"tenant_id": {
"type": "string",
"format": "uuid"
},
"kind": {
"type": "string",
"enum": [
"agent"
]
},
"id": {
"type": "string",
"minLength": 1,
"maxLength": 256,
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.:-]*$"
}
},
"required": [
"tenant_id",
"kind",
"id"
],
"additionalProperties": false
},
"draft_id": {
"type": "string",
"format": "uuid"
},
"revision": {
"type": "integer",
"exclusiveMinimum": true,
"minimum": 0,
"maximum": 2147483647
},
"base_version": {
"allOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 2147483647
}
],
"nullable": true
},
"published_revision": {
"allOf": [
{
"type": "integer",
"exclusiveMinimum": true,
"minimum": 0,
"maximum": 2147483647
}
],
"nullable": true
},
"updated_at": {
"type": "string",
"format": "date-time"
}
},
"required": [
"agent",
"draft_id",
"revision",
"base_version",
"published_revision",
"updated_at"
],
"additionalProperties": false
},
"ApiError": {
"type": "object",
"properties": {
"error": {
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": [
"unauthenticated",
"forbidden",
"not_found",
"conflict",
"invalid_request",
"idempotency_conflict",
"policy_denied",
"capability_unavailable",
"provider_unavailable",
"knowledge_unavailable",
"publication_invalid",
"run_not_active",
"rate_limited",
"outcome_unknown",
"internal"
]
},
"message": {
"type": "string"
},
"retryable": {
"type": "boolean"
},
"outcome": {
"type": "string",
"enum": [
"none",
"unknown"
]
},
"details": {
"type": "object",
"additionalProperties": {}
}
},
"required": [
"code",
"message",
"retryable",
"outcome"
],
"additionalProperties": false
}
},
"required": [
"error"
],
"additionalProperties": false
}
}
}
}
Errors and recovery
See API error handling and Troubleshooting.
Related guides
Content version 4d188570Markdown source