> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pinecone.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch documents

> Fetch documents from a namespace by their IDs. Returns the specified fields for each document.

<Note>
  [Full-text search](/guides/search/full-text-search) is in [public
  preview](/release-notes/feature-availability) and uses API version
  `2026-01.alpha`. APIs may continue to evolve before general availability.
</Note>

Fetches schema-defined documents by ID from a namespace.

<Warning>
  Fetch is **ID-only**. The endpoint does not accept a `filter` parameter — text match operators (`$match_phrase`, `$match_all`, `$match_any`) and metadata filter expressions are rejected with a `400` error. To retrieve documents matching a metadata expression, use [`POST /namespaces/{namespace}/documents/search`](/reference/api/2026-01.alpha/data-plane/search_documents) with a `filter` to get IDs, then fetch by ID.
</Warning>

`include_fields` is optional. When omitted, all stored fields on each document are returned.

<RequestExample>
  ```python Python theme={null}
  # pip install --upgrade pinecone
  import os
  from pinecone import Pinecone

  pc = Pinecone(api_key=os.environ["PINECONE_API_KEY"])
  index = pc.preview.index(name="articles")

  NAMESPACE = "example-namespace"

  response = index.documents.fetch(
      namespace=NAMESPACE,
      ids=["doc1", "doc2"],
      include_fields=["title", "body", "category"],
  )
  for doc_id, doc in response.documents.items():
      print(doc_id, getattr(doc, "title", ""))
  ```

  ```shell curl theme={null}
  PINECONE_API_KEY="YOUR_API_KEY"
  INDEX_HOST="articles-abc123.svc.us-east-1.pinecone.io"
  curl "https://$INDEX_HOST/namespaces/__default__/documents/fetch" \
    -H "Api-Key: $PINECONE_API_KEY" \
    -H "Content-Type: application/json" \
    -H "X-Pinecone-Api-Version: 2026-01.alpha" \
    -d '{
      "ids": ["doc1", "doc2"],
      "include_fields": ["title", "body", "category"]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```jsonc curl theme={null}
  // Status: 200 OK
  {
    "documents": {
      "doc1": {
        "_id": "doc1",
        "title": "Machine learning in 2024",
        "body": "Machine learning models are revolutionizing natural language processing",
        "category": "technology"
      },
      "doc2": {
        "_id": "doc2",
        "title": "Vector databases",
        "body": "Vector databases enable fast similarity search across embeddings",
        "category": "technology"
      }
    },
    "namespace": "__default__",
    "usage": { "read_units": 2 }
  }
  ```
</ResponseExample>


## OpenAPI

````yaml https://raw.githubusercontent.com/pinecone-io/pinecone-api/refs/heads/main/2026-01.alpha/db_data_2026-01.alpha.oas.yaml post /namespaces/{namespace}/documents/fetch
openapi: 3.0.3
info:
  title: Pinecone Data Plane API
  description: >-
    Pinecone is a vector database that makes it easy to search and retrieve
    billions of high-dimensional vectors.
  contact:
    name: Pinecone Support
    url: https://support.pinecone.io
    email: support@pinecone.io
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 2026-01.alpha
servers:
  - url: https://{index_host}
    variables:
      index_host:
        default: unknown
        description: host of the index
security:
  - ApiKeyAuth: []
tags:
  - name: Vector Operations
  - name: Bulk Operations
  - name: Namespace Operations
  - name: Document Operations
externalDocs:
  description: More Pinecone.io API docs
  url: https://docs.pinecone.io/introduction
paths:
  /namespaces/{namespace}/documents/fetch:
    post:
      tags:
        - Document Operations
      summary: Fetch documents
      description: >-
        Fetch documents from a namespace by their IDs. Returns the specified
        fields for each document.
      operationId: fetchDocuments
      parameters:
        - in: header
          name: X-Pinecone-Api-Version
          description: Required date-based version header
          required: true
          schema:
            default: 2026-01.alpha
            type: string
          style: simple
        - in: path
          name: namespace
          description: The namespace to fetch documents from.
          required: true
          schema:
            type: string
          style: simple
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FetchDocumentsRequest'
        required: true
      responses:
        '200':
          description: A successful fetch response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FetchDocumentsResponse'
        '400':
          description: Bad request. The request body included invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
        4XX:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
        5XX:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/rpcStatus'
components:
  schemas:
    FetchDocumentsRequest:
      example:
        ids:
          - doc-1
          - doc-2
        include_fields:
          - title
          - content
      description: The request for the `fetch_documents` operation.
      type: object
      properties:
        ids:
          description: A list of document IDs to fetch.
          type: array
          items:
            type: string
          minItems: 1
          maxItems: 1000
        include_fields:
          description: >-
            The document fields to include in the response. If not specified,
            all fields are returned.
          type: array
          items:
            type: string
      required:
        - ids
    FetchDocumentsResponse:
      example:
        documents:
          doc-1:
            _id: doc-1
            title: Introduction to Machine Learning
        namespace: my-namespace
        usage:
          read_units: 5
      description: The response for the `fetch_documents` operation.
      type: object
      properties:
        documents:
          description: A map of document IDs to their fetched documents.
          type: object
          additionalProperties:
            $ref: '#/components/schemas/FetchedDocumentRecord'
        namespace:
          example: my-namespace
          description: The namespace the documents were fetched from.
          type: string
        usage:
          $ref: '#/components/schemas/DocumentFetchUsage'
      required:
        - documents
        - namespace
        - usage
    rpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    FetchedDocumentRecord:
      example:
        _id: doc-1
        content: Machine learning is a subset of artificial intelligence.
        title: Introduction to Machine Learning
      description: A fetched document containing its ID and field values.
      type: object
      properties:
        _id:
          description: The unique identifier of the document.
          type: string
      required:
        - _id
      additionalProperties: true
    DocumentFetchUsage:
      example:
        read_units: 5
      description: Usage information for the `fetch_documents` operation.
      type: object
      properties:
        read_units:
          example: 5
          description: The number of read units consumed by this operation.
          type: integer
          format: int32
      required:
        - read_units
    protobufAny:
      type: object
      properties:
        typeUrl:
          type: string
        value:
          type: string
          format: byte
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Api-Key
      description: >-
        An API Key is required to call Pinecone APIs. Get yours from the
        [console](https://app.pinecone.io/).

````