Project configuration APIs overview

Ask about this Page
Copy for AI
View as Markdown

How to work with the APIs for configuring your Projects.

This page describes rules that apply across the Project configuration APIs. For what Projects, Stores, Channels, and Tax Categories are and how they behave, see the Project configuration overview.
Use the commercetools CLI to work with this API from your terminal or AI coding agent.

APIs

ResourcePurposeReference
ProjectView and manage Project-wide settings, such as countries, languages, and currencies.Project
StoresModel the context your customers shop in.Stores
ChannelsModel a source or destination of entities, such as warehouses or stores. A Channel has one or more roles, such as inventory supply or product distribution.Channels
Tax CategoriesDefine how Products are taxed in different countries.Tax Categories

Data model

The Project configuration resources are stored as the entities in this section. The section describes the relationships, identifiers, and roles of each entity, using names that REST and GraphQL share. For the complete field list of an entity, follow the link to its type. For naming differences between the two APIs, see Differences between REST and GraphQL.

Entity relationships

The following diagram shows the entities and their main relationships. For all references, see the table after the diagram. A Project owns all of them. A Store references Channels and Product Selections, a Tax Category embeds its Tax Rates, and Products and Shipping Methods reference a Tax Category.

The following table lists each relationship, including references that other resources hold to these entities:

FromToCardinalityKindRule
ProjectStore, Channel, Tax CategoryOne to manyOwnershipEach Store, Channel, and Tax Category belongs to exactly one Project.
StoreChannel, through distributionChannelsMany to manyReferenceA Channel can be linked to several Stores. The Channel must have the ProductDistribution role. For the maximum number per Store, see Limits.
StoreChannel, through supplyChannelsMany to manyReferenceA Channel can be linked to several Stores. The Channel must have the InventorySupply role. For the maximum number per Store, see Limits.
StoreProduct SelectionMany to manyEmbedded setting that holds a referenceEach ProductSelectionSetting has an active flag. For how the settings determine the Products of a Store, see Products available in Store.
Tax CategoryTax RateOne to manyEmbeddedThe Tax Rates are in the rates array of the Tax Category.
Tax RateSub RateOne to manyEmbeddedThe amounts of all subrates add up to the amount of the Tax Rate.
Product, Shipping Method, Custom Line ItemTax CategoryMany to oneReferenceRequired for a Shipping Method, optional for a Product and a Custom Line Item.
Inventory Entry, Line Item, Store, Price, Standalone Price, Cart Discount gift Line ItemChannelMany to oneReferenceBlocks deletion of the Channel. See Delete Channels.
Resources with a store reference, such as Cart and OrderStoreMany to oneReferenceIf a resource references the Store, deleting the Store returns a ReferenceExists error. See Delete Store.

Keys and identifiers

  • Project: has no id. Its user-defined key identifies it.
  • Store: has an id and a key. The key is user-defined, unique, and immutable.
  • Channel: has an id and a user-defined, unique key.
  • Tax Category: has an id and an optional key.
  • Tax Rate: has its own id and an optional key. The key is unique within the Tax Category that contains the Tax Rate.

Channel roles

A Channel has one or more roles. The InventorySupply role makes a Channel a supply Channel, and the ProductDistribution role makes it a distribution Channel. For all roles, including the synchronization roles and Primary, see ChannelRoleEnum.

Working with the APIs

Project

Through the API, you view and update an existing Project. The Project holds the countries, currencies, and languages of the business, as described in Multi-region configuration. It also embeds one configuration object for each feature, as described in Project settings.

Project settings

A Project has a field for each of the following configurable features. For all fields and allowed values of a setting, see its linked type.

SettingWhat it configuresDefaultLearn more
messagesQuerying of Messages about state changes in the Project, and how long Messages are kept.Querying is off by default. When on, Messages are kept for 15 days (deleteDaysAfterCreation).Message Query
cartsDefaults for new Carts: the retention period, the rounding of prices and taxes, and whether the Tax Rate of a country without a state is a fallback when the Tax Rates don't cover the state of the shipping address.Carts are deleted 90 days after the last modification (deleteDaysAfterLastModification). Country Tax Rate fallback is off (countryTaxRateFallbackEnabled). Prices and taxes are rounded HalfEven (priceRoundingMode and taxRoundingMode).CartsConfiguration
shoppingListsThe retention period of new Shopping Lists.Shopping Lists are deleted 360 days after the last modification (deleteDaysAfterLastModification).ShoppingListsConfiguration
shippingRateInputTypeThe input that tiered shipping rates use to calculate shipping costs, such as order value or weight.Not set.Tiered shipping rates
externalOAuthThe OAuth endpoint and authentication header for an external Identity Provider.Not set.Request an access token using an external OAuth server
searchIndexingIndexing of resources for search.Not set.Search indexing
businessUnitsThe configuration of Business Units to manage organizational structures, such as the status of a Business Unit that an Associate creates.Business Units that Associates create are Inactive (myBusinessUnitStatusOnCreation).BusinessUnitConfiguration
inventoryThe expiration of Reservations, which the ReserveOnCart inventory mode needs, and whether expired Reservations make the reserved stock available again.Expired Reservations are released (releaseExpiredReservations is true).InventoryConfiguration and Reservations
discountsHow Product Discounts and Cart Discounts combine for Line Items in every Cart of the Project.Stacking (discountCombinationMode).DiscountsConfiguration and Discount interaction in Carts
productCatalogModelHow Product Variants are managed in the Project.Classic.ProductCatalogModel and the migration guide

Multi-region configuration

To configure your Project for multiple regions, set the following fields:

  • countries: define the countries where your Project operates. The APIs support ISO-3166 alpha-2 country codes. This enables you to manage shipping, taxes, and legal compliance across different countries. For example, you can set up a Project that operates in the US, UK, and Germany by specifying the respective country codes: [ "US", "GB", "DE" ].
  • currencies: specify the currencies used in your Project. This allows transactions in multiple currencies. Set multiple ISO 4217 currency codes in an array, such as [ "USD", "GBP", "EUR" ], to support transactions in US Dollars, British Pounds, and Euros. Enabled currencies are available and visible for Products, Prices, and Orders in your Project to calculate Prices and handle transactions.
  • languages: set the languages supported by your Project. This provides a localized shopping experience for customers in different Regions. You can specify multiple languages using IETF language tags, such as [ "en-US", "fr", "de" ], to support English, French, and German. After you set the languages, all resources in your Project have corresponding localized fields, such as name and description, so you can provide tailored content for each language.
For more details on commercetools API common types related to multi-region configuration, see Localization.

Store

A Store limits the data and the permissions that apply to its resources. The following rules apply when you work with Stores through the APIs. For how a Store limits the Prices, stock, and languages in Product Projections, see Price projection by Store.

Store-scoped API methods

Store-scoped API methods let you work with resources in a specific Store. They scope reads and writes to the named Store, so only data relevant to that Store is affected.

Permissions can be granted for particular Stores only.

For example, with an OAuth Scope like manage_orders:acme-inc:luxury-brand, an API Client can only access Carts and Orders within the Luxury Brand Store, but not within the Budget Brand Store.
Your API Client must have Store-related scopes, for example manage_orders:{projectKey}:{storeKey}, to call Store-scoped API methods.
For use of Store-scoped methods in GraphQL, see Store-scoped queries and mutations.
For the Store-scoped API methods of each resource, see Stores.

Products available in Store

Which Products are available in a Store depends on the Product Selections in the Store's productSelections field. A Product Selection with Individual ProductSelectionMode includes Products, and one with IndividualExclusion excludes them. Each Product Selection is either active or inactive in the Store. The following rules decide which Products are available:
  • If the Store has no Product Selections, all Products in the Project are available.
  • If at least one of the Store's Product Selections is active, only the active ones count. Inactive Product Selections have no effect.
    • If only exclusion Product Selections are active, all Products are available except those whose Product Variants are all excluded by the active exclusion Product Selections.
    • If at least one inclusion Product Selection is active, a Product is available only if it is included in at least one active inclusion Product Selection and at least one selected Product Variant remains after active exclusions are applied. Exclusions can affect an entire Product or specific Product Variants. For variant-level rules, see Product Variants in Store.
  • If all of the Store's Product Selections are inactive, no Product is available when the Store has at least one inclusion Product Selection. If the Store has only exclusion Product Selections, all Products are available.

Channel

Supply Channel on Line Items

After the disposition process, Line Items can get supply Channel information that would uniquely identify the Inventory entries that should be reserved. The supplyChannel field of the Line Item references the Channel.

Delete Channels

A Channel can only be deleted if it is not referenced by an InventoryEntry, a LineItem, a Store, a Price, a StandalonePrice, or a CartDiscountValueGiftLineItem.
To avoid dependency conflicts and errors, delete resources that reference the Channel in the correct order before deleting the Channel itself. You must delete all active and anonymous Carts that reference the Channel first, then delete the Orders that reference the Channel, and finally delete the Stores that reference the Channel before you can safely delete the Channel itself.

Tax Category

A TaxCategory embeds its TaxRates in the rates array, as shown in Entity relationships. For the fields of a TaxRate, such as state, subRates, and includedInPrice, see TaxRate.
By default, a TaxRate without a state matches only a Cart whose shipping address has no state either. If countryTaxRateFallbackEnabled is enabled in the carts Project setting, such a TaxRate also applies when no TaxRate covers the state of the shipping address.
For how a Cart selects a TaxRate, see Tax rate selection.

Differences between REST and GraphQL

The entities and field names are the same in both APIs, with the following exceptions:

  • GraphQL exposes the Project as ProjectProjection.
  • GraphQL calls the Channel role enum ChannelRole. Its values match the REST ChannelRoleEnum.
  • For Channels of a Store, GraphQL returns references in distributionChannelsRef and supplyChannelsRef, and expanded Channels in distributionChannels and supplyChannels.
  • For each setting in productSelections, GraphQL returns the reference in productSelectionRef and the expanded Product Selection in productSelection, alongside active.
  • The businessUnits setting is available on the REST Project but not on ProjectProjection.
  • GraphQL marks the inventory setting as Beta. REST doesn't.

Eventual consistency

Updating Project settings is eventually consistent, meaning it can take up to a minute until they become fully active for your Project.
Store configuration changes (such as Product Selection assignments or Variant Selections) are cached for up to one minute. Allow for this delay when fetching any projected Product in the Store.
Product Search indexes data separately and has its own, longer delay. Changes to Stores and Product Selections can take longer to appear in search results than in other Store queries. For the expected delay, see Index updates.

Messages and events

A Store sends a Message when it is created or deleted, and when its properties such as name, countries, languages, distribution Channels, supply Channels, or Product Selections change. For the full list, see Store Messages. The Project, Channel, and Tax Category APIs don't have their own Messages.

Limits

A maximum number of 300 000 Stores can be created per Project. This is a soft limit that can be increased per Project after a performance impact review. See Limit increase guidance.
A maximum number of 100 Tax Categories can be created per Project. This is a soft limit that can be increased per Project after a performance impact review. See Limit increase guidance.
A Store can have up to 100 supply Channels, 100 distribution Channels, and 100 Product Selections. For more information, see Store's Inventory Supply Channels, Store's Product Distribution Channels, and Store's Product Selections.