# Remove data from an AI Search index

Launch stage: Public Preview

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

Remove rows by primary key from 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

- `primary_keys` (array of string, required)
  Primary keys of the rows to remove.

## Returns

- `status` (string, optional, Output only)
  Overall status of the delete: `SUCCESS` when every row was removed, `PARTIAL_SUCCESS` when
   some rows failed (see `result.failed_primary_keys`), or `FAILURE` when the operation failed.
  Possible values:
  - `SUCCESS`
  - `PARTIAL_SUCCESS`
  - `FAILURE`
- `result` (object, optional, Output only)
  Per-row outcome of the delete.
  - `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.

## Request

### Remove three rows by primary key

```json
{
  "primary_keys": [
    "101",
    "102",
    "103"
  ]
}
```

## Response

### Partial success

```json
{
  "status": "PARTIAL_SUCCESS",
  "result": {
    "success_row_count": 2,
    "failed_primary_keys": [
      "103"
    ]
  }
}
```

