Publish a data block version
const url = 'https://example.com/v1/blocks';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"projectId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","id":"example","version":"example","kind":"prompt","description":"example","content":{"template":"example","parameters":[{"name":"example","description":"example","type":"string","required":true,"default":"example"}]}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/blocks \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "projectId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "id": "example", "version": "example", "kind": "prompt", "description": "example", "content": { "template": "example", "parameters": [ { "name": "example", "description": "example", "type": "string", "required": true, "default": "example" } ] } }'Needs write on the project. A prompt’s template must parse as Liquid; a settings block’s values must satisfy its schema and the latest version’s. A taken version is 409 block-already-registered (versions never change); a block keeps its kind, and its versions stay in its first version’s project (409 block-project-mismatch). Idempotency-Key applies.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the tenant is their own request (from 0.1.5). Retries with the same key return the original response byte-identical (per docs/API-ROUTE-CONVENTIONS.md §3.1). A retry sent while the first request still runs is answered 409 idempotency-key-in-flight with Retry-After, on a runtime whose store holds keys (from 0.1.5); retry after it, and you get the first request’s answer. An answer that carries a secret (a new API key or public run token, a session token, a generated signing secret) isn’t kept: a retry gets 409 idempotency-key-replay-withheld, with the first request’s status and when it succeeded (from 0.1.5).
Request Bodyrequired
Section titled “Request Bodyrequired”object
Project this belongs to (its content scope). Required: missing, or not a project in the caller’s tenant → 400 bad-input.
prompt: a Liquid template an agent renders as its instructions. settings: a JSON object tools and templates read.
object
Liquid, rendered as an agent’s instructions are (same parameters and auto-injected variables).
object
Default value used when the caller omits this parameter.
object
What tools read (ToolContext.settings[<block id>]) and templates read (settings.<block id>.<key>).
object
JSON Schema (draft 2020-12) the values must satisfy. A later version’s values must satisfy the latest version’s schema too.
object
Responses
Section titled “Responses”Published.
object
Examplegenerated
{ "blockId": "example", "version": "example"}validation-failed (see details.issues), or an unknown projectId; or projectId isn’t a project id (a UUID).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}permission-denied: no write on the project.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The body’s projectId names no project of this tenant (project-not-found).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}block-already-registered or block-project-mismatch.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Server error (unmapped domain code or framework crash).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}