> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-fix-issues-on-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Fetch Vectors

> This endpoint returns the data related to the vectors with the provided IDs.

## Request

<ParamField body="ids" type="string[]" required>
  The ID of the vector
</ParamField>

<ParamField body="includeMetadata" type="boolean">
  Whether to include the metadata of the vectors in the response. Setting this
  `true` would be the best practice, since it will make it easier to identify
  the vectors.
</ParamField>

<ParamField body="includeVectors" type="boolean">
  Whether to include the vector data of the resulting vectors.
</ParamField>

## Response

<ResponseField name="FetchVectors" type="Array">
  It returns the data related to provided vectors ids in sorted manner. Object
  is `null` if the vector related to that ID couldn't be found.

  <Expandable defaultOpen="true">
    <ResponseField name="id" type="string" required>
      The ID of the resulting vector. <br />
    </ResponseField>

    <ResponseField name="vector" type="number[]">
      The resulting vector.
    </ResponseField>

    <ResponseField name="metadata" type="Object">
      The metadata of the vector. This is used to make it easier to identify the
      vector on queries.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```sh curl
  curl https://hardy-cricket-48359-us1-vector.upstash.io/fetch \
    -H "Authorization: Bearer ABcFMGhhcmR5LWNyaWNrZXQtNDgzNTktdXMxYWRtaW5PREE0TkdVME5XUXRaV0poTWkwME9UVTFMVGxrTm1NdE9USTROR0ppWkRsak56ZGs=" \
    -d '{ "ids": ["1", "2", "abcde"],
    "includeVectors": false,
    "includeMetadata": true }'
  ```

  ```js Node
  const url = "https://better-dodo-20522-us1-vector.upstash.io/fetch"; // Replace with your index endpoint.
  const token = "YOUR_TOKEN"; // Replace with your actual token
  const data = {
    ids: ["1", "2", "abcde"],
    includeVectors: false,
    includeMetadata: true,
  };

  fetch(url, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${token}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify(data),
  })
    .then((response) => response.json())
    .then((data) => console.log(data))
    .catch((error) => console.error("Error:", error));
  ```

  ```python Python
  import requests
  import json

  url = 'https://better-dodo-20522-us1-vector.upstash.io/fetch' # Replace with your index endpoint.
  token = 'YOUR_TOKEN' # Replace with your actual token
  headers = {
      'Authorization': f'Bearer {token}',
      'Content-Type': 'application/json'
  }
  data = {
      'ids': ["1", "2", "abcde"],
      includeVectors: False,
      includeMetadata: True
  }

  response = requests.post(url, headers=headers, data=json.dumps(data))
  print(response.json())
  ```
</RequestExample>

<ResponseExample>
  ```json Response
  {
  	"result" : [ 
  		{
  		    "id" : "1",
  		    "metadata" : {"genre":"comedy","year":2020}
  	  	},
  	   	{
  		    "id" : "2",
  		    "metadata" : {"genre":"comedy","year":2020}
  	  	}, 
  		null 
  	]
  }
  ```
</ResponseExample>
