---
title: "Get documentation context"
method: GET
path: "/v2/context"
tags: ["Context"]
---

# Get documentation context

`GET /v2/context`

Retrieve intelligent, LLM-reranked documentation context for natural language queries. Returns the most relevant code snippets and documentation for your specific question.

## Query parameters

- `libraryId` string, required
- `query` string, required
- `type` 'json' | 'txt'
- `fast` 'true' | 'false'

## Response `200`

Documentation context

- ContextResponse — Documentation context response
  - `codeSnippets` CodeSnippet[], required — Relevant code snippets
    - `codeTitle` string, required — Title of the code snippet
    - `codeDescription` string, required — Description of what the code does
    - `codeLanguage` string, required — Primary programming language
    - `codeTokens` integer, required — Token count for the snippet
    - `codeId` string, required — URL to source location
    - `pageTitle` string, required — Title of the documentation page
    - `codeList` CodeExample[], required — Code examples in different languages
      - `language` string, required — Programming language
      - `code` string, required — The actual code content
    - `isDynamic` boolean — Whether this snippet was recovered from the dynamic source-code index instead of the primary docs index
    - `sourceFile` string — Repo-relative source file path for dynamic snippets
  - `infoSnippets` InfoSnippet[], required — Relevant documentation snippets
    - `pageId` string — URL to source page
    - `breadcrumb` string — Navigation breadcrumb path
    - `content` string, required — The documentation content
    - `contentTokens` integer, required — Token count for the content
  - `rules` object — Optional library-specific rules and guidelines
    - `global` string[] — Global team rules
    - `libraryOwn` string[] — Rules defined by the library owner
    - `libraryTeam` string[] — Library-specific rules from the team

## Other responses

- `202` — Accepted - Library not yet finalized
- `301` — Moved Permanently - Library has been redirected
- `400` — Bad Request - Invalid input parameters
- `401` — Unauthorized - Invalid or missing API key
- `402` — Payment Required - the teamspace's configured monthly spending limit has been reached. A teamspace owner or admin can raise the limit in billing settings, or the cap will reset at the start of the next billing month.
- `403` — Forbidden - Insufficient permissions or plan restrictions
- `404` — Not Found - Resource doesn't exist
- `422` — Unprocessable Entity - Library is too large or has no code
- `429` — Too Many Requests - Rate limit exceeded
- `500` — Internal Server Error

---

[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-service-production.skmtc.workers.dev/v1/apis/context7/context7-public-api/revisions/5e85fc74bff0/schema)
