# States

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

## Queries

### Query States

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

### Get State

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

## Mutations

### Create State

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

### Update State

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

### Delete State

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

## Output types

### State

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

### StateQueryResult

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

#### StateType

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

#### StateRole

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

## Input types

### StateDraft

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

### StateUpdateAction

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

### Update actions

#### Add Roles

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

#### Change Initial

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

#### Change Key

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

#### Change Type

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

#### Remove Roles

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

#### Set Description

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

#### Set Name

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

#### Set Roles

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

#### Set Transitions

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

## Related pages

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