# Company library API

> Company library in the Broker & Agent API: list the company library; get one thing in the company library.

Base URL: `https://workspace.brokerandagent.com/api/public/v1`. Every call needs an [API key or OAuth token](https://brokerandagent.com/developers/api/authentication).

- [List the company library](#list-the-company-library): `GET /library`
- [Get one thing in the company library](#get-one-thing-in-the-company-library): `GET /library/{kind}/{id}`

## List the company library

`GET /library`

Read-only: the email and text templates, automations, design templates and office checklists held at the company or at a region, office or team that reach the credential's person, plus their own not sent anywhere yet, each with where it's held and whether it's locked. Also the places this person may send things to. Sending stays in the app. Not for a transaction coordinator login.

Scope: `crm.read`

```bash
curl https://workspace.brokerandagent.com/api/public/v1/library \
  -H "Authorization: Bearer bak_YOUR_KEY"
```

**Responses**

| Status | | Returns |
|---|---|---|
| `200` | The library. | { `items`: array of [LibraryItem](https://brokerandagent.com/developers/api/reference/objects#libraryitem), `places`: array of [LibraryPlace](https://brokerandagent.com/developers/api/reference/objects#libraryplace), `formsHeld`: string } |
| `401` | No credential, or one that's unknown, expired or revoked (unauthorized); or the workspace is suspended (workspace_suspended). |  |
| `403` | The credential lacks the scope (insufficient_scope, naming it in `scope`), the record isn't the person's to change (forbidden), the connection wasn't granted that workspace (workspace_not_granted), or an assistant-only token called outside the assistant's tools (wrong_audience). |  |
| `429` | Too many requests for this credential; wait for Retry-After (rate_limited). |  |

## Get one thing in the company library

`GET /library/{kind}/{id}`

One item of the library by its kind (email, automation, design or checklist) and id, as the list shows it: 404 when it isn't one the credential's person's library holds.

Scope: `crm.read`

**Parameters**

| Name | In | Type | |
|---|---|---|---|
| `kind` (required) | path | string |  |
| `id` (required) | path | string |  |

```bash
curl https://workspace.brokerandagent.com/api/public/v1/library/KIND/ID \
  -H "Authorization: Bearer bak_YOUR_KEY"
```

**Responses**

| Status | | Returns |
|---|---|---|
| `200` | The item. | { `item`: [LibraryItem](https://brokerandagent.com/developers/api/reference/objects#libraryitem) } |
| `401` | No credential, or one that's unknown, expired or revoked (unauthorized); or the workspace is suspended (workspace_suspended). |  |
| `403` | The credential lacks the scope (insufficient_scope, naming it in `scope`), the record isn't the person's to change (forbidden), the connection wasn't granted that workspace (workspace_not_granted), or an assistant-only token called outside the assistant's tools (wrong_audience). |  |
| `404` | No such record, or one the credential's person can't see (not_found). |  |
| `429` | Too many requests for this credential; wait for Retry-After (rate_limited). |  |

---

Source: https://brokerandagent.com/developers/api/reference/company-library
