# Source: https://upstash.com/docs/vector/api/endpoints/fetch-random.md

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

# Fetch Random Vector

> Fetches a random vector.

## Request

This endpoint doesn't require any additional data.

## Path

<ParamField path="namespace" type="string" default="">
  The namespace to use.
  When no namespace is specified, the default namespace will be used.
</ParamField>

## Response

The response will be `null` if the namespace is empty.

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

<ResponseField name="vector" type="number[]">
  The dense vector value for dense and hybrid indexes.
</ResponseField>

<ResponseField name="sparseVector" type="Object[]">
  The sparse vector value for sparse and hybrid indexes.

  <Expandable defaultOpen="true">
    <ResponseField name="indices" type="number[]">
      Indices of the non-zero valued dimensions.
    </ResponseField>

    <ResponseField name="values" type="number[]">
      Values of the non-zero valued dimensions.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```sh curl theme={"system"}
  curl $UPSTASH_VECTOR_REST_URL/random \
    -H "Authorization: Bearer $UPSTASH_VECTOR_REST_TOKEN"
  ```

  ```sh curl (Namespace) theme={"system"}
  curl $UPSTASH_VECTOR_REST_URL/random/ns \
    -H "Authorization: Bearer $UPSTASH_VECTOR_REST_TOKEN"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={"system"}
  {
      "result": {
          "id": "id-0",
          "vector": [0.1, 0.2]
      }
  }
  ```
</ResponseExample>