On this page
Rebase a draft
Update the draft’s base after the live version changes, keeping the draft’s definition. A further live-version change returns head_moved.
Operation ID: drafts.rebase.
Request
POST /api/v1/agents/{agent_id}/draft/rebase
- TypeScript SDK:
client.drafts.rebase(path arguments usepath). - MCP tool:
sdk_client_callwithoperationId: "drafts.rebase"(path arguments useinput.path). Legacy alias:drafts_rebase. Connect to your authenticated/mcpendpoint with an API key for the same environment. - Minimum API key role: member.
- Idempotency: No header required; the resource or revision identifies the change.
Read resource IDs from earlier responses and use a key for the same environment.
Request example
Read the current draft and agent head first. Replace draft_id and head_version with those values, then inspect the returned draft before further edits; rebasing changes its live-head baseline.
Set CUMULUS_BASE_URL to your workspace API URL and CUMULUS_API_KEY to a key for that environment. Example values are synthetic.
cURL
curl --fail-with-body -sS -X POST "${CUMULUS_BASE_URL%/}/api/v1/agents/${AGENT_ID}/draft/rebase" \
-H "Authorization: Bearer $CUMULUS_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"draft_id": "11111111-1111-4111-8111-111111111111",
"head_version": 1
}'
TypeScript
import { Cumulus } from "@cumulus/sdk";
const baseUrl = process.env.CUMULUS_BASE_URL;
const apiKey = process.env.CUMULUS_API_KEY;
if (!baseUrl || !apiKey) throw new Error("Set CUMULUS_BASE_URL and CUMULUS_API_KEY");
const client = new Cumulus({ baseUrl, apiKey });
const response = await client.drafts.rebase({
"path": {
"agent_id": "<agent_id>"
},
"body": {
"draft_id": "11111111-1111-4111-8111-111111111111",
"head_version": 1
}
});
Input schema
Path, query and header parameters
agent_id
path parameter · Required.
Type: string. minLength: 1. maxLength: 256. pattern: ^[A-Za-z0-9][A-Za-z0-9_.:-]*$.
JSON request body
| Field | Type or values | Required | Description and limits |
|---|---|---|---|
draft_id | string (uuid) | Required | Identifier of the editable draft. Read it from the agent or draft response. pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$. |
head_version | integer | Required | At least 0. At most 2147483647. |
Complete OpenAPI schema
{
"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
HTTP 200
Rebase the draft onto the live version after a head change (keeps its definition; 409 head_moved when live moved again)
application/json
| Field | Type or values | Required | Description and limits |
|---|---|---|---|
agent | object | Required | — |
agent.tenant_id | string (uuid) | Required | pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$. |
agent.kind | "agent" | Required | — |
agent.id | string | Required | minLength: 1. maxLength: 256. pattern: ^[A-Za-z0-9][A-Za-z0-9_.:-]*$. |
draft_id | string (uuid) | Required | Identifier of the editable draft. Read it from the agent or draft response. pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$. |
revision | integer | Required | Greater than 0. At most 2147483647. |
base_version | integer or null | Required | At least 0. At most 2147483647. |
published_revision | integer or null | Required | Greater than 0. At most 2147483647. |
updated_at | string (date-time) | Required | pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:.\d+)?(?:Z))$. |
Error responses
| HTTP | Description |
|---|---|
| 4XX | Typed error (ApiError) |
| 5XX | Typed error (ApiError) |
Errors use the shared error envelope. Inspect error.code, retryable, outcome and details before retrying.
Complete OpenAPI schema
{
"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
Expand the complete OpenAPI definitions for integrations that generate their own clients.
Complete OpenAPI schema
{
"components": {
"schemas": {
"DraftsRebaseRequest": {
"type": "object",
"properties": {
"draft_id": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
},
"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",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
},
"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",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$"
},
"revision": {
"type": "integer",
"minimum": 0,
"exclusiveMinimum": true,
"maximum": 2147483647
},
"base_version": {
"nullable": true,
"type": "integer",
"minimum": 0,
"maximum": 2147483647
},
"published_revision": {
"nullable": true,
"type": "integer",
"minimum": 0,
"exclusiveMinimum": true,
"maximum": 2147483647
},
"updated_at": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
}
},
"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.