Skip to content
Connect an agent

Hosting

Create a diagram in the editor

The first Save of a diagram made in the portal's editor.

POST/user/diagrams

TL;DR

QuestionAnswer
What does it do?Create a diagram in the editor.
What does it take?A JSON body of type CreateDiagramBody.
What does it return?Status 200 with a body of type CreatedDiagram.
What can go wrong?400 the body is not valid; 401 not signed in; 403 the plan does not include the editor (plan.editor_not_included), the plan has no room (hosting.quota_exceeded), the organisation refuses the folder or the role, or the request came from an origin that may not make changes; 409 several organisations claim the account's publishes and none is the default (orgs.publish_ambiguous); 413 the body is larger than the size cap, or the diagram renders larger than the plan hosts; 422 the diagram source has errors; the diagnostics are in details; 429 too many requests; 502 the diagram could not be stored; 503 hosting is not set up on this server. Every failure uses the one error envelope.

What it does

The first Save of a diagram made in the portal's editor. Draws the source with the source written in, and stores it where the account's publishes go: its own library, or an organisation's private library when its Publishing setting says so (private: true). Needs a plan with the diagram editor (403 plan.editor_not_included).

Request body

The body has the type CreateDiagramBody.

FieldTypeRequiredDescription
sourcestringyesDiagram source; the first line is the header, such as flow "Title" (draw_diagram lists every kind). at least 1 character; at most 50000 characters.
scheme"light" | "dark" | "auto"noThe color scheme to draw it in: light, dark, or auto. Light when left out.
namestringnoA label for the diagram in your list and in the Markdown snippet. Optional. at least 1 character; at most 80 characters; pattern ^[^\p{Cc}]+$/u.
folderstring | nullnoThe folder to file the diagram in. Left out, a new diagram goes to the top level and a diagram that is already hosted stays where it is. A path files a new diagram there, or moves the one that is already hosted and keeps its link. null puts it at the top level.

Responses

StatusMeaningBody
200The same picture was already stored; it was kept.CreatedDiagram
201The diagram was stored.CreatedDiagram
400The body is not valid.ErrorResponse
401Not signed in.ErrorResponse
403The plan does not include the editor (plan.editor_not_included), the plan has no room (hosting.quota_exceeded), the organisation refuses the folder or the role, or the request came from an origin that may not make changes.ErrorResponse
409Several organisations claim the account's publishes and none is the default (orgs.publish_ambiguous).ErrorResponse
413The body is larger than the size cap, or the diagram renders larger than the plan hosts.ErrorResponse
422The diagram source has errors; the diagnostics are in details.ErrorResponse
429Too many requests.ErrorResponse
502The diagram could not be stored.ErrorResponse
503Hosting is not set up on this server.ErrorResponse

Response body

A 200 answer has the type CreatedDiagram.

FieldTypeRequiredDescription

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
Tool referenceThe operations as callable tools