# Scan an AI Search index

Launch stage: Public Preview

`POST /api/2.0/ai-search/{name=workspaces/*/endpoints/*/indexes/*}:scan`

Scan (paginate over) the rows of an AI Search index.

API scopes: ai-search

## Path parameters

- `name` (string, required)
  Full resource name of the index to scan.
   Format: `workspaces/{workspace_id}/endpoints/{endpoint_id}/indexes/{index_id}`

## Request body

- `page_size` (int32, optional)
  Maximum number of rows to return in this page. Defaults to 10.
- `page_token` (string, optional)
  Page token from a previous response; if unset, scanning starts from the beginning.

## Returns

- `data` (array of object, optional, Output only)
  Rows in this page, ordered by primary key. Each row is a JSON object that maps column names to
   values.
- `next_page_token` (string, optional, Output only)
  Token for the next page; empty when the scan is exhausted.

## Request

### Scan the next page of two rows

```json
{
  "page_size": 2,
  "page_token": "100"
}
```

## Response

### Page of two rows

```json
{
  "data": [
    {
      "id": 101,
      "question": "How do I reset my password?",
      "answer": "Open Settings, choose Security, and select Reset password.",
      "answer_vector": [
        0.12,
        0.47,
        -0.08
      ]
    },
    {
      "id": 102,
      "question": "Where can I download invoices?",
      "answer": "Invoices are listed under Billing in the account console.",
      "answer_vector": [
        0.31,
        -0.22,
        0.05
      ]
    }
  ],
  "next_page_token": "102"
}
```

