---
title: "Add a library"
method: POST
path: "/v2/teamspaces/{teamspaceId}/libraries"
tags: ["Teamspace Libraries"]
---

# Add a library

`POST /v2/teamspaces/{teamspaceId}/libraries`

## Request

- Base URL: `https://context7.com/api`
- URL: `https://context7.com/api/v2/teamspaces/{teamspaceId}/libraries`
- Auth: HTTP bearer

Submit a source for parsing; `source` selects its kind. Any member can add a public source; it does not join the teamspace. A private source (`private: true`, Confluence, Notion) joins this teamspace and needs the owner or admin role. The call returns once the parse has started (up to about 30 seconds); poll the library details for its state.

## Path parameters

- `teamspaceId` string, uuid, required

## Request body

- union: The library source. File uploads (PDF, DOCX, files, OpenAPI files) are not available here; upload them in the dashboard.
  - TeamspaceLibraryRepoSource
    - `source` 'github' | 'gitlab' | 'bitbucket' | 'git', required: `git` is any other Git host (self-hosted).
    - `docsRepoUrl` string, uri, required: Repository URL.
    - `private` boolean: Add as a private source of this teamspace. Needs the owner or admin role and a paid plan. The token comes from `gitToken`, or from the GitHub, GitLab or Bitbucket account connected in the dashboard. `git` needs `gitToken`.
    - `gitToken` string: Personal access token for a private repository.
    - `skipVersionFiltering` boolean: Keep pages that look version-specific (private repositories).
    - `generateDocs` boolean: Generate documentation from the source code (private repositories).
  - TeamspaceLibraryWebsiteSource
    - `source` 'website', required
    - `websiteUrl` string, uri, required: Documentation website to crawl.
    - `websiteBaseUrl` string, uri: Only crawl pages under this URL.
  - TeamspaceLibraryLlmsTxtSource
    - `source` 'llmstxt', required
    - `llmstxtUrl` string, uri, required
  - TeamspaceLibraryOpenApiSource
    - `source` 'openapi', required
    - `openApiUrl` string, uri, required
  - TeamspaceLibraryConfluenceSource: A Confluence space, added as a private source. Needs the owner or admin role and a Confluence account connected in the dashboard.
    - `source` 'confluence', required
    - `cloudId` string, required
    - `siteUrl` string, uri, required
    - `spaceKey` string, required
    - `spaceName` string, required
    - `pageIds` string[]: Only these pages. Omit for the whole space.
    - `title` string, required
    - `description` string, required
  - TeamspaceLibraryNotionSource: Notion pages, added as a private source. Needs the owner or admin role and a Notion account connected in the dashboard.
    - `source` 'notion', required
    - `workspaceId` string, required
    - `workspaceName` string, required
    - `pageIds` string[], required
    - `title` string, required
    - `description` string, required

## Response `200`

Library submitted successfully for processing

- AddLibraryResponse: Response after successfully submitting a library
  - `libraryName` string, required: The library identifier assigned — the URL path of the library on context7.com. `/owner/repo` for GitHub repositories, or `/<source>/<id>` for other sources (e.g., `/vercel/next.js`, `/websites/uploadcare_com`). See [Library ID format](/api-guide#library-id-format).
  - `version` string: Only for websites: the version the URL was added as, when it is a version of an existing library. Request it as `<libraryName>/<version>`.
  - `message` string, required: Human-readable success message

## Other responses

- `400`: Invalid body, or an unsupported `source`
- `401`: Unauthorized - Invalid or missing API key
- `403`: The caller cannot access this teamspace, the API key belongs to another teamspace, or the caller's role is too low
- `409`: The private source is already in the teamspace, the needed account (GitHub, GitLab, Bitbucket, Confluence, Notion) is not connected in the dashboard, or the token was refused
- `422`: Unprocessable Entity - Library is too large or has no code
- `429`: Too Many Requests - Rate limit exceeded
- `500`: Internal Server Error
- `504`: Gateway Timeout - Processing timed out waiting for logs

## Changes

- **2026-10-26** `86c04930b016`: 1 info
  - added the optional property `version` to the response with the `200` status
- **2026-10-22** `e17589fd8767`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/context7/apis/context7-public-api/changes/v2/teamspaces/:teamspaceId/libraries/post.md)

---

[API](https://skmtc.dev/context7/apis/context7-public-api.md) - [All operations](https://skmtc.dev/context7/apis/context7-public-api/llms.txt) - [OpenAPI document](https://skmtc.dev/context7/apis/context7-public-api/revisions/945f7834fa8c?raw)
