Hosting
Create a diagram in the editor
The first Save of a diagram made in the portal's editor.
POST
/user/diagramsTL;DR
| Question | Answer |
|---|---|
| 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.
| Field | Type | Required | Description |
|---|---|---|---|
source | string | yes | Diagram 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" | no | The color scheme to draw it in: light, dark, or auto. Light when left out. |
name | string | no | A 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. |
folder | string | null | no | The 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
| Status | Meaning | Body |
|---|---|---|
| 200 | The same picture was already stored; it was kept. | CreatedDiagram |
| 201 | The diagram was stored. | CreatedDiagram |
| 400 | The body is not valid. | ErrorResponse |
| 401 | Not signed in. | ErrorResponse |
| 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. | ErrorResponse |
| 409 | Several organisations claim the account's publishes and none is the default (orgs.publish_ambiguous). | ErrorResponse |
| 413 | The body is larger than the size cap, or the diagram renders larger than the plan hosts. | ErrorResponse |
| 422 | The diagram source has errors; the diagnostics are in details. | ErrorResponse |
| 429 | Too many requests. | ErrorResponse |
| 502 | The diagram could not be stored. | ErrorResponse |
| 503 | Hosting is not set up on this server. | ErrorResponse |
Response body
A 200 answer has the type CreatedDiagram.
| Field | Type | Required | Description |
|---|
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint, and the error envelope |
| Schemas | Every request and response type |
| Tool reference | The operations as callable tools |