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

# Create an endpoint

> Create a Frontier Gateway endpoint: a routing slug and the target it points to.

Create an endpoint. An endpoint is a globally-unique routing slug plus the target it points to. Once created, requests that reach the gateway with this slug route to the target you specify. For the conceptual walkthrough, see [Endpoints](/frontier-gateway/endpoints).

### Errors

| Status            | Meaning                                                                                                                                                                                                |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `400 Bad Request` | Invalid payload, slug prefix your organization doesn't own, duplicate slug, unknown environment, invalid provider-specific target fields, or a `targets` list that's empty or has more than one entry. |
| `403 Forbidden`   | Workspace isn't onboarded to Frontier Gateway, or the caller doesn't have management scope.                                                                                                            |

<RequestExample>
  ```bash curl theme={"system"}
  curl --request POST \
    --url https://api.baseten.co/v1/gateway/endpoints \
    --header "Authorization: Api-Key $BASETEN_API_KEY" \
    --header "Content-Type: application/json" \
    --data '{
      "slug": "my-org/glm-5.2",
      "targets": [
        {
          "provider": "BASETEN",
          "model_id": "3kZ9xqd",
          "environment_name": "staging"
        }
      ]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={"system"}
  {
    "id": "abc123hash",
    "slug": "my-org/glm-5.2",
    "targets": [
      {
        "provider": "BASETEN",
        "model_id": "3kZ9xqd",
        "environment_name": "staging"
      }
    ],
    "created_at": "2026-06-17T12:00:00Z",
    "updated_at": "2026-06-17T12:00:00Z"
  }
  ```
</ResponseExample>


## OpenAPI

````yaml post /v1/gateway/endpoints
openapi: 3.1.0
info:
  description: REST API for management of Baseten resources
  title: Baseten management API
  version: 1.0.0
servers:
  - url: https://api.baseten.co
security:
  - BearerAuth: []
paths:
  /v1/gateway/endpoints:
    post:
      summary: Creates a Gateway endpoint
      description: >-
        Provisions an endpoint for the given slug and its upstream target.
        Exactly one target is supported at this time. The slug's prefix must be
        one your organization owns.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEndpointRequestV1'
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndpointV1'
      x-codeSamples:
        - lang: bash
          source: |-
            curl --request POST \
            --url https://api.baseten.co/v1/gateway/endpoints \
            --header "Authorization: Bearer $BASETEN_API_KEY" \
            --data '{
              "slug": "baseten/mymodel-4",
              "region": "UNRESTRICTED",
              "targets": [
                {
                  "environment_name": "staging",
                  "model_id": "3kZ9xqd",
                  "provider": "BASETEN",
                  "target_model": "custom/model-name"
                }
              ]
            }'
        - lang: python
          source: |-
            import requests
            import os
            API_KEY = os.environ.get("BASETEN_API_KEY", "<YOUR_API_KEY>")
            url = "https://api.baseten.co/v1/gateway/endpoints"

            headers = {"Authorization": f"Bearer {API_KEY}"}

            response = requests.request(
                "POST",
                url,
                headers=headers,
                json={'slug': 'baseten/mymodel-4', 'region': 'UNRESTRICTED', 'targets': [{'environment_name': 'staging', 'model_id': '3kZ9xqd', 'provider': 'BASETEN', 'target_model': 'custom/model-name'}]}
            )

            print(response.text)
components:
  schemas:
    CreateEndpointRequestV1:
      properties:
        slug:
          description: Globally-unique slug of the form '{org_prefix}/{name}'.
          examples:
            - baseten/mymodel-4
          title: Slug
          type: string
        region:
          $ref: '#/components/schemas/SharedEndpointRegionV1'
          default: UNRESTRICTED
          description: Region the new routing serves.
        targets:
          description: >-
            The endpoint's upstream targets. Exactly one target is supported at
            this time.
          examples:
            - - environment_name: staging
                model_id: 3kZ9xqd
                provider: BASETEN
                target_model: custom/model-name
            - - provider: OPENAI
                secret_id: 3kZ9xqd
                target_model: gpt-4o
            - - base_url: https://my-vllm.example.com
                provider: OPENAI_COMPATIBLE
                secret_id: 3kZ9xqd
                target_model: my-model
          items:
            $ref: '#/components/schemas/EndpointTargetRequestV1'
          maxItems: 1
          minItems: 1
          title: Targets
          type: array
      required:
        - slug
        - targets
      title: CreateEndpointRequestV1
      type: object
    EndpointV1:
      description: >-
        A Gateway endpoint: a slug and its priority-ordered targets (index 0
        tried first).
      properties:
        id:
          description: Stable identifier for the endpoint.
          title: Id
          type: string
        slug:
          description: Globally-unique routing slug.
          examples:
            - baseten/mymodel-4
          title: Slug
          type: string
        region:
          $ref: '#/components/schemas/SharedEndpointRegionV1'
          description: Region this endpoint's routing serves.
        created_at:
          description: Creation time, ISO 8601.
          format: date-time
          title: Created At
          type: string
        updated_at:
          description: Last update time, ISO 8601.
          format: date-time
          title: Updated At
          type: string
        targets:
          description: >-
            The endpoint's upstream targets. Exactly one target is supported at
            this time.
          items:
            $ref: '#/components/schemas/EndpointTargetV1'
          title: Targets
          type: array
      required:
        - id
        - slug
        - region
        - created_at
        - updated_at
        - targets
      title: EndpointV1
      type: object
    SharedEndpointRegionV1:
      enum:
        - UNRESTRICTED
        - EU
      title: SharedEndpointRegionV1
      type: string
    EndpointTargetRequestV1:
      description: >-
        One desired upstream target. The customer picks a provider; Baseten owns
        the

        upstream host and protocol adapter.
      properties:
        provider:
          $ref: '#/components/schemas/GatewayProvider'
          description: Upstream provider for this target.
          examples:
            - ANTHROPIC
            - OPENAI
            - OPENAI_COMPATIBLE
            - BASETEN
        secret_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Secret holding the provider credential. Required for external
            providers.
          examples:
            - 3kZ9xqd
          title: Secret Id
        target_model:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Model name to send upstream. Required for external providers and
            optional for BASETEN targets.
          examples:
            - gpt-4o
          title: Target Model
        base_url:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            HTTPS base URL of the upstream OpenAI-compatible server. Must not
            include a port. Required for and only valid with OPENAI_COMPATIBLE.
          examples:
            - https://my-vllm.example.com
          title: Base Url
        model_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Baseten model to route to. Required for and only valid with BASETEN.
          examples:
            - 3kZ9xqd
          title: Model Id
        environment_name:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            Baseten model environment to route to. Only valid with BASETEN. Omit
            or pass `production` to target production.
          examples:
            - staging
          title: Environment Name
        vertex_config:
          anyOf:
            - $ref: '#/components/schemas/VertexTargetConfigV1'
            - type: 'null'
          default: null
          description: >-
            Google Vertex configuration. Required for and only valid with
            VERTEX.
      required:
        - provider
      title: EndpointTargetRequestV1
      type: object
    EndpointTargetV1:
      description: One configured upstream target of an endpoint.
      properties:
        provider:
          $ref: '#/components/schemas/GatewayProvider'
          description: Upstream provider.
        secret_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Referenced secret, if any.
          title: Secret Id
        target_model:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Upstream model name, if any.
          title: Target Model
        base_url:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Custom OpenAI-compatible base URL, if any.
          title: Base Url
        model_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Baseten model, if any.
          title: Model Id
        environment_name:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: Baseten model environment, if non-production.
          title: Environment Name
        vertex_config:
          anyOf:
            - $ref: '#/components/schemas/VertexTargetConfigV1'
            - type: 'null'
          default: null
          description: Google Vertex configuration, if any.
      required:
        - provider
      title: EndpointTargetV1
      type: object
    GatewayProvider:
      description: >-
        Customer-facing provider for an endpoint target.


        External providers resolve to a fixed upstream host + protocol adapter
        via

        ``external_provider_configs()``; ``BASETEN`` derives its host from the
        referenced oracle.
      enum:
        - ANTHROPIC
        - OPENAI
        - XAI
        - BASETEN
        - BASETEN_MODEL_API
        - VERTEX
        - OPENAI_COMPATIBLE
      title: GatewayProvider
      type: string
    VertexTargetConfigV1:
      properties:
        project_id:
          description: Google Cloud project ID or project number.
          examples:
            - my-gcp-project
            - '464036093014'
          title: Project Id
          type: string
        location:
          description: Google Cloud location.
          examples:
            - global
          title: Location
          type: string
      required:
        - project_id
        - location
      title: VertexTargetConfigV1
      type: object
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send `Authorization: Bearer <api_key>`. The legacy `Authorization:
        Api-Key <api_key>` scheme is also accepted.

````