Get your API Client

Create an API Client for your Project

You must first set up an API Client before your applications can interact with your Project. An API Client includes authentication information and permission scopes to determine the endpoints the API Client can interact with.

Learn more about Composable Commerce OAuth 2.0 for API authentication in our self-paced Authorization flows and API Clients module.

Objectives of this guide

By the end of this guide you will have:

Create an API Client

  1. In the Merchant Center, click Settings > Developer settings.
  2. On the API clients tab, click Create new API client. On the New API client page, follow these steps:
  3. Enter a name for your API client. The name does not affect how the API functions.

  4. Select the scopes for your API Client. To provide the API Client with complete access, click the drop-down and select Admin client. To follow security best practices, we recommend to keep the scopes to the minimum that is needed.
    The API Client scopes
  5. Click Create API client. On saving, your API Client information is displayed in the Client credential flow section.
    The API Client information is only displayed once. Ensure to save the project_key, client_id, secret, scope, API URL, and Auth URL before leaving or closing this page.
    The client credential flow containing API Client settings
  6. Optional: At this stage, you can request an access token that you need to make API calls to your Project with a cURL command. If you have cURL installed on your machine, you can copy the command to your clipboard and run it in your terminal. The access token is valid for 48 hours.
    Screenshot API Client Credentials cURL Command
    If you do not request a token at this stage, you can obtain it later with your saved API Client information by following the steps in Make your first API call. Please also save your API Client information to avoid losing it.
  7. Save your API Client information as explained in the next section for use in your applications.

Save the API Client information

To use a commercetools SDK or an HTTP client such as Postman or Bruno, download the API Client information in a format suitable for your SDK or client.

Alternatively, you can copy these configurations to your clipboard and paste them into your existing configuration files.

To give an example, this guide explains how to download your API Client information in a .env file.
  1. From the drop-down, select Environment Variables (.env) and click the download icon.
    Environment Variables that can be downloaded
  2. Locate the downloaded file. Its filename contains your Project key and API Client name, for example: {projectKey}_{API client name}.env.
    Optional: To use the downloaded file in your development project, rename it to .env and move it to your code base.
  3. Open the downloaded file with any text or code editor. You'll need the environment variables in this file to retrieve the access token.

Next steps

Now that you have your API Client set up, you are ready to retrieve your access token and make your first API call to your Project.