# Get library

URL: https://docs.hanzo.ai/docs/openapi/library/get-library-by-id

> Reads one item with fresh signed URLs.

`GET /v1/library/{id}`

> [Library →](https://docs.hanzo.ai/docs/openapi/library) · [All API references →](https://docs.hanzo.ai/docs/openapi) · [Get started →](https://docs.hanzo.ai/docs/guides)

|               |                                        |
| ------------- | -------------------------------------- |
| **Address**   | `https://api.hanzo.ai/v1/library/{id}` |
| **Method**    | `GET`                                  |
| **Operation** | `get_library_by_id`                    |
| **Auth**      | `Authorization: Bearer $HANZO_API_KEY` |

Reads one item with fresh signed URLs. An item that is not yours and
was not shared with your organization answers 404, as one that does not exist.

## Request

1 field.

| Field | In   | Type   | Required | Description                    |
| ----- | ---- | ------ | -------- | ------------------------------ |
| `id`  | path | string | yes      | ID is the item, from the path. |

## Response

| Status    | Body                | Meaning |
| --------- | ------------------- | ------- |
| `200`     | library.LibraryItem | ok      |
| `default` | problem-details     | refused |

`200` body — 29 fields.

| Field                    | In   | Type                  | Always | Description                                                                                                               |
| ------------------------ | ---- | --------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| `by`                     | body | string                | —      | By is the owner as a reader names them: the name, else the address, the identity boundary carried when the item was made. |
| `bytes`                  | body | integer (int64)       | —      |                                                                                                                           |
| `created`                | body | string                | —      |                                                                                                                           |
| `download`               | body | string                | —      |                                                                                                                           |
| `expires`                | body | string                | —      |                                                                                                                           |
| `height`                 | body | integer (int64)       | —      |                                                                                                                           |
| `id`                     | body | string                | —      |                                                                                                                           |
| `kind`                   | body | string                | —      |                                                                                                                           |
| `mime`                   | body | string                | —      |                                                                                                                           |
| `mine`                   | body | boolean               | —      |                                                                                                                           |
| `name`                   | body | string                | —      |                                                                                                                           |
| `origin`                 | body | string                | —      |                                                                                                                           |
| `owner`                  | body | string                | —      |                                                                                                                           |
| `pages`                  | body | integer (int64)       | —      |                                                                                                                           |
| `preview`                | body | string                | —      |                                                                                                                           |
| `project`                | body | string                | —      |                                                                                                                           |
| `ref`                    | body | string                | —      |                                                                                                                           |
| `seconds`                | body | number (double)       | —      |                                                                                                                           |
| `shared`                 | body | boolean               | —      |                                                                                                                           |
| `source`                 | body | string                | —      |                                                                                                                           |
| `updated`                | body | string                | —      |                                                                                                                           |
| `upload`                 | body | library.LibraryUpload | —      |                                                                                                                           |
| `upload.expires`         | body | string                | —      |                                                                                                                           |
| `upload.headers`         | body | library.Field\[]      | —      | Headers are the ones the PUT must carry.                                                                                  |
| `upload.headers[].name`  | body | string                | —      | Name is the field's name.                                                                                                 |
| `upload.headers[].value` | body | string                | —      | Value is the field's value, verbatim.                                                                                     |
| `upload.url`             | body | string                | —      |                                                                                                                           |
| `url`                    | body | string                | —      |                                                                                                                           |
| `width`                  | body | integer (int64)       | —      |                                                                                                                           |

Failure carries the platform error shape — see [Errors](https://docs.hanzo.ai/docs/errors).

## Examples

**CLI**

```bash
hanzo library get <id>
```

**SDK**

**.ts**

```ts
import { Configuration, LibraryApi } from 'hanzoai';

const api = new LibraryApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getLibraryById({ id: 'id' });
```

**.py**

```python
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import LibraryApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = LibraryApi(client).get_library_by_id(id='id')
```

**.go**

```go
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.LibraryAPI.GetLibraryById(context.Background()).Execute()
if err != nil {
	return err
}
```

**.rs**

```rust
use hanzo_client::apis::{configuration::Configuration, library_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = library_api::get_library_by_id(&cfg, Default::default()).await?;
```

**.java**

```java
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.LibraryApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new LibraryApi(client).getLibraryById();
```

**HTTP**

```bash
curl https://api.hanzo.ai/v1/library/<id> \
  -H "Authorization: Bearer $HANZO_API_KEY"
```

**MCP**

Tool `library`, op `get_library_by_id` — POST the JSON-RPC envelope to `https://api.hanzo.ai/v1/mcp`.

```bash
curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "library",
         "arguments": {
           "op": "get_library_by_id",
           "input": {
             "id": "<id>"
           }
         }
       }
     }'
```

---

[Library API](https://docs.hanzo.ai/docs/openapi/library) · [All Hanzo APIs](https://docs.hanzo.ai/docs/openapi) · [Interactive reference](https://docs.hanzo.ai/docs/openapi/reference)
