# Copy an organisation diagram

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

Stores the same picture as a new diagram with its own id, filed in the folder named.

`POST /orgs/{org}/diagrams/{id}/copy`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Copy an organisation diagram. |
| What does it take? | A JSON body of type [`CopyOrganisationDiagramBody`](https://docs.plotwork.dev/api/schemas.md#copyorganisationdiagrambody). |
| What does it return? | Status 201 with a body of type [`OrganisationDiagram`](https://docs.plotwork.dev/api/schemas.md#organisationdiagram). |
| What can go wrong? | `400` the body is not valid, or the folder path breaks the rules; details says why; `401` not signed in, or the key is not valid; `403` a reader may not publish (orgs.forbidden), the folder is restricted to others (orgs.folder_restricted), the organisation's plan has no room (hosting.quota_exceeded), or the request came from an origin that may not make changes; `404` no such organisation or diagram, the diagram is in a folder the caller may not use, the caller is not a member, or the key belongs to another organisation; `413` the copy is larger than the plan hosts; `429` too many requests, or the daily limit is used up; `502` the copy could not be stored; `503` organisations are not set up on this server. Every failure uses the one error envelope. |

## What it does

Stores the same picture as a new diagram with its own id, filed in the folder named. Any role that may publish may copy a diagram it can see. The folder rules and approval apply to the folder the copy goes to, and the copy counts toward the owner's plan.

## Path parameters

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

## Request body

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

| Field | Type | Required | Description |
|---|---|---|---|
| `folder` | `string \| null` | yes | The folder to file the copy in, or null for the top level. at most 204 characters; pattern `^[A-Za-z0-9_-]+(?: [A-Za-z0-9_-]+)*(?:/[A-Za-z0-9_-]+(?: [A-Za-z0-9_-]+)*){0,4}$`. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 201 | The copy. | [`OrganisationDiagram`](https://docs.plotwork.dev/api/schemas.md#organisationdiagram) |
| 400 | The body is not valid, or the folder path breaks the rules; details says why. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 401 | Not signed in, or the key is not valid. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | A reader may not publish (orgs.forbidden), the folder is restricted to others (orgs.folder_restricted), the organisation's plan has no room (hosting.quota_exceeded), or the request came from an origin that may not make changes. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 404 | No such organisation or diagram, the diagram is in a folder the caller may not use, the caller is not a member, or the key belongs to another organisation. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 413 | The copy is larger than the plan hosts. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests, or the daily limit is used up. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 502 | The copy could not be stored. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 503 | Organisations are not set up on this server. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

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

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | `string` | yes | The handle for the diagram in the routes below. |
| `name` | `string \| null` | yes | The label given at publish, or null. |
| `folder` | `string \| null` | yes | The folder it is filed in, such as `Payments/Checkout`, or null for the top level. |
| `scheme` | `"light" \| "dark" \| "auto"` | yes | The color scheme it was drawn in: light, dark, or auto. |
| `bytes` | `integer` | yes | Size of the stored SVG in bytes. |
| `createdBy` | `string \| null` | yes | The person it belongs to: the member who published it, or the person who connected the agent that did. Null when that account has left or an organisation key published it. |
| `publishedVia` | `"person" \| "connection" \| "key" \| null` | yes | How it was published: `person` (signed in, or with a key the person made), `connection` (an agent connected to the organisation, whose person is `createdBy`), or `key` (an organisation key from Keys and CI). Null for a diagram published before this was recorded. |
| `publishedKey` | `object \| null` | yes | The key behind a connection or an organisation key. Null for a person, and once the key no longer exists. |
| `publishedKey.id` | `string` | yes | The key's id, as Keys and CI lists it. Never the key itself. |
| `publishedKey.name` | `string \| null` | yes | The key's name, or null once the key is revoked. |
| `publishedClient` | `string \| null` | yes | The client name the agent gave when it connected, such as `Claude Code`, for a connection only. at most 100 characters. |
| `createdAt` | `integer` | yes | When it was first published, in milliseconds since the epoch. |
| `publishedAt` | `integer` | yes | When it was last published, in milliseconds since the epoch. Publishing the same diagram again moves it. |
| `expiresAt` | `integer \| null` | yes | When it will be deleted, in milliseconds since the epoch, or null when the owner's plan keeps diagrams until they are deleted. |
| `viewUrl` | `string` | yes | A page in the portal that shows the diagram to a signed-in member. It is not a link anyone can open: an organisation's diagrams have no public address. |
| `locked` | `boolean` | yes | True while the owner has the diagram locked: nobody can delete, rename or move it, its publisher and the owner included, until the owner unlocks it. A lock does not stop it expiring on a plan that expires diagrams. |
| `lockedAt` | `integer \| null` | yes | When the owner locked it, in milliseconds since the epoch, or null when it is not locked. |
| `restricted` | `true` | no | Present, and true, when the owner has restricted this diagram's folder and the caller is allowed in it, so the portal can show it as locked. Absent otherwise. A diagram in a folder the caller may not use is not listed at all. |
| `keepInside` | `true` | no | Present, and true, when the folder rule over this diagram keeps its diagrams inside: the svg route refuses `?download=1` and the copy route refuses a copy (403 `orgs.folder_restricted`). Absent otherwise. |
| `share` | `OrganisationDiagramShare` | yes | Its public link while the organisation shares it, or null. Only a diagram someone chose to share has one. |
| `share.url` | `string` | yes | The public address, `{CDN_URL}/l/<token>.svg`. Anyone with it can see the picture, without its source. It keeps showing the latest version when the diagram is edited, and never changes. |
| `share.sharedAt` | `integer` | yes | When the diagram was first shared, in milliseconds since the epoch. |
| `kept` | `boolean` | yes | "Keep": true when an owner or admin keeps it from the library retention. The plan's own retention still applies. |
| `deletesAt` | `integer \| null` | yes | When the retention deletes it, in milliseconds since the epoch: the nearer of the plan's expiry and "Delete library diagrams not updated for". Null when nothing will, and always null under a legal hold. |
| `classification` | `Classification` | yes | A diagram's classification label: `public`, `internal` (the default, and what a diagram published before labels reads as) or `confidential`. Confidential is never shared publicly; under "Share only diagrams labelled Public" only public is. |
| `pending` | `boolean` | yes | True while it is held for approval ("Publishing needs approval"): only its publisher and the approvers see it. |
| `changePending` | `boolean` | yes | True while a new version of it waits for approval. The library shows this version until then. |
| `series` | `DiagramSeries` | yes | Its place in a series (the parts of one split import), or null when it is in none. |
| `series.id` | `string` | yes | The series id the parts were published with. |
| `series.index` | `integer` | yes | Its place in the series, from 1; 0 is the whole import combined into one diagram. |
| `series.total` | `integer \| null` | yes | How many parts the publisher said the series has, or null. |

## 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 |
