# Variants

## 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 Variants in the platform.**

## Queries

### Query Variants

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

### Get Variant

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

## Mutations

### Create Variant

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

### Update Variant

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

### Delete Variant

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

### Bulk update Variants

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

## Output types

### Variant

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

### VariantQueryResult

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

### VariantDeletionResult

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

### BulkUpdateVariantsResponse

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

## Input types

### VariantDraft

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

### VariantUpdateAction

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

### BulkUpdateVariantsInput

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

### VariantBulkAction

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

### Update actions

#### Publish

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

#### Unpublish

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

#### Remove Staged Changes

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

#### Remove Asset

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

#### Move Image To Position

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

#### Add External Image

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

#### Add Asset

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

#### Change Asset Name

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

#### Change Asset Order

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

#### Remove Image

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

#### Set Assets

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

#### Set Attribute

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

#### Set Attributes

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

#### Set Image Label

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

#### Set Images

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

#### Set Key

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

#### Set SKU

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

#### Set Asset Custom Field

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

#### Set Asset Custom Type

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

#### Set Asset Description

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

#### Set Asset Key

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

#### Set Asset Sources

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

#### Set Asset Tags

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

## Related pages

- [Search documentation and API specs](/search.md)