# Upsert data into an AI Search index

Launch stage: Public Preview

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

Upsert rows into a Direct Access AI Search index.

API scopes: ai-search

## Path parameters

- `name` (string, required)
  Full resource name of the index. Must be a Direct Access index.
   Format: `workspaces/{workspace_id}/endpoints/{endpoint_id}/indexes/{index_id}`

## Request body

- `inputs_json` (string, required)
  JSON document describing the rows to upsert.

## Returns

- `status` (string, optional, Output only)
  Overall status of the upsert.
  Possible values:
  - `SUCCESS`
  - `PARTIAL_SUCCESS`
  - `FAILURE`
- `result` (object, optional, Output only)
  Per-row outcome of the upsert.
  - `success_row_count` (int64, optional, Output only)
    Count of rows processed successfully.
  - `failed_primary_keys` (array of string, optional, Output only)
    Primary keys of rows that failed to process.

## Response

```json
{
  "status": "string",
  "result": {
    "success_row_count": 0,
    "failed_primary_keys": [
      "string"
    ]
  }
}
```

