---
title: "Create a new mapping for a gateway"
method: POST
path: "/gateway/{gateway_topic}/mapping"
tags: ["Mappings"]
---

# Create a new mapping for a gateway

`POST /gateway/{gateway_topic}/mapping`

## Request

- Base URL: `https://api.quiva.ai`
- URL: `https://api.quiva.ai/gateway/{gateway_topic}/mapping`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-4/docs/gateway/:gateway_topic/mapping/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a new path mapping within the specified gateway.

## Path parameters

- `gateway_topic` string, required

## Request body

- MappingCreateRequest
  - `path` string, required: URL path for the mapping
  - `method` 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD': HTTP method for the mapping
  - `is_public` boolean: Whether the mapping is publicly accessible
  - `limit` Limit
    - `request` integer: Maximum number of requests allowed
    - `time` integer: Time window for rate limiting in milliseconds
  - `timeout` integer: Timeout in milliseconds for mapping requests
  - `traffic_distribution` object: Traffic distribution configuration for A/B testing

## Response `200`

Mapping created successfully

- MappingResponseWrapper
  - `body` MappingResponse
    - `subject` string: Subject identifier of the mapping
    - `path` string: URL path for the mapping
    - `method` string: HTTP method for the mapping
    - `is_public` boolean: Whether the mapping is publicly accessible
    - `limit` Limit
      - `request` integer: Maximum number of requests allowed
      - `time` integer: Time window for rate limiting in milliseconds
    - `timeout` integer: Timeout in milliseconds for mapping requests
    - `traffic_distribution` object: Traffic distribution configuration for A/B testing
    - `modified` integer: Unix timestamp of when the mapping was last modified
    - `type` string: Type of the mapping record
  - `metadata` Metadata
    - `subject` string: Subject identifier for the resource

## Other responses

- `400`: Bad request
- `404`: Resource not found

---

[API](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-4.md) - [All operations](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-4/llms.txt) - [OpenAPI document](https://skmtc.dev/quivaworks/apis/quiva-ai-gateway-4/revisions/4915bc3902b1?raw)
