# API Extensions

## GraphQL partial SDLs

This is a graphql reference page. In the llms.txt variant, those components link to the shared partial SDL key list instead of trying to resolve inline GraphQL reference content.

Fetch all available partial SDL keys first:

```text
GET https://docs.commercetools.com/apis/rest/content/by-id?id=ctp:gql-sphere:returnTypesList
```

Then fetch the one or more relevant partial SDL with a key from that list by calling the same endpoint with a schema ID:

```text
GET https://docs.commercetools.com/apis/rest/content/by-id?id=ctp:gql-sphere:schema:<key>
```

The response body is a JSON object keyed by the requested content ID. For example, the key-list request returns a `ctp:gql-sphere:returnTypesList` field and a schema request returns a `ctp:gql-sphere:schema:<key>` field.

**Queries and mutations for managing API Extensions in the platform.**

## Queries

### Query API Extensions

[fetch SDL for query extensions](#graphql-partial-sdls).

### Get API Extension

[fetch SDL for query extension](#graphql-partial-sdls).

## Mutations

### Create API Extension

[fetch SDL for mutation createExtension](#graphql-partial-sdls).

### Update API Extension

[fetch SDL for mutation updateExtension](#graphql-partial-sdls).

### Delete API Extension

[fetch SDL for mutation deleteExtension](#graphql-partial-sdls).

## Output types

### Extension

> The REST `dependencies` field is available only as `dependenciesRef`, which returns a list of [References](/search.md?urn=ctp:api:type:Reference). To set dependencies, use `dependencies` in [ExtensionDraft](/api/graphql/api-extensions.md#extensiondraft) or the [Set Dependencies](/api/graphql/api-extensions.md#set-dependencies) update action. Both take ResourceIdentifiers.

[fetch SDL for type Extension](#graphql-partial-sdls).

### ExtensionQueryResult

[fetch SDL for type ExtensionQueryResult](#graphql-partial-sdls).

#### Trigger

> This type is equivalent to [ExtensionTrigger](/search.md?urn=ctp:api:type:ExtensionTrigger) in REST. In GraphQL, `resourceTypeId` is a `String`, not an enum. It accepts the values listed in [ExtensionResourceTypeId](/search.md?urn=ctp:api:type:ExtensionResourceTypeId).

[fetch SDL for type Trigger](#graphql-partial-sdls).

#### ActionType

[fetch SDL for type ActionType](#graphql-partial-sdls).

#### ExtensionAdditionalContext

[fetch SDL for type ExtensionAdditionalContext](#graphql-partial-sdls).

#### ExtensionDestination

[fetch SDL for type ExtensionDestination](#graphql-partial-sdls).

#### AWSLambdaDestination

[fetch SDL for type AWSLambdaDestination](#graphql-partial-sdls).

#### GoogleCloudFunctionDestination

[fetch SDL for type GoogleCloudFunctionDestination](#graphql-partial-sdls).

#### HttpDestination

[fetch SDL for type HttpDestination](#graphql-partial-sdls).

#### HttpDestinationAuthentication

[fetch SDL for type HttpDestinationAuthentication](#graphql-partial-sdls).

#### AuthorizationHeader

[fetch SDL for type AuthorizationHeader](#graphql-partial-sdls).

#### AzureFunctionsAuthentication

[fetch SDL for type AzureFunctionsAuthentication](#graphql-partial-sdls).

## Input types

### ExtensionDraft

[fetch SDL for type ExtensionDraft](#graphql-partial-sdls).

#### TriggerInput

[fetch SDL for type TriggerInput](#graphql-partial-sdls).

#### ExtensionDestinationInput

> REST identifies the destination with a `type` field. In GraphQL, the input has one field per destination type instead: `HTTP`, `AWSLambda`, and `GoogleCloudFunction`. These names match the `type` values of [ExtensionDestination](/search.md?urn=ctp:api:type:ExtensionDestination) in REST. The same applies to [HttpDestinationAuthenticationInput](/api/graphql/api-extensions.md#httpdestinationauthenticationinput), which has the fields `AuthorizationHeader` and `AzureFunctions`.

[fetch SDL for type ExtensionDestinationInput](#graphql-partial-sdls).

#### AWSLambdaDestinationInput

[fetch SDL for type AWSLambdaDestinationInput](#graphql-partial-sdls).

#### HttpDestinationInput

[fetch SDL for type HttpDestinationInput](#graphql-partial-sdls).

#### GoogleCloudFunctionDestinationInput

[fetch SDL for type GoogleCloudFunctionDestinationInput](#graphql-partial-sdls).

#### AzureFunctionsAuthenticationInput

[fetch SDL for type AzureFunctionsAuthenticationInput](#graphql-partial-sdls).

#### HttpDestinationAuthenticationInput

[fetch SDL for type HttpDestinationAuthenticationInput](#graphql-partial-sdls).

#### AuthorizationHeaderInput

[fetch SDL for type AuthorizationHeaderInput](#graphql-partial-sdls).

#### ExtensionAdditionalContextInput

[fetch SDL for type ExtensionAdditionalContextInput](#graphql-partial-sdls).

### ExtensionUpdateAction

[fetch SDL for type ExtensionUpdateAction](#graphql-partial-sdls).

### Update actions

#### Change Destination

[fetch SDL for type ChangeExtensionDestination](#graphql-partial-sdls).

#### Change Triggers

[fetch SDL for type ChangeExtensionTriggers](#graphql-partial-sdls).

#### Set Additional Context

[fetch SDL for type SetExtensionAdditionalContext](#graphql-partial-sdls).

#### Set Expansion Paths

[fetch SDL for type SetExtensionExpansionPaths](#graphql-partial-sdls).

#### Set Dependencies

[fetch SDL for type SetExtensionDependencies](#graphql-partial-sdls).

#### Set Key

[fetch SDL for type SetExtensionKey](#graphql-partial-sdls).

#### Set TimeoutInMs

[fetch SDL for type SetExtensionTimeoutInMs](#graphql-partial-sdls).

## Related pages

- [Area overview page with navigation](/api.md)
- [Previous page: REST](/api/projects/api-extensions.md)
- [Search documentation and API specs](/search.md)