---
title: "Add a library to a project"
method: POST
path: "/projects/{project_id}/libraries/{library_id}"
tags: ["Project"]
---

# Add a library to a project

`POST /projects/{project_id}/libraries/{library_id}`

## Request

- Base URL: `https://api.your-domain.com`
- URL: `https://api.your-domain.com/projects/{project_id}/libraries/{library_id}`
- Auth: API key in header `X-API-KEY`
- TypeScript: <https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/docs/projects/:project_id/libraries/:library_id/post.ts> (a function with typed inputs; its response is checked against the schema)

Enable a library for a project by creating an association.

## Path parameters

- `project_id` integer, required
- `library_id` integer, required

## Query parameters

- `cookie_name` string, nullable

## Response `201`

Successful Response

- ProjectLibrary
  - `created_at` string, date-time: UTC timestamp when the record was created.
  - `updated_at` string, date-time: UTC timestamp when the record was last updated.
  - `creator_user_id` integer, required: ID of the user who created the record.
  - `updater_user_id` integer, nullable: ID of the user who last updated the record, if any.
  - `project_id` integer, required: ID of the project.
  - `library_id` integer, required: ID of the library linked to the project.

## Other responses

- `401`: Missing or invalid authentication.
- `403`: Current user lacks access to the library or the project.
- `404`: Library or project not found.
- `422`: Validation Error

---

[API](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api.md) - [All operations](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/llms.txt) - [OpenAPI document](https://skmtc.dev/neulandai/apis/neuland-ai-hub-api/revisions/b53e89b98c2b?raw)
