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

# Fetch Random Vector

> This endpoint fetches a random vector. Returns null if the index is empty.

## Request

This endpoint doesn't require any additional data.

## Response

The response is `null` if the index is empty.

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

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

<RequestExample>
  ```sh curl
  curl https://hardy-cricket-48359-us1-vector.upstash.io/random \
    -H "Authorization: Bearer <YOUR_TOKEN>" \
  ```

  ```js Node
  const url = "https://better-dodo-20522-us1-vector.upstash.io/random"; // Replace with your index endpoint.
  const token = "YOUR_TOKEN"; // Replace with your actual token

  fetch(url, {
    method: "GET",
    headers: {
      Authorization: `Bearer ${token}`,
    },
  })
    .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/random' # Replace with your index endpoint.
  token = 'YOUR_TOKEN' # Replace with your actual token
  headers = {
      'Authorization': f'Bearer {token}',
  }

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

<ResponseExample>
  ```json Response
  {
    "result" : {
      "id" : "1",
      "vector" : [0.1, 0.2, 0.3]
    }
  }
  ```
</ResponseExample>
