# stensul-get-libraries

> Lists libraries, or returns everything needed to work in one: its modules, variations, Segment Set support, languages, tags and which email settings it enables.

Source: https://stensul.com/developers/reference/stensul-get-libraries/ · From the live server's tool list, 2026-09-28

- Scope: `libraries:read`
- Access: read

Call it with no key to browse. Call it with `library_key` or `library_id` before building, because the library decides which settings fields are allowed (`subject_line_enabled`, `preheader_enabled`, `title_enabled`) and their character caps.

## Inputs

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `library_key` | string | no | Library key, for example `acme_newsletters`. Returns that library's full context. |
| `library_id` | string (24-char hex id) | no | Library ID. Returns that library's full context. |
| `name` | string | no | List mode only: filter by library name. |
| `page_number` | integer ≥ 1 | no | List mode only: page number. |
| `page_size` | integer 1–30 | no | List mode only: results per page (max 30, default 15). |
| `sort` | string | no | List mode only: `name`, `created_at` or `updated_at`; prefix `-` for descending. |

## Example request

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "stensul-get-libraries",
    "arguments": {
      "library_key": "acme_newsletters"
    }
  }
}
```

## Response

List mode: a page of libraries. Library mode: the module inventory (by role, and as ordered keys with the variations each implements), the variations mode (`all` or `individual`) and named variations, `dca_segment_sets.supported`, supported languages, tags, enabled settings fields and their length caps.

## Errors

| Status | Message | Cause | Fix |
| --- | --- | --- | --- |
| 401 | Authentication expired or missing | The session's authorization expired. | Sign in again when the host prompts. On a 401 or 403, the server's instructions tell the model to re-check sign-in first. |
| 403 | Insufficient OAuth scope (403): The token lacks the required scope | The API connection doesn't have the scope this tool needs. | An admin adds the scope to the API connection. Then sign in again: adding a scope revokes existing tokens. |
| 403 | API error (403): Action is unauthorized. | The signed-in user's role lacks the permission, for example `edit_campaign`. | Grant the permission to the user's role in Admin > Users & Roles. It works for other users on the same connection. |
