[Yandex Cloud documentation](../../../index.md) > [Yandex API Gateway](../../index.md) > [Concepts](../index.md) > Specification extensions > Overview

# API Gateway specification extensions. Overview

## x-yc-apigateway extension {#top-level}

The `x-yc-apigateway` extension allows you to set top-level API gateway parameters whose values will be inherited by child extensions.

### Supported parameters {#parameters}

The table below lists the parameters specific to API Gateway API gateways. You can find the description of other parameters in the [OpenAPI 3.0 specification](https://github.com/OAI/OpenAPI-Specification).

 Parameter                | Type               | Description                                                                                                                                          
-------------------------|-------------------|---------------------------------------------------------------------------------------------------------------------------------------------------
 `serviceAccountId`      | `string`          | ID of the [service account](../../../iam/concepts/users/service-accounts.md) on behalf of which the API gateway will perform operations.
 `validator`             | `ValidatorObject` | [HTTP request and response validator](validator.md#validator_object) or a link to it. It can be overridden at the level of a specific operation. 
 `cors`                  | `CorsRuleObject`  | [Rule for handling CORS preflight requests](cors.md#corsrule_object) or a link to it. It can be overridden at the level of a specific path. 
 `rateLimit`             | `RateLimitObject` | [Request rate limit](rate-limit.md#rate_limit_object) or a link to it. It can be overridden at the level of a specific path and/or operation. 
 `ignoreTrailingSlashes` | `boolean`         | If `true`, API Gateway ignores the trailing slash (`/`) in the request URL; otherwise, it is sensitive to its presence or absence when searching for a handler in the OpenAPI specification. The default value is `true`.
 `securityProfileId`     | `string`          | Smart Web Security [profile](../../../smartwebsecurity/concepts/profiles.md) ID.

### Extension specification {#tl-spec}

```yaml
x-yc-apigateway:
  service_account_id: <service_account_ID>
  validator: <ValidatorObject_or_link_to_it>
  cors: <CorsRuleObject_or_link_to_it>
  rateLimit: <RateLimitObject_or_link_to_it>
  ignoreTrailingSlashes: <true_or_false>
  smartWebSecurity:
    securityProfileId: <security_profile_ID>
```

## x-yc-apigateway-integration extension {#integration}

The `x-yc-apigateway-integration` extension is the entry point for integrating the API gateway with other services.

### Supported parameters {#parameters}

The table below lists the parameters specific to API Gateway API gateways. You can find the description of other parameters in the [OpenAPI 3.0 specification](https://github.com/OAI/OpenAPI-Specification).

Parameter | Type | Description 
----|----|----
`type` | `string` | Extension type. The available values are `dummy`, `cloud_functions`, `http`, `object_storage`, `cloud_datasphere`, `cloud_datastreams`, `serverless_containers`, `cloud_ymq`, `cloud_ydb`, and `swagger`.

### Extension specification {#intg-spec}

```
<request>:
  <method>:
    x-yc-apigateway-integration:
      type: <type>
      <list_of_parameters_as_key:value_pairs>
```

The extension contents change depending on the `type` specified in the `x-yc-apigateway-integration` section:
* [dummy](dummy.md): Returns fixed contents with the specified response code and required headers without any third-party service involved.
* [cloud_functions](cloud-functions.md): Invokes the specified function, provides it with the HTTP request data as input, and returns this function's results to the client.
* [http](http.md): Redirects the request to the specified URL.
* [object_storage](object-storage.md): Delegates the request handling to Object Storage to distribute static files.
* [cloud_datasphere](datasphere.md): Invokes the specified DataSphere node, provides it with the request body with input variable values, and returns the node output in the response body.
* [cloud_datastreams](datastreams.md): Accesses Yandex Data Streams to perform an operation with the specified stream.
* [serverless_containers](containers.md): Redirects a request to a specified container.
* [cloud_ymq](ymq.md): Accesses Yandex Message Queue to perform an operation with the specified queue.
* [cloud_ydb](ydb.md): Accesses Yandex Managed Service for YDB to perform an operation with the specified [document table](../../../ydb/concepts/dynamodb-tables.md).
* [swagger](swagger.md): Enables you to access interactive documents as well as test and debug your APIs within the Swagger UI.

All types support parameter substitution with all keys being replaced with the appropriate value. A key should be defined as a parameter of the relevant operation. All parameter types defined in the [OpenAPI-Specification](https://github.com/OAI/OpenAPI-Specification), such as `path`, `query`, `header`, and `cookie`, are allowed.
Parameters are only substituted in certain values, depending on the extension type.

## components:x-yc-apigateway-integrations extension {#integrations}

The `x-yc-apigateway-integrations` extension allows you to specify the appropriate integration in the [components](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#components-object) section. You can reference these integrations using the `$ref` parameter in the `x-yc-apigateway-integration` extension.

### Extension specification {#intg-spec}

Extension specification example:
```yaml
openapi: 3.0.0
info:
  title: Sample API
  version: 1.0.0

x-yc-apigateway:
  variables:
    handler:
      default: "#/components/x-yc-apigateway-integrations/BaseGetDefault"
      enum:
        - "#/components/x-yc-apigateway-integrations/BaseGetDefault"
        - "#/components/x-yc-apigateway-integrations/BaseGetUnimplemented"

paths:
  /:
    get:
      x-yc-apigateway-integration:
        $ref: "${var.handler}"

components:
  x-yc-apigateway-integrations:
    BaseGetDefault:
      type: cloud_functions
      function_id: b095c95icnvb********
      tag: "$latest"
      service_account_id: ajehfe84hhl********
    BaseGetUnimplemented:
      type: dummy
      content:
        '*': Sorry, endpoint is not implemented yet.
      http_code: 501
      http_headers:
        Content-Type: text/plain
```

## x-yc-status-mapping extension {#status-mapping}

The [x-yc-status-mapping](status-mapping.md) extension allows you to replace a response code in an integration.

### Extension specification {#status-mapping-spec}

```json
paths:
  /:
    <method>:
      responses:
        <response_code>:
          description: ""
          content:
            ...
          x-yc-status-mapping: <new_response_code>
      ...
```

## x-yc-schema-mapping extension {#schema-mapping}

The [x-yc-schema-mapping](schema-mapping.md) extension allows you to transform the JSON body of a request to an integration or response from it.

### Extension specification {#schema-mapping-spec}

```json
x-yc-schema-mapping:
 type:static
 template:
   <field_name>: "<field_value>"
   ...
```