# MetadataConfiguration

Configuration for passing metadata (headers and query parameters) to the API Gateway target.

- Source: [`aws-bedrockagentcore/lib/gateway/targets/target-configuration.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-bedrockagentcore/lib/gateway/targets/target-configuration.ts#L514)
- 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',
});

// Create a gateway target using the static factory method
const apiGatewayTarget = agentcore.GatewayTarget.forApiGateway(this, "MyApiGatewayTarget", {
  gatewayTargetName: "my-api-gateway-target",
  description: "Target for API Gateway REST API integration",
  gateway: gateway,
  restApi: api,
  apiGatewayToolConfiguration: {
    toolFilters: [
      {
        filterPath: "/pets/*",
        methods: [agentcore.ApiGatewayHttpMethod.GET, agentcore.ApiGatewayHttpMethod.POST],
      },
    ],
  },
  metadataConfiguration: {
    allowedRequestHeaders: ["X-User-Id"],
    allowedQueryParameters: ["limit"],
  },
});
```

Python:

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

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

# Create a gateway target using the static factory method
api_gateway_target = agentcore.GatewayTarget.for_api_gateway(self, "MyApiGatewayTarget",
    gateway_target_name="my-api-gateway-target",
    description="Target for API Gateway REST API integration",
    gateway=gateway,
    rest_api=api,
    api_gateway_tool_configuration=agentcore.ApiGatewayToolConfiguration(
        tool_filters=[agentcore.ApiGatewayToolFilter(
            filter_path="/pets/*",
            methods=[agentcore.ApiGatewayHttpMethod.GET, agentcore.ApiGatewayHttpMethod.POST]
        )
        ]
    ),
    metadata_configuration=agentcore.MetadataConfiguration(
        allowed_request_headers=["X-User-Id"],
        allowed_query_parameters=["limit"]
    )
)
```

Java:

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

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

// Create a gateway target using the static factory method
GatewayTarget apiGatewayTarget = GatewayTarget.forApiGateway(this, "MyApiGatewayTarget", GatewayTargetApiGatewayProps.builder()
        .gatewayTargetName("my-api-gateway-target")
        .description("Target for API Gateway REST API integration")
        .gateway(gateway)
        .restApi(api)
        .apiGatewayToolConfiguration(ApiGatewayToolConfiguration.builder()
                .toolFilters(List.of(ApiGatewayToolFilter.builder()
                        .filterPath("/pets/*")
                        .methods(List.of(ApiGatewayHttpMethod.GET, ApiGatewayHttpMethod.POST))
                        .build()))
                .build())
        .metadataConfiguration(MetadataConfiguration.builder()
                .allowedRequestHeaders(List.of("X-User-Id"))
                .allowedQueryParameters(List.of("limit"))
                .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"
});

// Create a gateway target using the static factory method
var apiGatewayTarget = GatewayTarget.ForApiGateway(this, "MyApiGatewayTarget", new GatewayTargetApiGatewayProps {
    GatewayTargetName = "my-api-gateway-target",
    Description = "Target for API Gateway REST API integration",
    Gateway = gateway,
    RestApi = api,
    ApiGatewayToolConfiguration = new ApiGatewayToolConfiguration {
        ToolFilters = new [] { new ApiGatewayToolFilter {
            FilterPath = "/pets/*",
            Methods = new [] { ApiGatewayHttpMethod.GET, ApiGatewayHttpMethod.POST }
        } }
    },
    MetadataConfiguration = new MetadataConfiguration {
        AllowedRequestHeaders = new [] { "X-User-Id" },
        AllowedQueryParameters = new [] { "limit" }
    }
});
```

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"),
})

// Create a gateway target using the static factory method
apiGatewayTarget := agentcore.GatewayTarget_ForApiGateway(this, jsii.String("MyApiGatewayTarget"), &GatewayTargetApiGatewayProps{
	GatewayTargetName: jsii.String("my-api-gateway-target"),
	Description: jsii.String("Target for API Gateway REST API integration"),
	Gateway: gateway,
	RestApi: api,
	ApiGatewayToolConfiguration: &ApiGatewayToolConfiguration{
		ToolFilters: []ApiGatewayToolFilter{
			&ApiGatewayToolFilter{
				FilterPath: jsii.String("/pets/*"),
				Methods: []ApiGatewayHttpMethod{
					agentcore.ApiGatewayHttpMethod_GET(),
					agentcore.ApiGatewayHttpMethod_POST(),
				},
			},
		},
	},
	MetadataConfiguration: &MetadataConfiguration{
		AllowedRequestHeaders: []*string{
			jsii.String("X-User-Id"),
		},
		AllowedQueryParameters: []*string{
			jsii.String("limit"),
		},
	},
})
```

## Properties

- `allowedQueryParameters`: string[] — List of query parameter names to pass through to the target.

  **Default:** No query parameters are passed through

  Constraints:
  - Array must contain 1-10 items
  - Each parameter name must be 1-40 characters
  - Cannot be an empty array

- `allowedRequestHeaders`: string[] — List of request header names to pass through to the target.

  **Default:** No request headers are passed through

  Constraints:
  - Array must contain 1-10 items
  - Each header name must be 1-100 characters
  - Cannot be an empty array

- `allowedResponseHeaders`: string[] — List of response header names to pass through from the target.

  **Default:** No response headers are passed through

  Constraints:
  - Array must contain 1-10 items
  - Each header name must be 1-100 characters
  - Cannot be an empty array
