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

# Create a gateway

> Creates a new gateway. Ownership tenant_id is required (JWT claim, or body for platform admins). The slug is optional: when omitted the server generates a unique random slug. If provided it must be a lowercase DNS label and unique. Platform JWT create requires stamped entitlements (tier + caps); tenant JWTs must omit entitlements (422 if sent). With RATE_LIMIT_ENABLED, create returns 409 when the tenant is already at MaxInstances for the effective tier.



## OpenAPI

````yaml /trustgate/api/openapi.json post /v1/gateways
openapi: 3.0.0
info:
  description: >-
    Administrative API for managing gateways and their registries, policies,
    consumers, roles and auth credentials.
  title: TrustGate Admin API
  contact:
    name: NeuralTrust
    url: https://neuraltrust.ai/contact
    email: support@neuraltrust.ai
  version: '1.0'
servers:
  - url: /
security: []
paths:
  /v1/gateways:
    post:
      tags:
        - gateways
      summary: Create a gateway
      description: >-
        Creates a new gateway. Ownership tenant_id is required (JWT claim, or
        body for platform admins). The slug is optional: when omitted the server
        generates a unique random slug. If provided it must be a lowercase DNS
        label and unique. Platform JWT create requires stamped entitlements
        (tier + caps); tenant JWTs must omit entitlements (422 if sent). With
        RATE_LIMIT_ENABLED, create returns 409 when the tenant is already at
        MaxInstances for the effective tier.
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_gateway_request.CreateGatewayRequest
        description: Gateway to create
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_gateway_response.GatewayResponse
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
        '422':
          description: Unprocessable Entity
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody
      security:
        - BearerAuth: []
components:
  schemas:
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_gateway_request.CreateGatewayRequest:
      type: object
      properties:
        client_tls:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_domain_gateway.ClientTLSConfig
        domain:
          type: string
        entitlements:
          description: >-
            Entitlements is required for platform (empty JWT tenant) create and
            must include full stamped caps.

            Tenant callers must omit it (422 if sent). When a tenant omits it,
            the gateway defaults to free

            or inherits the highest sibling tier.
          allOf:
            - $ref: >-
                #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_domain_gateway.Entitlements
        metadata:
          type: object
          additionalProperties:
            type: string
        session_config:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_domain_gateway.SessionConfig
        slug:
          description: >-
            Slug is optional; when omitted the server generates a unique random
            slug. If provided it must be a lowercase DNS label.
          type: string
          example: acme-prod
        telemetry:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_domain_telemetry.Telemetry
        tenant_id:
          description: >-
            TenantID is required ownership for platform (empty JWT)
            create-for-tenant; tenant JWTs may match or omit it (JWT wins).
          type: string
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_gateway_response.GatewayResponse:
      type: object
      properties:
        client_tls:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_domain_gateway.ClientTLSConfig
        created_at:
          type: string
        domain:
          type: string
        entitlements:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_domain_gateway.Entitlements
        hosts:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_api_handler_http_gateway_response.GatewayHosts
        id:
          type: string
        metadata:
          type: object
          additionalProperties:
            type: string
        session_config:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_domain_gateway.SessionConfig
        slug:
          type: string
        status:
          type: string
        telemetry:
          $ref: >-
            #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_domain_telemetry.Telemetry
        updated_at:
          type: string
        version:
          type: string
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_httpio.ErrorBody:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
    github_com_NeuralTrust_TrustGate_pkg_domain_gateway.ClientTLSConfig:
      type: object
      additionalProperties:
        type: array
        items:
          type: integer
    github_com_NeuralTrust_TrustGate_pkg_domain_gateway.Entitlements:
      type: object
      properties:
        burst_per_min:
          type: integer
        max_instances:
          type: integer
        quota_per_month:
          type: integer
        tier:
          type: string
    github_com_NeuralTrust_TrustGate_pkg_domain_gateway.SessionConfig:
      type: object
      properties:
        body_param_name:
          type: string
        enabled:
          type: boolean
        header_name:
          type: string
    github_com_NeuralTrust_TrustGate_pkg_domain_telemetry.Telemetry:
      type: object
      properties:
        enable_plugin_traces:
          type: boolean
        enable_request_traces:
          type: boolean
        exporters:
          type: array
          items:
            $ref: >-
              #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_domain_telemetry.ExporterConfig
        extra_params:
          type: object
          additionalProperties:
            type: string
        header_mapping:
          type: object
          additionalProperties:
            type: string
    github_com_NeuralTrust_TrustGate_pkg_api_handler_http_gateway_response.GatewayHosts:
      type: object
      properties:
        mcp:
          type: string
        proxy:
          type: string
    github_com_NeuralTrust_TrustGate_pkg_domain_telemetry.ExporterConfig:
      type: object
      properties:
        class:
          description: >-
            Class binds the exporter to a data class, set from the group it is
            declared

            under in the defaults file. Empty for per-gateway configs.
          allOf:
            - $ref: >-
                #/components/schemas/github_com_NeuralTrust_TrustGate_pkg_metrics.DataClass
        name:
          type: string
        settings:
          type: object
          additionalProperties: true
        type:
          type: string
    github_com_NeuralTrust_TrustGate_pkg_metrics.DataClass:
      type: string
      enum:
        - metadata
        - raw
      x-enum-varnames:
        - Metadata
        - Raw
  securitySchemes:
    BearerAuth:
      type: apiKey
      name: Authorization
      in: header

````