import requests
url = "https://platform.ankra.app/api/v1/org/canvas-publications"
payload = {
"conversation_id": "<string>",
"artifact_id": "<string>",
"title": "<string>",
"content": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
conversation_id: '<string>',
artifact_id: '<string>',
title: '<string>',
content: '<string>'
})
};
fetch('https://platform.ankra.app/api/v1/org/canvas-publications', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/canvas-publications \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conversation_id": "<string>",
"artifact_id": "<string>",
"title": "<string>",
"content": "<string>"
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"url": "<string>",
"title": "<string>",
"language": "html",
"size_bytes": 123,
"status": "live",
"conversation_id": "<string>",
"artifact_id": "<string>",
"canvas_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revision_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"interactive": true
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"url": "<string>",
"title": "<string>",
"language": "html",
"size_bytes": 123,
"status": "live",
"conversation_id": "<string>",
"artifact_id": "<string>",
"canvas_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revision_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"interactive": true
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>"
}Publish a canvas page
Publishes a chat canvas artifact at a public address on the pages host. The content is sent explicitly, so edited canvases publish as shown. Only html, svg and markdown can be published. The page is a static snapshot served in a sandbox, with a fixed notice naming it as an AI-generated page. Publishing the same conversation_id and artifact_id again keeps the URL and extends the expiry. A durable canvas is published with canvas_id and revision_id instead: it has one publication whichever revision is published, the canvas’s published_revision_id follows it, and a json dashboard revision is published as the html snapshot sent in content. Who may publish is the organisation’s public_canvas_publishing setting (admins by default, members, or disabled); tightening it leaves live pages up. ttl_hours defaults to 168 and is capped at 720.
import requests
url = "https://platform.ankra.app/api/v1/org/canvas-publications"
payload = {
"conversation_id": "<string>",
"artifact_id": "<string>",
"title": "<string>",
"content": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
conversation_id: '<string>',
artifact_id: '<string>',
title: '<string>',
content: '<string>'
})
};
fetch('https://platform.ankra.app/api/v1/org/canvas-publications', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/canvas-publications \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"conversation_id": "<string>",
"artifact_id": "<string>",
"title": "<string>",
"content": "<string>"
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"url": "<string>",
"title": "<string>",
"language": "html",
"size_bytes": 123,
"status": "live",
"conversation_id": "<string>",
"artifact_id": "<string>",
"canvas_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revision_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"interactive": true
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"slug": "<string>",
"url": "<string>",
"title": "<string>",
"language": "html",
"size_bytes": 123,
"status": "live",
"conversation_id": "<string>",
"artifact_id": "<string>",
"canvas_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"revision_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"interactive": true
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"detail": "<string>",
"reason": "<string>",
"code": "<string>",
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
- PublishCanvasArtifactRequest
- PublishCanvasRevisionRequest
Either a chat artifact publish (conversation_id and artifact_id) or a durable canvas publish (canvas_id and revision_id), never both.
The canvas artifact id, or a client-chosen id such as document- for a canvas extracted from a code fence.
html, svg, markdown 200000x >= 1Opts the page into running its scripts under the interactive sandbox policy (inline scripts only, no eval, no network, opaque origin). Accepted only when the published language is html; any other language answers 400 invalid_request. Omitted or null publishes a static page, also on a republish.
Response
The artifact was already published; its page was updated in place and kept its URL.
html, svg, markdown live, unpublished, taken_down The conversation a chat artifact publication came from; null on a canvas publication.
The chat artifact published; null on a canvas publication.
The durable canvas published; null on a chat artifact publication.
The canvas revision the page was published from (for a json dashboard revision, the revision its html snapshot was rendered from); null on a chat artifact publication.
True when the page runs its scripts under the interactive sandbox policy; false for a static page and for a legacy row.