# Save a tab to the organisation library

> Page: https://docs.plotwork.dev/api/post-orgs-org-boards-board-tabs-tab-save. Index of every page: https://docs.plotwork.dev/llms.txt

Saves a tab as a new library diagram (new) or as a new version of the one it is linked to (linked), through the library publish and save: folder rules, label, secret scan, size and approval apply, and approval may hold it (status held).

`POST /orgs/{org}/boards/{board}/tabs/{tab}/save`

## TL;DR

| Question | Answer |
|---|---|
| What does it do? | Save a tab to the organisation library. |
| What does it take? | A JSON body of type [`SaveBoardTabBody`](https://docs.plotwork.dev/api/schemas.md#saveboardtabbody). |
| What does it return? | Status 200 with a body of type [`SaveBoardTabResult`](https://docs.plotwork.dev/api/schemas.md#saveboardtabresult). |
| What can go wrong? | `400` the body is not valid; `401` not signed in; `403` boards are not on (boards.not_enabled), the caller may not change the board or the folder (boards.forbidden, orgs.folder_restricted), or the picture does not fit the plan (hosting.quota_exceeded); `404` no such organisation, board or tab, or the board is not open to the caller: the cases look alike; `409` the tab is not linked (boards.not_linked), the library diagram changed since (diagram.version_conflict) or is locked (hosting.diagram_locked); `413` the picture is larger than the plan allows; `422` the source has errors, or holds a secret the organisation blocks; `429` too many requests; `502` the diagram could not be stored; `503` organisations or boards are not set up on this server. Every failure uses the one error envelope. |

## What it does

Saves a tab as a new library diagram (new) or as a new version of the one it is linked to (linked), through the library publish and save: folder rules, label, secret scan, size and approval apply, and approval may hold it (status held). 409 diagram.version_conflict when the library diagram was saved since the version sent.

## Path parameters

| Field | Type | Required | Description |
|---|---|---|---|
| `org` | `string` | yes | The organisation's id or its slug. |
| `board` | `string` | yes | The board's id: 22 letters and digits. |
| `tab` | `string` | yes | The tab's id: 12 letters and digits. |

## Request body

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

| Field | Type | Required | Description |
|---|---|---|---|
| `to` | `"new" \| "linked"` | yes | new: a new library diagram. linked: a new version of the library diagram the tab is linked to. |
| `name` | `string` | no | at least 1 character; at most 200 characters. |
| `folder` | `string \| null` | no | at most 200 characters. |
| `libraryVersion` | `integer` | no | For linked: the library diagram's version the tab last saw. Left out, the tab's own link. minimum 0. |

## Responses

| Status | Meaning | Body |
|---|---|---|
| 200 | The library diagram and the tab. | [`SaveBoardTabResult`](https://docs.plotwork.dev/api/schemas.md#saveboardtabresult) |
| 400 | The body is not valid. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 401 | Not signed in. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 403 | Boards are not on (boards.not_enabled), the caller may not change the board or the folder (boards.forbidden, orgs.folder_restricted), or the picture does not fit the plan (hosting.quota_exceeded). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 404 | No such organisation, board or tab, or the board is not open to the caller: the cases look alike. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 409 | The tab is not linked (boards.not_linked), the library diagram changed since (diagram.version_conflict) or is locked (hosting.diagram_locked). | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 413 | The picture is larger than the plan allows. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 422 | The source has errors, or holds a secret the organisation blocks. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 429 | Too many requests. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 502 | The diagram could not be stored. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |
| 503 | Organisations or boards are not set up on this server. | [`ErrorResponse`](https://docs.plotwork.dev/api/schemas.md#errorresponse) |

## Response body

A 200 answer has the type [`SaveBoardTabResult`](https://docs.plotwork.dev/api/schemas.md#saveboardtabresult).

| Field | Type | Required | Description |
|---|---|---|---|
| `diagram` | `object` | yes |  |
| `diagram.id` | `string` | yes |  |
| `diagram.name` | `string \| null` | yes |  |
| `diagram.version` | `integer` | yes |  |
| `status` | `"saved" \| "held" \| "unchanged"` | yes |  |
| `approval` | `object \| null` | yes |  |
| `approval.code` | `string` | yes |  |
| `approval.message` | `string` | yes |  |
| `tab` | `BoardTab` | yes |  |
| `tab.id` | `string` | yes | at least 12 characters; at most 12 characters; pattern `^[0-9A-Za-z]+$`. |
| `tab.name` | `string` | yes |  |
| `tab.kind` | `string` | yes | The kind the source declares, such as flow. |
| `tab.position` | `number` | yes |  |
| `tab.version` | `integer` | yes |  |
| `tab.updatedAt` | `integer` | yes |  |
| `tab.updatedBy` | `string` | yes | Who changed it last: an email address, an agent and its member, or a key name. |
| `tab.library` | `object \| null` | yes |  |
| `tab.library.diagramId` | `string` | yes |  |
| `tab.library.version` | `integer` | yes |  |
| `tab.library.saved` | `boolean` | yes | True while the tab holds what was saved or imported. |

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