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

# Create a GatewayConfig.

> Create a new GatewayConfig to proxy API requests through the agent gateway. The config specifies the target endpoint and how credentials should be applied.



## OpenAPI

````yaml /openapi-specs/stainless-processed-openapi.json post /v1/gateway-configs
openapi: 3.1.0
info:
  title: RunLoop API
  version: '0.1'
  description: >-
    The RunLoop API spec that allows you to host lambda functions and Devboxes
    to enable scaled long running ai workflows.
  contact:
    name: Runloop AI Support
    url: https://runloop.ai
    email: support@runloop.ai
servers:
  - url: https://api.runloop.ai
    description: Runloop API
    variables: {}
security:
  - bearerAuth: []
tags:
  - name: Benchmark
  - name: Blueprint
  - name: Blueprint-Lifecycle
  - name: Blueprint-ObservabilityTools
  - name: Devbox
  - name: Devbox-FileTools
  - name: Devbox-Lifecycle
  - name: Devbox-NetworkTools
  - name: Devbox-ObservabilityTools
  - name: Devbox-PersistenceTools
  - name: Devbox-ShellTools
  - name: Scenario
  - name: ScenarioScorer
  - name: accounts
  - name: agents
  - name: apikeys
  - name: axons
  - name: executions
  - name: gateway-configs
  - name: mcp-configs
  - name: network-policies
  - name: objects
  - name: restricted_keys
  - name: secrets
  - name: streaming
paths:
  /v1/gateway-configs:
    post:
      tags:
        - gateway-configs
      summary: Create a GatewayConfig.
      description: >-
        Create a new GatewayConfig to proxy API requests through the agent
        gateway. The config specifies the target endpoint and how credentials
        should be applied.
      operationId: createGatewayConfig
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GatewayConfigCreateParameters'
      responses:
        '200':
          description: GatewayConfig created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GatewayConfigView'
        '400':
          description: Bad request. Name already exists or is invalid.
        '401':
          description: Unauthorized. Invalid or missing authentication.
        '403':
          description: Forbidden. Account does not have devbox capability.
        '500':
          description: Internal server error.
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Runloop from '@runloop/api-client';

            const client = new Runloop({
              bearerToken: process.env['RUNLOOP_API_KEY'], // This is the default and can be omitted
            });

            const gatewayConfigView = await client.gatewayConfigs.create({
              auth_mechanism: { type: 'type' },
              endpoint: 'endpoint',
              name: 'name',
            });

            console.log(gatewayConfigView.id);
        - lang: Python
          source: |-
            import os
            from runloop_api_client import Runloop

            client = Runloop(
                bearer_token=os.environ.get("RUNLOOP_API_KEY"),  # This is the default and can be omitted
            )
            gateway_config_view = client.gateway_configs.create(
                auth_mechanism={
                    "type": "type"
                },
                endpoint="endpoint",
                name="name",
            )
            print(gateway_config_view.id)
components:
  schemas:
    GatewayConfigCreateParameters:
      type: object
      description: Parameters required to create a new GatewayConfig.
      properties:
        name:
          type: string
          description: >-
            The human-readable name for the GatewayConfig. Must be unique within
            your account.
        endpoint:
          type: string
          description: The target endpoint URL (e.g., 'https://api.anthropic.com').
        auth_mechanism:
          $ref: '#/components/schemas/AuthMechanismView'
          description: >-
            How credentials should be applied to proxied requests. Specify the
            type ('header', 'bearer') and optional key field.
        description:
          description: Optional description for this gateway configuration.
          type:
            - string
            - 'null'
        custom_headers:
          items:
            $ref: '#/components/schemas/CustomHeaderView'
          description: >-
            Additional headers applied to proxied requests after the auth
            mechanism. At most 8 entries.
          type:
            - array
            - 'null'
      required:
        - name
        - endpoint
        - auth_mechanism
    GatewayConfigView:
      type: object
      description: >-
        A GatewayConfig defines a configuration for proxying API requests
        through the agent gateway. It specifies the target endpoint and how
        credentials should be applied.
      properties:
        id:
          type: string
          description: The unique identifier of the GatewayConfig.
        account_id:
          description: The account ID that owns this config.
          type:
            - string
            - 'null'
        name:
          type: string
          description: >-
            The human-readable name of the GatewayConfig. Unique per account (or
            globally for system configs).
        endpoint:
          type: string
          description: The target endpoint URL (e.g., 'https://api.anthropic.com').
        auth_mechanism:
          $ref: '#/components/schemas/AuthMechanismView'
          description: How credentials should be applied to proxied requests.
        description:
          description: Optional description for this gateway configuration.
          type:
            - string
            - 'null'
        custom_headers:
          items:
            $ref: '#/components/schemas/CustomHeaderView'
          description: >-
            Additional headers applied to proxied requests after the auth
            mechanism. Secret-backed entries reference the secret by 'sec_' id;
            values are never returned.
          type:
            - array
            - 'null'
        create_time_ms:
          type: integer
          format: int64
          description: Creation time of the GatewayConfig (Unix timestamp in milliseconds).
      required:
        - id
        - name
        - endpoint
        - auth_mechanism
        - create_time_ms
    AuthMechanismView:
      type: object
      description: >-
        Defines how the primary credential is applied to requests proxied to the
        upstream.
      properties:
        type:
          type: string
          description: >-
            The type of authentication mechanism: 'header', 'bearer', or
            'basic'. For 'basic', store the secret as plain 'user:pass'; the
            proxy base64-encodes it.
        key:
          description: >-
            The header name (e.g., 'x-api-key'). Required for 'header' type;
            invalid for other types.
          type:
            - string
            - 'null'
      required:
        - type
    CustomHeaderView:
      type: object
      description: >-
        An additional header applied to upstream requests alongside the primary
        credential. The value comes from an account secret or a literal string;
        exactly one of 'secret' and 'value' must be set.
      properties:
        name:
          type: string
          description: The header name (e.g., 'DD-APPLICATION-KEY').
        secret:
          description: >-
            Account secret providing the header value. Accepts a secret name or
            'sec_' id on writes; reads always return the 'sec_' id.
          type:
            - string
            - 'null'
        value:
          description: >-
            Literal header value. Stored in plaintext and returned by reads -
            use 'secret' for credentials or other sensitive values.
          type:
            - string
            - 'null'
      required:
        - name
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````