> ## Documentation Index
> Fetch the complete documentation index at: https://microstrate-1133-notifications-prefs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a new gateway

> Creates a new gateway with a unique topic and URL.



## OpenAPI

````yaml /api-reference/endpoint/gateway/openapi.json post /gateway
openapi: 3.0.3
info:
  title: quiva.ai Gateway
  description: >-
    quiva.ai Gateway API for managing gateway infrastructure and routing API
    requests.
  version: 1.0.0
  contact:
    name: quiva.ai Support
    email: support@quiva.ai
servers:
  - url: https://api.quiva.ai
    description: Production API server
security:
  - bearer_auth: []
  - api_key_auth: []
tags:
  - name: Gateways
    description: Gateway management endpoints
  - name: Mappings
    description: Gateway Mapping management endpoints
  - name: Mapping Versions
    description: Gateway Mapping Version management endpoints
paths:
  /gateway:
    post:
      tags:
        - Gateways
      summary: Create a new gateway
      description: Creates a new gateway with a unique topic and URL.
      operationId: postGateway
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GatewayCreateRequest'
            examples:
              basic_gateway:
                value:
                  name: My API Gateway
                  description: Gateway for my service APIs
                  active: true
      responses:
        '200':
          description: Gateway created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayResponseWrapper'
              example:
                body:
                  name: My API Gateway
                  description: Gateway for my service APIs
                  url: https://abc123.quiva.ai
                  subject: ms.gateway.abcdef123456.gateway
                  active: true
                  timeout: 30000
                  limit:
                    request: 10000
                    time: 1000
                  modified: 1713531894
                  type: created
                metadata:
                  subject: ms.gateway.abcdef123456.gateway
        '400':
          $ref: '#/components/responses/BadRequest'
components:
  schemas:
    GatewayCreateRequest:
      type: object
      required:
        - name
        - active
      properties:
        name:
          type: string
          description: Name of the gateway
          example: My API Gateway
        description:
          type: string
          description: Description of the gateway
          example: Gateway for my service APIs
        active:
          type: boolean
          description: Whether the gateway is active
          default: true
          example: true
        middleware:
          type: array
          description: List of middleware to be applied to the gateway
          items:
            $ref: '#/components/schemas/Middleware'
        limit:
          $ref: '#/components/schemas/Limit'
        timeout:
          type: integer
          description: Timeout in milliseconds for gateway requests
          default: 30000
          example: 30000
    GatewayResponseWrapper:
      type: object
      properties:
        body:
          $ref: '#/components/schemas/GatewayResponse'
        metadata:
          $ref: '#/components/schemas/Metadata'
    Middleware:
      type: object
      properties:
        order:
          type: integer
          description: Execution order of the middleware
          example: 1
        resource:
          type: string
          description: Resource identifier for the middleware function
          example: auth-middleware
        resource_type:
          type: string
          description: Type of resource the middleware points to
          example: function
          enum:
            - function
            - service
        resource_version:
          type: string
          description: Version of the middleware resource to use
          example: latest
        type:
          type: string
          description: When the middleware should execute
          example: pre-request
          enum:
            - pre-request
            - post-request
    Limit:
      type: object
      properties:
        request:
          type: integer
          description: Maximum number of requests allowed
          default: 10000
          example: 5000
        time:
          type: integer
          description: Time window for rate limiting in milliseconds
          default: 1000
          example: 1000
    GatewayResponse:
      type: object
      properties:
        name:
          type: string
          description: Name of the gateway
          example: My API Gateway
        description:
          type: string
          description: Description of the gateway
          example: Gateway for my service APIs
        url:
          type: string
          description: URL of the gateway
          example: https://abc123.quiva.ai
        subject:
          type: string
          description: Subject identifier of the gateway
          example: ms.gateway.abcdef123456.gateway
        active:
          type: boolean
          description: Whether the gateway is active
          example: true
        timeout:
          type: integer
          description: Timeout in milliseconds for gateway requests
          example: 30000
        limit:
          $ref: '#/components/schemas/Limit'
        middleware:
          type: array
          description: List of middleware applied to the gateway
          items:
            $ref: '#/components/schemas/Middleware'
        modified:
          type: integer
          description: Unix timestamp of when the gateway was last modified
          example: 1713531894
        type:
          type: string
          description: Type of the gateway record
          example: created
    Metadata:
      type: object
      properties:
        subject:
          type: string
          description: Subject identifier for the resource
          example: ms.gateway.abcdef123456.gateway
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: Invalid request parameters
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    api_key_auth:
      type: apiKey
      in: header
      name: X-Api-Key

````