# GraphqlApiProps

Properties for an AppSync GraphQL API.

Used as props by: [GraphqlApi](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.GraphqlApi.html)

- Source: [`aws-appsync/lib/graphqlapi.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-appsync/lib/graphqlapi.ts#L418)
- Type last changed: v2.242.0 · 10 Mar 2026

## Example

TypeScript:

```ts
const schema = new appsync.SchemaFile({ filePath: 'mySchemaFile' })
new appsync.GraphqlApi(this, 'api', {
  name: 'myApi',
  definition: appsync.Definition.fromSchema(schema),
  enhancedMetricsConfig: {
    dataSourceLevelMetricsBehavior: appsync.DataSourceLevelMetricsBehavior.FULL_REQUEST_DATA_SOURCE_METRICS,
    operationLevelMetricsConfig: appsync.OperationLevelMetricsConfig.ENABLED,
    resolverLevelMetricsBehavior: appsync.ResolverLevelMetricsBehavior.FULL_REQUEST_RESOLVER_METRICS,
  },
});
```

Python:

```python
schema = appsync.SchemaFile(file_path="mySchemaFile")
appsync.GraphqlApi(self, "api",
    name="myApi",
    definition=appsync.Definition.from_schema(schema),
    enhanced_metrics_config=appsync.EnhancedMetricsConfig(
        data_source_level_metrics_behavior=appsync.DataSourceLevelMetricsBehavior.FULL_REQUEST_DATA_SOURCE_METRICS,
        operation_level_metrics_config=appsync.OperationLevelMetricsConfig.ENABLED,
        resolver_level_metrics_behavior=appsync.ResolverLevelMetricsBehavior.FULL_REQUEST_RESOLVER_METRICS
    )
)
```

Java:

```java
SchemaFile schema = SchemaFile.Builder.create().filePath("mySchemaFile").build();
GraphqlApi.Builder.create(this, "api")
        .name("myApi")
        .definition(Definition.fromSchema(schema))
        .enhancedMetricsConfig(EnhancedMetricsConfig.builder()
                .dataSourceLevelMetricsBehavior(DataSourceLevelMetricsBehavior.FULL_REQUEST_DATA_SOURCE_METRICS)
                .operationLevelMetricsConfig(OperationLevelMetricsConfig.ENABLED)
                .resolverLevelMetricsBehavior(ResolverLevelMetricsBehavior.FULL_REQUEST_RESOLVER_METRICS)
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
var schema = new SchemaFile(new SchemaProps { FilePath = "mySchemaFile" });
new GraphqlApi(this, "api", new GraphqlApiProps {
    Name = "myApi",
    Definition = Definition.FromSchema(schema),
    EnhancedMetricsConfig = new EnhancedMetricsConfig {
        DataSourceLevelMetricsBehavior = DataSourceLevelMetricsBehavior.FULL_REQUEST_DATA_SOURCE_METRICS,
        OperationLevelMetricsConfig = OperationLevelMetricsConfig.ENABLED,
        ResolverLevelMetricsBehavior = ResolverLevelMetricsBehavior.FULL_REQUEST_RESOLVER_METRICS
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
schema := appsync.NewSchemaFile(&SchemaProps{
	FilePath: jsii.String("mySchemaFile"),
})
appsync.NewGraphqlApi(this, jsii.String("api"), &GraphqlApiProps{
	Name: jsii.String("myApi"),
	Definition: appsync.Definition_FromSchema(schema),
	EnhancedMetricsConfig: &EnhancedMetricsConfig{
		DataSourceLevelMetricsBehavior: appsync.DataSourceLevelMetricsBehavior_FULL_REQUEST_DATA_SOURCE_METRICS,
		OperationLevelMetricsConfig: appsync.OperationLevelMetricsConfig_ENABLED,
		ResolverLevelMetricsBehavior: appsync.ResolverLevelMetricsBehavior_FULL_REQUEST_RESOLVER_METRICS,
	},
})
```

## Properties

- `authorizationConfig`: [AuthorizationConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.AuthorizationConfig.html) — Optional authorization configuration.

  **Default:** API Key authorization

- `definition`: [Definition](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.Definition.html) — Definition (schema file or source APIs) for this GraphQL Api.

- `domainName`: [DomainOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.DomainOptions.html) — The domain name configuration for the GraphQL API.

  **Default:** no domain name

  The Route 53 hosted zone and CName DNS record must be configured in addition to this setting to
  enable custom domain URL

- `enhancedMetricsConfig`: [EnhancedMetricsConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.EnhancedMetricsConfig.html) — Enables and controls the enhanced metrics feature.

  **Default:** Enhanced metrics disabled.

- `environmentVariables`: { [key: string]: string } — A map containing the list of resources with their properties and environment variables.

  **Default:** No environment variables.

  There are a few rules you must follow when creating keys and values:
    - Keys must begin with a letter.
    - Keys must be between 2 and 64 characters long.
    - Keys can only contain letters, numbers, and the underscore character (_).
    - Values can be up to 512 characters long.
    - You can configure up to 50 key-value pairs in a GraphQL API.

- `introspectionConfig`: [IntrospectionConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.IntrospectionConfig.html) = IntrospectionConfig.ENABLED — A value indicating whether the API to enable (ENABLED) or disable (DISABLED) introspection.

- `logConfig`: [LogConfig](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.LogConfig.html) = None — Logging configuration for this api.

- `name`: string (required) — the name of the GraphQL API.

- `ownerContact`: string — The owner contact information for an API resource.

  **Default:** No owner contact.

  This field accepts any string input with a length of 0 - 256 characters.

- `queryDepthLimit`: number — A number indicating the maximum depth resolvers should be accepted when handling queries.

  **Default:** The default value is 0 (or unspecified) which indicates no maximum depth.

  Value must be withing range of 0 to 75

- `resolverCountLimit`: number — A number indicating the maximum number of resolvers that should be accepted when handling queries.

  **Default:** The default value is 0 (or unspecified), which will set the limit to 10000

  Value must be withing range of 0 to 10000

- `schema`: [ISchema](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.ISchema.html) — use Definition.schema instead

  **Default:** schema will be generated code-first (i.e. addType, addObjectType, etc.)

  SchemaFile.fromAsset(filePath: string) allows schema definition through schema.graphql file

- `visibility`: [Visibility](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.Visibility.html) = GLOBAL — A value indicating whether the API is accessible from anywhere (GLOBAL) or can only be access from a VPC (PRIVATE).

- `xrayEnabled`: boolean = false — A flag indicating whether or not X-Ray tracing is enabled for the GraphQL API.
