Skip to main content
Pinecone Docs
current

Search documentation

Type to search this documentation.

Fetch records by metadata

Look up and return records by metadata from a single namespace. The returned records include the vector data and metadata.

For guidance and examples, see Fetch data.

curl
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/manage-data/target-an-index
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"

curl -X POST "https://$INDEX_HOST/vectors/fetch_by_metadata" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Pinecone-Api-Version: 2026-07" \
  -d '{
    "namespace": "__default__",
    "filter": {"genre": {"$eq": "Action/Adventure"}},
    "limit": 2
  }'

POST /vectors/fetch_by_metadata

200
{
  "namespace": "example-namespace",
  "pagination": {
    "next": "Tm90aGluZyB0byBzZWUgaGVyZQo="
  },
  "usage": {
    "egressBytes": 1024,
    "readUnits": 5
  },
  "vectors": {
    "id-1": {
      "id": "id-1",
      "metadata": {
        "genre": "documentary",
        "year": 2019
      },
      "values": [
        1,
        1.5
      ]
    },
    "id-2": {
      "id": "id-2",
      "metadata": {
        "genre": "comedy",
        "year": 2019
      },
      "values": [
        2,
        1
      ]
    }
  }
}
400
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
4XX
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
5XX
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
Api-Keystringrequired

An API Key is required to call Pinecone APIs. Get yours from the console.

X-Pinecone-Api-Versionstringrequired

Required date-based version header

Typestring
Default2026-07
namespace?string

The namespace to fetch records from.

Example: example-namespace

Typestring
filterobjectrequired

Metadata filter expression to select vectors. See Understanding metadata.

limit?integer

The maximum number of records to return per page. Defaults to 100.

Required range: 1 <= x <= 10000. Example: 12

Typeinteger
Default100
paginationToken?string

Pagination token to continue a previous listing operation.

Example: Tm90aGluZyB0byBzZWUgaGVyZQo=

Typestring

200 — A successful response.

The response for the fetch_by_metadata operation.

vectors?object

The fetched vectors, in the form of a map between the fetched ids and the fetched vectors

Typeobject
namespace?string

The namespace that served the fetch: the request's namespace, or the alias's target namespace when the request named a namespace alias.

Example: example-namespace

Typestring
usage?object
Show child attributes
readUnits?integer

The number of read units consumed by this operation.

Example: 5

Typeinteger
egressBytes?integer

The billed egress for this response, in bytes. Measured on the encoded response payload.

Required range: 0 <= x. Example: 1024

Typeinteger
pagination?object
Show child attributes
nextstringrequired

Example: Tm90aGluZyB0byBzZWUgaGVyZQo=

Typestring
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu