# AddApiGatewayTargetOptions

Options for adding an API Gateway target to a gateway.

Used as argument in: [Gateway.addApiGatewayTarget](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.Gateway.html#addapigatewaytarget)

- Source: [`aws-bedrockagentcore/lib/gateway/gateway.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/gateway/gateway.ts#L181)
- Type last changed: v2.255.0 · 19 May 2026

## Example

TypeScript:

```ts
const gateway = new agentcore.Gateway(this, "MyGateway", {
  gatewayName: "my-gateway",
});

const api = new apigateway.RestApi(this, 'MyApi', {
  restApiName: 'my-api',
});

// Uses IAM authorization for outbound auth by default
const apiGatewayTarget = gateway.addApiGatewayTarget("MyApiGatewayTarget", {
  restApi: api,
  apiGatewayToolConfiguration: {
    toolFilters: [
      {
        filterPath: "/pets/*",
        methods: [agentcore.ApiGatewayHttpMethod.GET],
      },
    ],
  },
});
```

Python:

```python
gateway = agentcore.Gateway(self, "MyGateway",
    gateway_name="my-gateway"
)

api = apigateway.RestApi(self, "MyApi",
    rest_api_name="my-api"
)

# Uses IAM authorization for outbound auth by default
api_gateway_target = gateway.add_api_gateway_target("MyApiGatewayTarget",
    rest_api=api,
    api_gateway_tool_configuration=agentcore.ApiGatewayToolConfiguration(
        tool_filters=[agentcore.ApiGatewayToolFilter(
            filter_path="/pets/*",
            methods=[agentcore.ApiGatewayHttpMethod.GET]
        )
        ]
    )
)
```

Java:

```java
Gateway gateway = Gateway.Builder.create(this, "MyGateway")
        .gatewayName("my-gateway")
        .build();

RestApi api = RestApi.Builder.create(this, "MyApi")
        .restApiName("my-api")
        .build();

// Uses IAM authorization for outbound auth by default
GatewayTarget apiGatewayTarget = gateway.addApiGatewayTarget("MyApiGatewayTarget", AddApiGatewayTargetOptions.builder()
        .restApi(api)
        .apiGatewayToolConfiguration(ApiGatewayToolConfiguration.builder()
                .toolFilters(List.of(ApiGatewayToolFilter.builder()
                        .filterPath("/pets/*")
                        .methods(List.of(ApiGatewayHttpMethod.GET))
                        .build()))
                .build())
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var gateway = new Gateway(this, "MyGateway", new GatewayProps {
    GatewayName = "my-gateway"
});

var api = new RestApi(this, "MyApi", new RestApiProps {
    RestApiName = "my-api"
});

// Uses IAM authorization for outbound auth by default
var apiGatewayTarget = gateway.AddApiGatewayTarget("MyApiGatewayTarget", new AddApiGatewayTargetOptions {
    RestApi = api,
    ApiGatewayToolConfiguration = new ApiGatewayToolConfiguration {
        ToolFilters = new [] { new ApiGatewayToolFilter {
            FilterPath = "/pets/*",
            Methods = new [] { ApiGatewayHttpMethod.GET }
        } }
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
gateway := agentcore.NewGateway(this, jsii.String("MyGateway"), &GatewayProps{
	GatewayName: jsii.String("my-gateway"),
})

api := apigateway.NewRestApi(this, jsii.String("MyApi"), &RestApiProps{
	RestApiName: jsii.String("my-api"),
})

// Uses IAM authorization for outbound auth by default
apiGatewayTarget := gateway.AddApiGatewayTarget(jsii.String("MyApiGatewayTarget"), &AddApiGatewayTargetOptions{
	RestApi: api,
	ApiGatewayToolConfiguration: &ApiGatewayToolConfiguration{
		ToolFilters: []ApiGatewayToolFilter{
			&ApiGatewayToolFilter{
				FilterPath: jsii.String("/pets/*"),
				Methods: []ApiGatewayHttpMethod{
					agentcore.ApiGatewayHttpMethod_GET(),
				},
			},
		},
	},
})
```

## Properties

- `apiGatewayToolConfiguration`: [ApiGatewayToolConfiguration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.ApiGatewayToolConfiguration.html) (required) — Tool configuration defining which operations to expose.

- `credentialProviderConfigurations`: [ICredentialProviderConfig](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.ICredentialProviderConfig.html)[] — Credential providers for authentication API Gateway targets support IAM and API key authentication.

  **Default:** Empty array (service handles IAM automatically)

- `description`: string — Optional description for the gateway target.

  **Default:** No description

- `gatewayTargetName`: string — The name of the gateway target Valid characters are a-z, A-Z, 0-9, _ (underscore) and - (hyphen).

  **Default:** auto generate

- `metadataConfiguration`: [MetadataConfiguration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_bedrockagentcore.MetadataConfiguration.html) — Metadata configuration for passing headers and query parameters Allows you to pass additional context through headers and query parameters.

  **Default:** No metadata configuration

- `restApi`: [IRestApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_apigateway.IRestApi.html) (required) — The REST API to integrate with Must be in the same account and region as the gateway [disable-awslint:prefer-ref-interface].

- `stage`: string — The stage name of the REST API.

  **Default:** Uses the deployment stage from the RestApi (restApi.deploymentStage.stageName)
