# Place a library diagram in a Google Slides deck or a Google Doc

> Page: https://docs.plotwork.dev/api/post-orgs-org-documents. Index of every page: https://docs.plotwork.dev/llms.txt

Puts the picture on the chosen slide or at the end of the Doc.

`POST /orgs/{org}/documents`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Place a library diagram in a Google Slides deck or a Google Doc. |
| What does it take? | A JSON body of type [`DocumentPlaceBody`](https://docs.plotwork.dev/api/schemas.md#documentplacebody). |
| What does it return? | Status 201 with a body of type [`DocumentPlacementAnswer`](https://docs.plotwork.dev/api/schemas.md#documentplacementanswer). |
| What can go wrong? | `400` a field is not valid (documents.invalid); details.field names it; `401` not signed in; `403` not the owner or an admin (orgs.forbidden), the plan does not include it (plan.documents_not_included), or the origin may not make changes; `404` no such organisation, diagram, placement or file, or the caller is not a member; `409` google Drive is not connected (documents.no_drive), the diagram may not leave the library (documents.confidential, documents.restricted, documents.pending), or the organisation has 200 placements (documents.limit); `429` too many requests; `502` google refused or could not be reached (documents.google_failed); `503` placing diagrams in documents is not available on this server (documents.unavailable). Every failure uses the one error envelope. |

## What it does

Puts the picture on the chosen slide or at the end of the Doc. Each new version of the diagram then replaces it in place.

## Path parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `org` | `string` | yes | The organisation's id or its slug. |

## Request body

The body has the type [`DocumentPlaceBody`](https://docs.plotwork.dev/api/schemas.md#documentplacebody).

| Field | Type | Required | Description |
|---|---|---|---|
| `diagramId` | `string` | yes | The library diagram. |
| `kind` | `"slides" \| "docs"` | yes | `slides` for a Google Slides deck, `docs` for a Google Doc. |
| `fileId` | `string` | yes | The deck or Doc, as the Google Picker gave it. pattern `^[A-Za-z0-9_-]{10,200}$`. |
| `fileName` | `string` | yes | The file's name, for the portal to show. at least 1 character; at most 300 characters. |
| `pageId` | `string` | no | The slide to place the picture on. Required for a deck. pattern `^[A-Za-z0-9_.:-]{1,200}$`. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 201 | The placement. | [`DocumentPlacementAnswer`](https://docs.plotwork.dev/api/schemas.md#documentplacementanswer) |
| 400 | A field is not valid (documents.invalid); details.field names it. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 401 | Not signed in. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | Not the owner or an admin (orgs.forbidden), the plan does not include it (plan.documents_not_included), or the origin may not make changes. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 404 | No such organisation, diagram, placement or file, or the caller is not a member. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 409 | Google Drive is not connected (documents.no_drive), the diagram may not leave the library (documents.confidential, documents.restricted, documents.pending), or the organisation has 200 placements (documents.limit). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 502 | Google refused or could not be reached (documents.google_failed). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 503 | Placing diagrams in documents is not available on this server (documents.unavailable). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

A 201 answer has the type [`DocumentPlacementAnswer`](https://docs.plotwork.dev/api/schemas.md#documentplacementanswer).

| Field | Type | Required | Description |
|---|---|---|---|
| `placement` | `DocumentPlacement` | yes |  |
| `placement.id` | `string` | yes |  |
| `placement.diagramId` | `string` | yes |  |
| `placement.diagramName` | `string \| null` | yes |  |
| `placement.kind` | `"slides" \| "docs"` | yes | `slides` for a Google Slides deck, `docs` for a Google Doc. |
| `placement.fileId` | `string` | yes |  |
| `placement.fileName` | `string` | yes |  |
| `placement.pageId` | `string \| null` | yes | The slide, for a deck; null for a Doc. |
| `placement.status` | `"ok" \| "failing" \| "gone"` | yes | `ok`, `failing` (the last send failed; lastError says why) or `gone` (the file or the picture is no longer there). |
| `placement.lastError` | `string \| null` | yes |  |
| `placement.lastSentAt` | `integer \| null` | yes |  |
| `placement.current` | `boolean` | yes | Whether the file shows the library's current version. |
| `placement.createdAt` | `integer` | yes |  |
| `placement.link` | `string` | yes | The file in Google. |

## See also

| Doc | Why |
|---|---|
| [API reference](https://docs.plotwork.dev/api/reference.md) | Every endpoint, and the error envelope |
| [Schemas](https://docs.plotwork.dev/api/schemas.md) | Every request and response type |
| [Tool reference](https://docs.plotwork.dev/mcp/tools.md) | The operations as callable tools |
