# States States allow you to model finite state machines that reflect your custom business logic. States can be combined together by defining `transitions` between each State. `transitionState` update actions are validated to ensure the transition complies with the workflow definition. If the `transitions` field is not set, no validation is performed. This is useful when an external system executes the workflow and the current State is to be saved. States are available for the following resources: - [Orders](https://docs.commercetools.com/api/projects/orders.md#order) - [LineItems](https://docs.commercetools.com/api/projects/carts.md#lineitem) - [CustomLineItems](https://docs.commercetools.com/api/projects/carts.md#customlineitem) To transition a Line Item or Custom Line Item to a new state, use the [TransitionState](https://docs.commercetools.com/api/projects/orders.md#transition-state) update action on the Order. - [Payments](https://docs.commercetools.com/api/projects/payments.md#payment) - [Products](https://docs.commercetools.com/api/projects/products.md#product) - [Recurring Orders](https://docs.commercetools.com/api/projects/recurring-orders.md#recurringorder) - [Reviews](https://docs.commercetools.com/api/projects/reviews.md#review) - [Quote Requests](https://docs.commercetools.com/api/projects/quote-requests.md#quoterequest) - [Quotes](https://docs.commercetools.com/api/projects/quotes.md#quote) - [Staged Quotes](https://docs.commercetools.com/api/projects/staged-quotes.md#stagedquote) Learn more about States in our self-paced Model and manage business processes with States module. ## Representations #### State See API type definition [State](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AState). #### StateDraft See API type definition [StateDraft](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateDraft). #### StatePagedQueryResponse See API type definition [StatePagedQueryResponse](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStatePagedQueryResponse). #### StateReference See API type definition [StateReference](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateReference). #### StateKeyReference See API type definition [StateKeyReference](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aimport%3Atype%3AStateKeyReference). #### StateResourceIdentifier See API type definition [StateResourceIdentifier](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateResourceIdentifier). #### StateTypeEnum See API type definition [StateTypeEnum](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateTypeEnum). #### StateRoleEnum See API type definition [StateRoleEnum](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateRoleEnum). ## Get State ### Get State by ID Deprecated OAuth 2.0 scope: `view_orders:{projectKey}` See API endpoint definition [GET /\{projectKey}/states/\{id}](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%2F%7Bid%7D%3AGET). ### Get State by Key Deprecated OAuth 2.0 scope: `view_orders:{projectKey}` See API endpoint definition [GET /\{projectKey}/states/key=\{key}](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%2Fkey%3D%7Bkey%7D%3AGET). ## Query States Deprecated OAuth 2.0 scope: `view_orders:{projectKey}` See API endpoint definition [GET /\{projectKey}/states](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%3AGET). ## Check if State exists ### Check if State exists by ID See API endpoint definition [HEAD /\{projectKey}/states/\{id}](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%2F%7Bid%7D%3AHEAD). ### Check if State exists by Key See API endpoint definition [HEAD /\{projectKey}/states/key=\{key}](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%2Fkey%3D%7Bkey%7D%3AHEAD). ### Check if State exists by Query Predicate See API endpoint definition [HEAD /\{projectKey}/states](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%3AHEAD). ## Create State Deprecated OAuth 2.0 scope: `manage_orders:{projectKey}` See API endpoint definition [POST /\{projectKey}/states](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%3APOST). ## Update State ### Update State by ID Deprecated OAuth 2.0 scope: `manage_orders:{projectKey}` See API endpoint definition [POST /\{projectKey}/states/\{id}](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%2F%7Bid%7D%3APOST). ### Update State by Key Deprecated OAuth 2.0 scope: `manage_orders:{projectKey}` See API endpoint definition [POST /\{projectKey}/states/key=\{key}](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%2Fkey%3D%7Bkey%7D%3APOST). ## Update actions #### Change State key See API type definition [StateChangeKeyAction](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateChangeKeyAction). #### Set State name See API type definition [StateSetNameAction](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateSetNameAction). #### Set State description See API type definition [StateSetDescriptionAction](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateSetDescriptionAction). #### Change State type See API type definition [StateChangeTypeAction](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateChangeTypeAction). #### Change initial State See API type definition [StateChangeInitialAction](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateChangeInitialAction). #### Set transitions See API type definition [StateSetTransitionsAction](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateSetTransitionsAction). #### Set State roles See API type definition [StateSetRolesAction](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateSetRolesAction). #### Add State roles See API type definition [StateAddRolesAction](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateAddRolesAction). #### Remove State roles See API type definition [StateRemoveRolesAction](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Atype%3AStateRemoveRolesAction). ## Delete State ### Delete State by ID Deprecated OAuth 2.0 scope: `manage_orders:{projectKey}` See API endpoint definition [DELETE /\{projectKey}/states/\{id}](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%2F%7Bid%7D%3ADELETE). ### Delete State by Key Deprecated OAuth 2.0 scope: `manage_orders:{projectKey}` See API endpoint definition [DELETE /\{projectKey}/states/key=\{key}](https://docs.commercetools.com/api/projects/states.md?urn=ctp%3Aapi%3Aendpoint%3A%2F%7BprojectKey%7D%2Fstates%2Fkey%3D%7Bkey%7D%3ADELETE). ## Related pages - [Section overview page](https://docs.commercetools.com/api.md) - [Previous page: Events](https://docs.commercetools.com/api/events.md)