# Create an AI Search endpoint

Launch stage: Public Preview

`POST /api/2.0/ai-search/{parent=workspaces/*}/endpoints`

Create a new AI Search endpoint.

API scopes: ai-search

## Path parameters

- `parent` (string, required)
  The Workspace where this Endpoint will be created.
   Format: `workspaces/{workspace_id}`

## Query parameters

- `endpoint_id` (string, optional)
  The user-supplied short name for the Endpoint, per AIP-133. The server composes the
   full `Endpoint.name` as `{parent}/endpoints/{endpoint_id}`. AIP-133 does not list
   `endpoint_id` as a fields-may-be-required entry, so we annotate it OPTIONAL on the
   wire; the server still rejects empty values with INVALID_PARAMETER_VALUE.

## Request body

The Endpoint resource to create. Fields other than `endpoint.name` carry the desired
 configuration; `endpoint.name` is server-assigned from `parent` and `endpoint_id`.
- `name` (string, optional)
  Name of the AI Search endpoint. Server-assigned full resource path
   (`workspaces/{workspace}/endpoints/{endpoint}`) on output. On create, the
   user-supplied short name is conveyed via `CreateEndpointRequest.endpoint_id`;
   the server composes the full `name` and returns it on the response.
  Example: `docs-endpoint`
- `endpoint_type` (string, required, Immutable)
  Type of endpoint. Required on create and immutable thereafter.
  Possible values:
  - `STORAGE_OPTIMIZED`
  - `STANDARD`
- `budget_policy_id` (string, optional)
  The user-selected budget policy id for the endpoint.
- `custom_tags` (array of object, optional)
  The custom tags assigned to the endpoint
  - `key` (string, required)
    Key field for an AI Search endpoint tag.
  - `value` (string, optional)
    [Optional] Value field for an AI Search endpoint tag.
- `usage_policy_id` (string, optional)
  The usage policy id applied to the endpoint.
- `replica_count` (int32, optional)
  The client-supplied desired number of replicas for the endpoint, applied at
   create/update time. Mutually exclusive with `target_qps`.
- `target_qps` (int32, optional)
  Target QPS for the endpoint. Mutually exclusive with `replica_count`. Best-effort;
   the system does not guarantee this QPS will be achieved.

## Returns

Returns the Endpoint object.

## Response

```json
{
  "name": "docs-endpoint",
  "creator": "john@example.com",
  "create_time": "2023-12-08T05:31:52.061Z",
  "update_time": "2023-12-08T05:31:52.061Z",
  "endpoint_type": "string",
  "last_updated_user": "john@example.com",
  "id": "c56bf0a9-4929-4bd4-8bd5-d82ca62f9c76",
  "endpoint_status": {
    "state": "PROVISIONING",
    "message": "string"
  },
  "index_count": 0,
  "budget_policy_id": "string",
  "effective_budget_policy_id": "8b0444ff-8b60-48b0-9d31-e391f6126e0f",
  "custom_tags": [
    {
      "key": "string",
      "value": "string"
    }
  ],
  "throughput_info": {
    "requested_concurrency": 10,
    "current_concurrency": 8,
    "current_concurrency_utilization_percentage": 75.5,
    "minimal_concurrency_allowed": 2,
    "maximum_concurrency_allowed": 140,
    "change_request_state": "CHANGE_SUCCESS",
    "change_request_message": "Throughput successfully adjusted to 10 vCPUs",
    "requested_num_replicas": 2,
    "current_num_replicas": 1
  },
  "scaling_info": {
    "state": "SCALING_CHANGE_APPLIED",
    "requested_target_qps": 500
  },
  "usage_policy_id": "string",
  "replica_count": 0,
  "target_qps": 0
}
```

