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

# Getting started with Serverless AI endpoints: Deploy an nginx server with authentication

export const resource_0 = "endpoint"

Serverless AI lets you deploy and manage endpoints without handling infrastructure yourself. This quickstart shows how to validate basic endpoint functionality with minimal setup. In the web console, the **nginx** quick-start configuration deploys a ready-made example with preconfigured settings.

## Prerequisites

<Tabs group="interfaces">
  <Tab title="Web console">
    * Make sure you are in a [group](/iam/authorization/groups/index) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

    * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas:

      * **Number of virtual machines** (VMs) under **Compute**: make sure that at least one VM is available.
      * **Total number of allocations** under **Virtual Private Cloud**: make sure that at least one allocation is available.

      If necessary, [increase the quotas](/overview/quotas#change-quotas).
  </Tab>

  <Tab title="CLI">
    * [Install and configure](/cli/install) the Nebius AI Cloud CLI.

      Check that your project ID is saved in the Nebius AI Cloud CLI profile configuration:

      ```bash theme={null}
      cat ~/.nebius/config.yaml
      ```

    * Install [jq](https://jqlang.org/) to parse JSON output:

          <CodeGroup>
            ```bash Ubuntu theme={null}
            sudo apt-get install jq
            ```

            ```bash macOS theme={null}
            brew install jq
            ```
          </CodeGroup>

    * Make sure you are in a [group](/iam/authorization/groups/index) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

    * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas:

      * **Number of virtual machines** (VMs) under **Compute**: make sure that at least one VM is available.
      * **Total number of allocations** under **Virtual Private Cloud**: make sure that at least one allocation is available.

      If necessary, [increase the quotas](/overview/quotas#change-quotas).
  </Tab>

  <Tab title="REST API">
    * Get an access token to [authenticate to the REST API](/rest-api/authentication).

    * Make sure you are in a [group](/iam/authorization/groups/index) that has at least the `editor` role within your tenant or project; for example, the default `editors` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.

    * In the [Administration → Limits → Quotas](https://console.nebius.com/quota) section, check the following quotas:

      * **Number of virtual machines** (VMs) under **Compute**: make sure that at least one VM is available.
      * **Total number of allocations** under **Virtual Private Cloud**: make sure that at least one allocation is available.

      If necessary, [increase the quotas](/overview/quotas#change-quotas).
  </Tab>
</Tabs>

## Steps

### Create an endpoint

<Tabs group="interfaces">
  <Tab title="Web console">
    1. In the sidebar, go to <Icon icon="https://mintcdn.com/nebius-ai-cloud/rOlLZ_MFvrheaI-h/_assets/sidebar/serverless-ai.svg?fit=max&auto=format&n=rOlLZ_MFvrheaI-h&q=85&s=4c90b50c6c33e6bff000b87b8e37765a" width="16" height="16" data-path="_assets/sidebar/serverless-ai.svg" /> **Serverless AI** → **Endpoints**.
    2. Select the **nginx** quick start card.
       The quick start configuration autofills the container image, entrypoint command and default settings.
    3. Click **Create endpoint**.

    Wait for the endpoint to start running.
  </Tab>

  <Tab title="CLI">
    Use `nebius ai create` to create a {resource_0} step by step in the terminal. The command prompts you to enter values to pass as parameters, shows the resulting configuration and then creates the {resource_0}.

    1. Create a token for authorization and save it to an environment variable:

       ```bash theme={null}
       export AUTH_TOKEN=$(openssl rand -hex 32)
       ```

       Use this token in the `--token` parameter when you create the endpoint. You will also need it later to test access to the endpoint.

    2. Run the following command:

       ```bash theme={null}
       nebius ai endpoint create \
         --name qs-endpoint-nginx \
         --image nginx:alpine \
         --platform cpu-d3 \
         --preset 4vcpu-16gb \
         --public \
         --container-port 80 \
         --auth token \
         --token "$AUTH_TOKEN" \
         --subnet-id <subnet_ID>
       ```

       Alternatively, you can run `nebius ai create` and specify each value step by step with CLI prompts. The command pre-fills the following values:

       * `--name`: Endpoint name.
       * `--image`: Container image to run. In the given example, the `nginx:alpine` image is used.
       * `--platform`: VM platform for the endpoint. As Serverless AI endpoints are based on container VMs, every endpoint uses [Compute platforms and presets](/compute/virtual-machines/types).
       * `--preset`: Number of vCPUs and RAM allocated to the container. The preset must match the selected platform.
       * `--container-port`: Port on which the application listens in the container. Each HTTP port is available through the managed HTTPS URL of the endpoint.
       * `--auth`: Authentication method for the endpoint.
       * `--token`: Token used for endpoint authentication.
       * `--public`: Assigns a public IP address to the endpoint. Not required to reach the endpoint from the internet, because each HTTP port is available through the endpoint's managed HTTPS URL.

    3. When the CLI prompts you to select a project, region or subnet, select from the values that are available.

    4. Review the resulting configuration, then confirm creation.

    Wait for the endpoint to start running.
  </Tab>

  <Tab title="REST API">
    1. Create a token for endpoint authentication:

       ```bash theme={null}
       openssl rand -hex 32
       ```

       Save the token: it is different from the access token that authorizes REST API requests, and you need it to create and test the endpoint.

    2. Send the following request. Specify the endpoint authentication token from the previous step in `spec.authToken`:

       ```bash theme={null}
       curl --request POST \
         --url 'https://api.nebius.cloud/ai/v1/endpoints' \
         --header "Authorization: Bearer <access_token>" \
         --header 'Content-Type: application/json' \
         --data '{
           "metadata": {
             "parentId": "<project_ID>",
             "name": "qs-endpoint-nginx"
           },
           "spec": {
             "image": "nginx:alpine",
             "platform": "cpu-d3",
             "preset": "4vcpu-16gb",
             "ports": [
               {
                 "containerPort": 80,
                 "protocol": "HTTP"
               }
             ],
             "authToken": "<endpoint_token>",
             "publicIp": true,
             "subnetId": "<subnet_ID>",
             "disk": {
               "type": "NETWORK_SSD",
               "sizeBytes": "268435456000"
             }
           }
         }'

       ```

       In the `Authorization` header, replace `<access_token>` with the access token that you got in the prerequisites.

       The request includes the following parameters:

       * `metadata.parentId`: [Project ID](/iam/manage-projects#how-to-get-a-project-id).
       * `metadata.name`: Endpoint name.
       * `spec.image`: Container image to run.
       * `spec.platform`: VM platform for the endpoint. As Serverless AI endpoints are based on containers over VMs, every endpoint uses [Compute platforms and presets](/compute/virtual-machines/types).
       * `spec.preset`: Number of vCPUs and RAM allocated to the container. The preset must match the selected platform.
       * `spec.ports[].containerPort`: Port on which the application listens in the container.
       * `spec.ports[].protocol`: Protocol used by the exposed port. An HTTP port is available through the endpoint's managed HTTPS URL.
       * `spec.authToken`: Token used for endpoint authentication.
       * `spec.publicIp`: Whether to assign a public IP address to the endpoint. A public IP address isn't required to reach the endpoint through its managed HTTPS URL.
       * `spec.subnetId`: [Subnet ID](/vpc/networking/resources#how-to-get-a-subnet-id).
       * `spec.disk.type`: Disk type for the container over VM.
       * `spec.disk.sizeBytes`: Disk size in bytes. The specified value is 250 GiB.

       The response returns the endpoint ID in the `resourceId` parameter. Save this value because you need it in later steps.

    Wait for the endpoint to start running.
  </Tab>
</Tabs>

### Test the endpoint

<Tabs group="interfaces">
  <Tab title="Web console">
    1. In the sidebar, go to <Icon icon="https://mintcdn.com/nebius-ai-cloud/rOlLZ_MFvrheaI-h/_assets/sidebar/serverless-ai.svg?fit=max&auto=format&n=rOlLZ_MFvrheaI-h&q=85&s=4c90b50c6c33e6bff000b87b8e37765a" width="16" height="16" data-path="_assets/sidebar/serverless-ai.svg" /> **Serverless AI** → **Endpoints**.
    2. Click the endpoint name to open its details. Wait until the endpoint is running. Then copy its managed HTTPS URL (`https://...`) from the **Public endpoints** field.
    3. In a terminal, send a request to the endpoint:

       ```bash theme={null}
       curl -v <endpoint_URL>
       ```

       In the command, specify the managed HTTPS URL that you copied earlier.

       The response should have HTTP status `200 OK`. The body is the default nginx welcome page, which confirms that the endpoint is serving traffic over the managed HTTPS URL.
  </Tab>

  <Tab title="CLI">
    1. Save the endpoint ID to an environment variable:

       ```bash theme={null}
       export ENDPOINT_ID=$(nebius ai endpoint get-by-name \
         --name qs-endpoint-nginx --format jsonpath='{.metadata.id}')
       ```

    2. Get the endpoint's managed HTTPS URL from the **Public endpoints** field:

       ```bash theme={null}
       export ENDPOINT_URL=$(nebius ai endpoint get "$ENDPOINT_ID" --format json \
         | jq -r '.status.public_endpoints[] | select(startswith("https://"))' | head -1)
       ```

    3. Test the endpoint with authentication:

       ```bash theme={null}
       curl -v "$ENDPOINT_URL" -H "Authorization: Bearer $AUTH_TOKEN"
       ```

    4. Test the endpoint without a token:

       ```bash theme={null}
       curl -v "$ENDPOINT_URL"
       ```

       The test should fail with the error `401 Unauthorized` or `403 Forbidden`.
  </Tab>

  <Tab title="REST API">
    1. Get the endpoint:

       ```bash theme={null}
       curl --request GET \
         --url "https://api.nebius.cloud/ai/v1/endpoints/<endpoint_ID>" \
         --header "Authorization: Bearer <access_token>"
       ```

       In the request, specify:

       * Your access token in the `Authorization` header.
       * In the request path, the endpoint ID returned in the `resourceId` parameter when you created the endpoint.

       Check the `status.state` parameter in the response. If the state isn't `RUNNING`, wait a few seconds and send the request again.

    2. Copy a managed HTTPS URL (`https://...`) from the `status.publicEndpoints` parameter in the response.

    3. Test the endpoint with authentication:

       ```bash theme={null}
       curl -v <endpoint_URL> \
         --header 'Authorization: Bearer <endpoint_token>'
       ```

    4. Test the endpoint without a token:

       ```bash theme={null}
       curl -v <endpoint_URL>
       ```

       The test should fail with the error `401 Unauthorized` or `403 Forbidden`.
  </Tab>
</Tabs>

### View logs

<Note>
  Viewing endpoint logs is available only in the web console and CLI.
</Note>

<Tabs group="interfaces">
  <Tab title="Web console">
    1. In the sidebar, go to <Icon icon="https://mintcdn.com/nebius-ai-cloud/rOlLZ_MFvrheaI-h/_assets/sidebar/serverless-ai.svg?fit=max&auto=format&n=rOlLZ_MFvrheaI-h&q=85&s=4c90b50c6c33e6bff000b87b8e37765a" width="16" height="16" data-path="_assets/sidebar/serverless-ai.svg" /> **Serverless AI** → **Endpoints**.
    2. In the endpoint list, next to the endpoint, click **View logs**. Alternatively, click <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/button-vellipsis.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=e80b8e57c43bfd117679262e6a1334ad" width="12" height="24" data-path="_assets/button-vellipsis.svg" /> → **View logs**.
  </Tab>

  <Tab title="CLI">
    View endpoint logs:

    ```bash theme={null}
    nebius ai endpoint logs $ENDPOINT_ID
    ```
  </Tab>
</Tabs>

### Delete the endpoint

If you no longer need the endpoint, delete it. Once you delete the endpoint, you will not be charged for it.

<Tabs group="interfaces">
  <Tab title="Web console">
    1. In the sidebar, go to <Icon icon="https://mintcdn.com/nebius-ai-cloud/rOlLZ_MFvrheaI-h/_assets/sidebar/serverless-ai.svg?fit=max&auto=format&n=rOlLZ_MFvrheaI-h&q=85&s=4c90b50c6c33e6bff000b87b8e37765a" width="16" height="16" data-path="_assets/sidebar/serverless-ai.svg" /> **Serverless AI** → **Endpoints**.
    2. In the endpoint list, find the endpoint and click <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/button-vellipsis.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=e80b8e57c43bfd117679262e6a1334ad" width="12" height="24" data-path="_assets/button-vellipsis.svg" /> → **Delete**.
    3. Confirm the endpoint deletion.
  </Tab>

  <Tab title="CLI">
    ```bash theme={null}
    nebius ai endpoint delete $ENDPOINT_ID
    ```
  </Tab>

  <Tab title="REST API">
    Send the following request:

    ```bash theme={null}
    curl --request DELETE \
      --url "https://api.nebius.cloud/ai/v1/endpoints/<endpoint_ID>" \
      --header "Authorization: Bearer <access_token>"
    ```

    In the request, specify:

    * Your access token in the `Authorization` header.
    * In the request path, the endpoint ID returned in the `resourceId` parameter when you created the endpoint.
  </Tab>
</Tabs>

## Expected results

* The endpoint is reachable over its managed HTTPS URL.
* A request without a token in the web console returns `200 OK`.
* A request without a token in the CLI or REST API returns `401 Unauthorized` or `403 Forbidden`.
* An endpoint can be deleted successfully.

## See also

* [Deploying a large language model and chatting with it by using Serverless AI endpoints](/serverless/tutorials/deploy-model)
