---
title: API Client | Shopware Community Hub
description: >-
  Set up an API client to explore and test the Shopware Store and Admin APIs
  using OpenAPI schemas.
canonical_url: 'https://hub.shopware.com/learn/unit/api-client'
---

# API Client

<LearningObjectives>

- Set up an API client to explore Shopware APIs.
- Import Shopware Store and Admin API schemas via OpenAPI.
- Configure environments and Admin API authentication.
- Send a test request and validate the response.
  
</LearningObjectives>

# API Client

Before you start working with the Store API or Admin API, you need a reliable way to inspect requests and responses.

An API client helps you validate authentication, explore endpoints from the OpenAPI schemas, and troubleshoot issues before you implement anything in code.

## API Client

To explore and test Shopware APIs, you need an API client.

In this learning unit, we use [Apidog](https://apidog.com/) as an example, but you can use any client you prefer, such as Insomnia, Postman, Hoppscotch, Bruno or other ones.

Just be aware that not all clients can import the Admin API schema, as some API clients do not fully support **OpenAPI 3.0**, which is used by the Shopware Admin API.

<Callout title="Web App vs. Desktop App" type="info">

Be aware that when testing with a Web App, your Shop must run in a publicly available network.

If you just want to test locally, you need a Desktop App or run the commands directly out of your IDE.

</Callout>

## Get OpenAPI Schemas

If you want to work with a local client, you need to import a schema first. You could also add your endpoints one by one, but this might take some time. As we explored before, we have the schemas already on hand:

- [Store API schema](https://shopware.stoplight.io/docs/store-api/7b972a75a8d8d-shopware-store-api)
- [Admin API schema](https://shopware.stoplight.io/docs/admin-api/8d53c59b2e6bc-shopware-admin-api)

From there, you can export the JSON files from there via the **Export** dropdown:

![Export JSON Schema](assets/export-json-schema.jpg)

You can import these JSON files in your client directly and get a collection of directly usable endpoints.

## Importing Schemas in an API Client (Example: Apidog)

The following steps show a typical setup workflow using Apidog as an example. Depending on your Apidog version, some labels in the UI may differ slightly.

1. Create a new project in Apidog, for example, named `Shopware APIs`.

2. Import the **Store API** schema first.

   ![Import Store API One](assets/Apidog_Import_Schema_Select_OpenAPI.jpg)

   ![Select Store API JSON File](assets/Apidog_Import_Schema_Select_JSON_File.jpg)

   ![Confirm JSON File](assets/Apidog_Import_Schema_Confirm.jpg)

3. Repeat the same process for the **Admin API**.

4. After the import, you should see two separate folders: one for the Store API and one for the Admin API. Next, create an environment.

   ![Create Environment](assets/Apidog_Create_Environment.jpg)

   Select `Develop Env` and set its visibility to `Private`.

   Then configure the base URLs for both APIs:

   - Store API: `http://localhost:8000/store-api`
   - Admin API: `http://localhost:8000/api`

   Also create a variable for the bearer token, for example `BearerToken`.

   ![Set Base URL and Variable](assets/Apidog_Create_Environment_SetBaseURL_and_Variable.jpg)

5. For the Admin API request `/search/product`, select the Admin API base URL in the request.

   ![Select Base URL in the Request](assets/Apidog_Admin_API_Search_Product_SelectBaseURL.jpg)

6. If you do not yet have an Admin API token, create an **integration** in the Shopware Administration and save the `clientId` and `clientSecret`.

7. Now switch to the `Auth` tab and configure `OAuth 2.0` so you can generate the bearer token directly in Apidog. Use the values shown in the screenshot below. For `Access Token`, use the variable `<code v-pre>{{BearerToken}}</code> that you created earlier.

   ![SetOauth](assets/Apidog_Admin_API_Search_Product_SetOAuth.jpg)

   In this example, the `Access Token URL` is `http://localhost:8000/api/oauth/token`. Enter this URL directly in the OAuth configuration. The `Client ID` and `Client Secret` are the same values from the integration you created earlier.

   Configure token usage as shown in the following screenshot.

   ![Configure Oauth Token Usage](assets/Apidog_Admin_API_Search_Product_SetOAuth_SetTokenUsage.jpg)

8. Generate the bearer token.

   ![Get Bearer Token](assets/Apidog_Admin_API_Search_Product_SetOAuth_GetToken.jpg)

   You have now configured OAuth 2.0 and can generate a bearer token directly in Apidog. You will learn more about Admin API in the dedicated learning unit later in this course.

9. Test the setup with an Admin API request using the following JSON body:

   ```json
   {
     "limit": 3,
     "filter": [
       {
         "type": "equals",
         "field": "active",
         "value": true
       }
     ]
   }
   ```

   If the setup is correct, the response contains a `data` array of products.

   ![Search Product Request Successful](assets/Apidog_Admin_API_Search_Product_SetBody_SendRequest_GetResponse.jpg)

If the request fails, check these points first:

- Is the selected `baseUrl` pointing to your shop?
- Is the bearer token still valid? If not, regenerate it by clicking the "Get Token" button in the "Auth" tab.
- Does your integration have the required permissions?
- Did you import the correct schema for the endpoint you are testing?
- For Admin API requests, does the final request URL contain `/api` exactly once?

## APIs vs. DAL: When to Use What?

API clients such as Apidog are ideal for:

- Exploring endpoints
- Understanding request and response payloads
- Validating authentication and permissions
- Debugging API behavior

In real projects, how you access Shopware data depends on **where your code runs**.

- If you are **inside Shopware** (plugins, controllers, subscribers): You usually work with the **Data Abstraction Layer (DAL)** to access data.
- If you are **outside Shopware** (e.g., ERP systems, middleware, headless frontends, or standalone scripts): You interact with the provided API endpoints via HTTP.

This course mainly focuses on understanding Shopware APIs first.

## Summary

Great! In this learning unit, you learned:

- How to set up an API client to explore Shopware APIs.
- Where to find and how to import OpenAPI schemas for the Store and Admin APIs.
- How to configure environments and Admin API authentication.
- How to send a test request and validate the response.

With this foundation, you can start exploring available endpoints, validate API behavior, and debug integrations before implementing them in code.
