# Search with a vector

For guidance, examples, and limits, see [Search](/guides/index-data-search-search-overview).

:::code-group
```shell curl
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"

curl "https://$INDEX_HOST/query" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Pinecone-Api-Version: 2026-07" \
  -d '{
    "namespace": "example-namespace",
    "vector": [0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3],
    "filter": {"genre": {"$eq": "documentary"}},
    "topK": 3,
    "includeValues": true
  }'
```
:::

`POST /query`

:::code-group
```json title="200"
{
  "results": [
    {
      "matches": [
        null
      ],
      "namespace": "example-namespace"
    }
  ],
  "matches": [
    {
      "id": "example-vector-1",
      "score": 0.08,
      "values": [
        0.1,
        0.2,
        0.3,
        0.4,
        0.5,
        0.6,
        0.7,
        0.8
      ],
      "sparseValues": {
        "indices": [
          1,
          312,
          822,
          14,
          980
        ],
        "values": [
          0.1,
          0.2,
          0.3,
          0.4,
          0.5
        ]
      },
      "metadata": {
        "genre": "documentary",
        "year": 2019
      }
    }
  ],
  "namespace": "<string>",
  "usage": {
    "readUnits": 5,
    "egressBytes": 1024
  }
}
```

```json title="400"
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
```

```json title="4XX"
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
```

```json title="5XX"
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
```
:::

#### Authorizations

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `Api-Key` | `string` | - |  |

An API Key is required to call Pinecone APIs. Get yours from the [console](https://app.pinecone.io/).

#### Headers

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `X-Pinecone-Api-Version` | `string` | `2026-07` | Required date-based version header |

#### Body

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `namespace?` | `string` | - | The namespace to query. Example: example-namespace |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `topK` | `integer` | - | The number of results to return for each query. Required range: 1 <= x <= 10000. Example: 10 |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `filter?` | `object` | - |  |

The filter to apply. You can use vector metadata to limit your search. See [Understanding metadata](/guides/index-data-indexing-overview#metadata).

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `includeValues?` | `boolean` | `false` | Indicates whether vector values are included in the response. For on-demand indexes, setting this to true may increase latency, especially with higher topK values, because vector values are retrieved from object storage. Unless you need vector values, set this to false for better performance. Example: true |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `includeMetadata?` | `boolean` | `false` | Indicates whether metadata is included in the response as well as the ids. Example: true |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `vector?` | `number[]` | - | The query vector. This should be the same length as the dimension of the index being queried. Each query request can contain only one of the parameters id or vector. Whether vector and sparseVector may be sent together depends on the index: an index that supports only a single query predicate rejects the combination. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `sparseVector?` | `object` | - | Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length. |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `indices` | `integer[]` | - | The indices of the sparse data. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `values` | `number[]` | - | The corresponding values of the sparse data, which must be with the same length as the indices. |
:::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id?` | `string` | - | The unique ID of the vector to be used as a query vector. It is mutually exclusive with both vector forms: a request naming id may not also carry vector or sparseVector. Required string length: 1 - 512. Example: example-vector-1 |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `scanFactor?` | `number` | - | An optimization parameter for IVF dense indexes in dedicated read node indexes. It adjusts how much of the index is scanned to find vector candidates. Range: 0.5 – 4 (default). Keep the default (4.0) for the best search results. If query latency is too high, try lowering this value incrementally (minimum 0.5) to speed up the search at the cost of slightly lower accuracy. This parameter is only supported for dedicated (DRN) dense indexes. Required range: 0.5 <= x <= 4. Example: 2 |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `maxCandidates?` | `integer` | - | An optimization parameter that controls the maximum number of candidate dense vectors to rerank. Reranking computes exact distances to improve recall but increases query latency. Range: top_k – 100000. Keep the default for a balance of recall and latency. Increase this value if recall is too low, or decrease it to reduce latency at the cost of accuracy. This parameter is only supported for dedicated (DRN) dense indexes. Required range: 1 <= x <= 100000. Example: 1000 |

#### Response

`200` — A successful response.

The response for the `query` operation. These are the matches found for a particular query vector. The matches are ordered from most similar to least similar.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| ~~`results?`~~ | `object[]` | - | DEPRECATED. The results of each query. The order is the same as QueryRequest.queries. |

:::::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `matches?` | `object[]` | - | The matches for the vectors. |

::::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id` | `string` | - | This is the vector's unique id. Required string length: 1 - 512. Example: example-vector-1 |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `score?` | `number` | - | This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar. Example: 0.08 |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `values?` | `number[]` | - | This is the vector data, if it is requested. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `sparseValues?` | `object` | - | Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length. |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `indices` | `integer[]` | - | The indices of the sparse data. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `values` | `number[]` | - | The corresponding values of the sparse data, which must be with the same length as the indices. |
:::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `metadata?` | `object` | - | This is the metadata, if it is requested. |
::::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `namespace?` | `string` | - | The namespace for the vectors. Example: example-namespace |
:::::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `matches?` | `object[]` | - | The matches for the vectors. |

::::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `id` | `string` | - | This is the vector's unique id. Required string length: 1 - 512. Example: example-vector-1 |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `score?` | `number` | - | This is a measure of similarity between this vector and the query vector. The higher the score, the more they are similar. Example: 0.08 |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `values?` | `number[]` | - | This is the vector data, if it is requested. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `sparseValues?` | `object` | - | Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length. |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `indices` | `integer[]` | - | The indices of the sparse data. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `values` | `number[]` | - | The corresponding values of the sparse data, which must be with the same length as the indices. |
:::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `metadata?` | `object` | - | This is the metadata, if it is requested. |
::::

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `namespace?` | `string` | - | The namespace that served the query: the request's namespace, or the alias's target namespace when the request named a namespace alias. |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `usage?` | `object` | - |  |

:::accordion{title="Show child attributes"}
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `readUnits?` | `integer` | - | The number of read units consumed by this operation. Example: 5 |

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `egressBytes?` | `integer` | - | The billed egress for this response, in bytes. Measured on the encoded response payload. Required range: 0 <= x. Example: 1024 |
:::

## Related pages

- [Search with text](./database-data-plane-search-records.md)
- [Upsert records](./database-data-plane-upsert.md)
- [Upsert text](./database-data-plane-upsert-records.md)
- [Fetch records](./database-data-plane-fetch.md)
- [Fetch records by metadata](./database-data-plane-fetch-by-metadata.md)
- [Update a record](./database-data-plane-update.md)
- [Delete records](./database-data-plane-delete.md)
- [List record IDs](./database-data-plane-list.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
