# CfnGraphQLApi

The `AWS::AppSync::GraphQLApi` resource creates a new AWS AppSync GraphQL API.

This is the top-level construct for your application. For more information, see [Quick Start](https://docs.aws.amazon.com/appsync/latest/devguide/quickstart.html) in the *AWS AppSync Developer Guide* .

Extends: Construct › CfnElement › CfnRefElement › CfnResource › CfnGraphQLApi
Implements: IInspectable, ITaggable, IEnvironmentAware, IGraphQLApiRef, IConstruct, IDependable

- CloudFormation: [`AWS::AppSync::GraphQLApi`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-appsync-graphqlapi.html)
- Source: Generated code
- Type last changed: v2.252.0 · 30 Apr 2026

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';
const cfnGraphQLApi = new appsync.CfnGraphQLApi(this, 'MyCfnGraphQLApi', {
  authenticationType: 'authenticationType',
  name: 'name',

  // the properties below are optional
  additionalAuthenticationProviders: [{
    authenticationType: 'authenticationType',

    // the properties below are optional
    lambdaAuthorizerConfig: {
      authorizerResultTtlInSeconds: 123,
      authorizerUri: 'authorizerUri',
      identityValidationExpression: 'identityValidationExpression',
    },
    openIdConnectConfig: {
      authTtl: 123,
      clientId: 'clientId',
      iatTtl: 123,
      issuer: 'issuer',
    },
    userPoolConfig: {
      appIdClientRegex: 'appIdClientRegex',
      awsRegion: 'awsRegion',
      userPoolId: 'userPoolId',
    },
  }],
  apiType: 'apiType',
  enhancedMetricsConfig: {
    dataSourceLevelMetricsBehavior: 'dataSourceLevelMetricsBehavior',
    operationLevelMetricsConfig: 'operationLevelMetricsConfig',
    resolverLevelMetricsBehavior: 'resolverLevelMetricsBehavior',
  },
  environmentVariables: {
    environmentVariablesKey: 'environmentVariables',
  },
  introspectionConfig: 'introspectionConfig',
  lambdaAuthorizerConfig: {
    authorizerResultTtlInSeconds: 123,
    authorizerUri: 'authorizerUri',
    identityValidationExpression: 'identityValidationExpression',
  },
  logConfig: {
    cloudWatchLogsRoleArn: 'cloudWatchLogsRoleArn',
    fieldLogLevel: 'fieldLogLevel',

    // the properties below are optional
    excludeVerboseContent: false,
  },
  mergedApiExecutionRoleArn: 'mergedApiExecutionRoleArn',
  openIdConnectConfig: {
    authTtl: 123,
    clientId: 'clientId',
    iatTtl: 123,
    issuer: 'issuer',
  },
  ownerContact: 'ownerContact',
  queryDepthLimit: 123,
  resolverCountLimit: 123,
  tags: [{
    key: 'key',
    value: 'value',
  }],
  userPoolConfig: {
    appIdClientRegex: 'appIdClientRegex',
    awsRegion: 'awsRegion',
    defaultAction: 'defaultAction',
    userPoolId: 'userPoolId',
  },
  visibility: 'visibility',
  xrayEnabled: false,
});
```

## Initializer

```ts
new CfnGraphQLApi(scope: Construct, id: string, props: CfnGraphQLApiProps)
```

## Construct Props

- `additionalAuthenticationProviders`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGraphQLApi.AdditionalAuthenticationProviderProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.AdditionalAuthenticationProviderProperty.html)[] — A list of additional authentication providers for the `GraphqlApi` API.

- `apiType`: string — The value that indicates whether the GraphQL API is a standard API ( `GRAPHQL` ) or merged API ( `MERGED` ).

  *WARNING* : If the `ApiType` has not been defined, *explicitly* setting it to `GRAPHQL` in a template/stack update will result in an API replacement and new DNS values.

  The following values are valid:

  `GRAPHQL | MERGED`

- `authenticationType`: string (required) — Security configuration for your GraphQL API.

  For allowed values (such as `API_KEY` , `AWS_IAM` , `AMAZON_COGNITO_USER_POOLS` , `OPENID_CONNECT` , or `AWS_LAMBDA` ), see [Security](https://docs.aws.amazon.com/appsync/latest/devguide/security.html) in the *AWS AppSync Developer Guide* .

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

  Enhanced metrics emit granular data on API usage and performance such as AppSync request and error counts, latency, and cache hits/misses. All enhanced metric data is sent to your CloudWatch account, and you can configure the types of data that will be sent.

  Enhanced metrics can be configured at the resolver, data source, and operation levels. For more information, see [Monitoring and logging](https://docs.aws.amazon.com//appsync/latest/devguide/monitoring.html#cw-metrics) in the *AWS AppSync User Guide* .

- `environmentVariables`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | { [key: string]: string } — A map containing the list of resources with their properties and environment variables.

  For more information, see [Environmental variables](https://docs.aws.amazon.com/appsync/latest/devguide/environmental-variables.html) .

  *Pattern* : `^[A-Za-z]+\\w*$\\`

  *Minimum* : 2

  *Maximum* : 64

- `introspectionConfig`: string — Sets the value of the GraphQL API to enable ( `ENABLED` ) or disable ( `DISABLED` ) introspection.

  If no value is provided, the introspection configuration will be set to `ENABLED` by default. This field will produce an error if the operation attempts to use the introspection feature while this field is disabled.

  For more information about introspection, see [GraphQL introspection](https://docs.aws.amazon.com/https://graphql.org/learn/introspection/) .

- `lambdaAuthorizerConfig`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGraphQLApi.LambdaAuthorizerConfigProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.LambdaAuthorizerConfigProperty.html) — A `LambdaAuthorizerConfig` holds configuration on how to authorize AWS AppSync API access when using the `AWS_LAMBDA` authorizer mode.

  Be aware that an AWS AppSync API may have only one Lambda authorizer configured at a time.

- `logConfig`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGraphQLApi.LogConfigProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.LogConfigProperty.html) — The Amazon CloudWatch Logs configuration.

- `mergedApiExecutionRoleArn`: string — The AWS Identity and Access Management service role ARN for a merged API.

  The AppSync service assumes this role on behalf of the Merged API to validate access to source APIs at runtime and to prompt the `AUTO_MERGE` to update the merged API endpoint with the source API changes automatically.

- `name`: string (required) — The API name.

- `openIdConnectConfig`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGraphQLApi.OpenIDConnectConfigProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.OpenIDConnectConfigProperty.html) — The OpenID Connect configuration.

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

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

- `queryDepthLimit`: number — The maximum depth a query can have in a single request.

  Depth refers to the amount of nested levels allowed in the body of query. The default value is `0` (or unspecified), which indicates there's no depth limit. If you set a limit, it can be between `1` and `75` nested levels. This field will produce a limit error if the operation falls out of bounds. Note that fields can still be set to nullable or non-nullable. If a non-nullable field produces an error, the error will be thrown upwards to the first nullable field available.

- `resolverCountLimit`: number — The maximum number of resolvers that can be invoked in a single request.

  The default value is `0` (or unspecified), which will set the limit to `10000` . When specified, the limit value can be between `1` and `10000` . This field will produce a limit error if the operation falls out of bounds.

- `tags`: [CfnTag](/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — An arbitrary set of tags (key-value pairs) for this GraphQL API.

- `userPoolConfig`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGraphQLApi.UserPoolConfigProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.UserPoolConfigProperty.html) — Optional authorization configuration for using Amazon Cognito user pools with your GraphQL endpoint.

- `visibility`: string — Sets the scope of the GraphQL API to public ( `GLOBAL` ) or private ( `PRIVATE` ).

  By default, the scope is set to `Global` if no value is provided.

  *WARNING* : If `Visibility` has not been defined, *explicitly* setting it to `GLOBAL` in a template/stack update will result in an API replacement and new DNS values.

- `xrayEnabled`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — A flag indicating whether to use AWS X-Ray tracing for this `GraphqlApi` .

## Properties

- `additionalAuthenticationProviders`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGraphQLApi.AdditionalAuthenticationProviderProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.AdditionalAuthenticationProviderProperty.html)[] — A list of additional authentication providers for the `GraphqlApi` API.

- `apiType`: string — The value that indicates whether the GraphQL API is a standard API ( `GRAPHQL` ) or merged API ( `MERGED` ).

- `attrApiId`: string — Unique AWS AppSync GraphQL API identifier.

- `attrArn`: string — The Amazon Resource Name (ARN) of the API key, such as `arn:aws:appsync:us-east-1:123456789012:apis/graphqlapiid` .

- `attrGraphQlDns`: string — The fully qualified domain name (FQDN) of the endpoint URL of your GraphQL API.

- `attrGraphQlEndpointArn`: string — The GraphQL endpoint ARN.

- `attrGraphQlUrl`: string — The Endpoint URL of your GraphQL API.

- `attrRealtimeDns`: string — The fully qualified domain name (FQDN) of the real-time endpoint URL of your GraphQL API.

- `attrRealtimeUrl`: string — The GraphQL API real-time endpoint URL.

  For more information, see [Discovering the real-time endpoint from the GraphQL endpoint](https://docs.aws.amazon.com/appsync/latest/devguide/real-time-websocket-client.html#handshake-details-to-establish-the-websocket-connection) .

- `authenticationType`: string — Security configuration for your GraphQL API.

- `CFN_RESOURCE_TYPE_NAME`: string (static) — The CloudFormation resource type name for this resource class.

- `cfnOptions`: [ICfnResourceOptions](/cdk/api/v2/docs/aws-cdk-lib.ICfnResourceOptions.html) — Options for this resource, such as condition, update policy etc.

- `cfnResourceType`: string — AWS resource type.

- `creationStack`: string[]

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

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html)

- `environmentVariables`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | { [key: string]: string } — A map containing the list of resources with their properties and environment variables.

- `graphQlApiRef`: [GraphQLApiReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_appsync.GraphQLApiReference.html) — A reference to a GraphQLApi resource.

- `introspectionConfig`: string — Sets the value of the GraphQL API to enable ( `ENABLED` ) or disable ( `DISABLED` ) introspection.

- `lambdaAuthorizerConfig`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGraphQLApi.LambdaAuthorizerConfigProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.LambdaAuthorizerConfigProperty.html) — A `LambdaAuthorizerConfig` holds configuration on how to authorize AWS AppSync API access when using the `AWS_LAMBDA` authorizer mode.

- `logConfig`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGraphQLApi.LogConfigProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.LogConfigProperty.html) — The Amazon CloudWatch Logs configuration.

- `logicalId`: string — The logical ID for this CloudFormation stack element.

  The logical ID of the element
  is calculated from the path of the resource node in the construct tree.

  To override this value, use `overrideLogicalId(newLogicalId)`.

- `mergedApiExecutionRoleArn`: string — The AWS Identity and Access Management service role ARN for a merged API.

- `name`: string — The API name.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `openIdConnectConfig`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGraphQLApi.OpenIDConnectConfigProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.OpenIDConnectConfigProperty.html) — The OpenID Connect configuration.

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

- `queryDepthLimit`: number — The maximum depth a query can have in a single request.

- `ref`: string — Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.

  If, by any chance, the intrinsic reference of a resource is not a string, you could
  coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`.

- `resolverCountLimit`: number — The maximum number of resolvers that can be invoked in a single request.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this element is defined.

  CfnElements must be defined within a stack scope (directly or indirectly).

- `tags`: [TagManager](/cdk/api/v2/docs/aws-cdk-lib.TagManager.html) — Tag Manager which manages the tags for this resource.

- `tagsRaw`: [CfnTag](/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — An arbitrary set of tags (key-value pairs) for this GraphQL API.

- `userPoolConfig`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnGraphQLApi.UserPoolConfigProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.UserPoolConfigProperty.html) — Optional authorization configuration for using Amazon Cognito user pools with your GraphQL endpoint.

- `visibility`: string — Sets the scope of the GraphQL API to public ( `GLOBAL` ) or private ( `PRIVATE` ).

- `xrayEnabled`: boolean | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — A flag indicating whether to use AWS X-Ray tracing for this `GraphqlApi` .

## Methods

- `addDeletionOverride(path: string): void` — Syntactic sugar for `addOverride(path, undefined)`.

  **Parameters**

  - `path` — The path of the value to delete.

- `addDependency(target: CfnResource): void` — Use `addResourceDependency` instead.

  This method has been renamed to `addResourceDependency` to more clearly
  set it apart from `construct.node.addDependency`. See the documentation
  of that function for more details.

- `addDependsOn(target: CfnResource): void` — Use `addResourceDependency` instead.

  This can be used for resources across stacks (or nested stack) boundaries
  and the dependency will automatically be transferred to the relevant scope.

  This method has been renamed to `addResourceDependency`, which makes it
  more clear that this method operates at a different level from the
  construct-level `construct.node.addDependency()` mechanism.

- `addMetadata(key: string, value: any): void` — Add a value to the CloudFormation Resource Metadata.

- `addOverride(path: string, value: any): void` — Adds an override to the synthesized CloudFormation resource.

  To add a
  property override, either use `addPropertyOverride` or prefix `path` with
  "Properties." (i.e. `Properties.TopicName`).

  If the override is nested, separate each nested level using a dot (.) in the path parameter.
  If there is an array as part of the nesting, specify the index in the path.

  To include a literal `.` in the property name, prefix with a `\`. In most
  programming languages you will need to write this as `"\\."` because the
  `\` itself will need to be escaped.

  For example,
  ```typescript
  cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
  cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');
  ```
  would add the overrides
  ```json
  "Properties": {
    "GlobalSecondaryIndexes": [
      {
        "Projection": {
          "NonKeyAttributes": [ "myattribute" ]
          ...
        }
        ...
      },
      {
        "ProjectionType": "INCLUDE"
        ...
      },
    ]
    ...
  }
  ```

  The `value` argument to `addOverride` will not be processed or translated
  in any way. Pass raw JSON values in here with the correct capitalization
  for CloudFormation. If you pass CDK classes or structs, they will be
  rendered with lowercased key names, and CloudFormation will reject the
  template.

  **Parameters**

  - `path` — - The path of the property, you can use dot notation to override values in complex types.
  - `value` — - The value.

- `addPropertyDeletionOverride(propertyPath: string): void` — Adds an override that deletes the value of a property from the resource definition.

  **Parameters**

  - `propertyPath` — The path to the property.

- `addPropertyOverride(propertyPath: string, value: any): void` — Adds an override to a resource property.

  Syntactic sugar for `addOverride("Properties.<...>", value)`.

  **Parameters**

  - `propertyPath` — The path of the property.
  - `value` — The value.

- `addResourceDependency(target: CfnResource, reason?: string): void` — Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

  This can be used for resources across stacks (or nested stack) boundaries
  and the dependency will automatically be transferred to the relevant scope.

  This method only adds dependencies between L1 resources. If you are
  looking for a generic construct-to-construct dependency mechanism that works
  for all constructs including L2s, use `construct.node.addDependency` instead.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Sets the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  strength instead of the global default from the consuming stack's context.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void` — Sets the deletion policy of the resource based on the removal policy specified.

  The Removal Policy controls what happens to this resource when it stops
  being managed by CloudFormation, either because you've removed it from the
  CDK application or because you've made a change that requires the resource
  to be replaced.

  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some
  cases, a snapshot can be taken of the resource prior to deletion
  (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy
  can be found in the following link:

- `arnForGraphQLApi(resource: IGraphQLApiRef): string` (static)

- `cfnPropertyName(cdkPropertyName: string): string`

- `getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Reference` — Returns a token for an runtime attribute of this resource.

  Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility
  in case there is no generated attribute.

  **Parameters**

  - `attributeName` — The name of the attribute.

- `getMetadata(key: string): any` — Retrieve a value value from the CloudFormation Resource Metadata.

- `inspect(inspector: TreeInspector): void` — Examines the CloudFormation resource and discloses attributes.

  **Parameters**

  - `inspector` — tree inspector to collect and process attributes.

- `isCfnElement(x: any): boolean` (static) — Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

  Uses duck-typing instead of `instanceof` to allow stack elements from different
  versions of this library to be included in the same stack.

  **Returns:** The construct as a stack element or undefined if it is not a stack element.

- `isCfnGraphQLApi(x: any): boolean` (static) — Checks whether the given object is a CfnGraphQLApi.

- `isCfnResource(x: any): boolean` (static) — Check whether the given object is a CfnResource.

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `obtainDependencies(): Stack | CfnResource[]` — Retrieves an array of resources and stacks this resource depends on.

  For resources depended on directly, returns the `CfnResource` object. For
  dependencies on other stacks, returns the `Stack` object. The order of the
  array is not guaranteed.

- `overrideLogicalId(newLogicalId: string): void` — Overrides the auto-generated logical ID with a specific ID.

  **Parameters**

  - `newLogicalId` — The new logical ID to use for this stack element.

- `removeDependency(target: CfnResource): void` — Use `removeResourceDependency` instead

  This can be used for resources across stacks (including nested stacks)
  and the dependency will automatically be removed from the relevant scope.

- `removeResourceDependency(target: CfnResource): void` — Indicates that this resource no longer depends on another resource.

  This can be used for resources across stacks (including nested stacks)
  and the dependency will automatically be removed from the relevant scope.

- `replaceDependency(target: CfnResource, newTarget: CfnResource): void` — Replaces one dependency with another.

  **Parameters**

  - `target` — The dependency to replace.
  - `newTarget` — The new dependency to add.

- `toString(): string` — Returns a string representation of this construct.

  **Returns:** a string representation of this resource

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
