> For the complete documentation index, see [llms.txt](https://docs.slingdata.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.slingdata.io/connections/api-connections/shopify.md).

# Shopify

Connect & Ingest data from Shopify

Shopify is an e-commerce platform for online stores. The Sling Shopify connector extracts data from the Shopify Admin API. It supports products, variants, collections, inventory, customers, orders, refunds, transactions, abandoned checkouts, and shop information.

Two specs are available:

* `shopify` uses the [Admin GraphQL API](https://shopify.dev/docs/apps/build/graphql).
* `shopify_legacy` uses the [Admin REST API](https://shopify.dev/docs/api/admin-rest).

{% hint style="success" %}
**CLI Pro Required**: APIs require a [CLI Pro token](/sling-cli/cli-pro.md) or [Platform Plan](/sling-platform/platform.md).
{% endhint %}

## Setup

The following credentials are accepted:

**Secrets:**

* `access_token` **(required)** -> The Admin API access token of your custom app (starts with `shpat_`)
* `shop_name` **(required)** -> The subdomain of your store. For `my-store.myshopify.com`, use `my-store`

### Getting Your Access Token

1. In the Shopify admin, go to **Settings** > **Apps and sales channels** > **Develop apps**.
2. Click **Create an app** and enter a name.
3. Click **Configure Admin API scopes**. Select the read scopes for the data that you need:
   * `read_products`
   * `read_inventory`
   * `read_customers`
   * `read_orders`
4. Click **Install app**.
5. Copy the **Admin API access token**. Shopify shows the token one time.

{% hint style="info" %}
Shopify returns only the orders of the last 60 days by default. Add the `read_all_orders` scope to read older orders.
{% endhint %}

### Using `sling conns`

Here are examples of setting a connection named `SHOPIFY`. We must provide the `type=api` property:

{% code overflow="wrap" %}

```bash
sling conns set SHOPIFY type=api spec=shopify secrets='{ access_token: "${SHOPIFY_ACCESS_TOKEN}", shop_name: "${SHOPIFY_SHOP_NAME}" }'
```

{% endcode %}

To use the REST API, set `spec=shopify_legacy`:

{% code overflow="wrap" %}

```bash
sling conns set SHOPIFY_REST type=api spec=shopify_legacy secrets='{ access_token: "${SHOPIFY_ACCESS_TOKEN}", shop_name: "${SHOPIFY_SHOP_NAME}" }'
```

{% endcode %}

### Environment Variable

See [here](https://docs.slingdata.io/connections/api-connections/pages/eAdVs2BHCgdr6RS8GoJC#dot-env-file-.env.sling) to learn more about the `.env.sling` file.

{% code overflow="wrap" %}

```bash
export SHOPIFY='{ type: api, spec: shopify, secrets: { access_token: "shpat_xxxxxxxxxxxx", shop_name: "my-store" } }'
```

{% endcode %}

### Sling Env File YAML

See [here](https://docs.slingdata.io/connections/api-connections/pages/eAdVs2BHCgdr6RS8GoJC#sling-env-file-env.yaml) to learn more about the sling `env.yaml` file.

```yaml
connections:
  SHOPIFY:
    type: api
    spec: shopify
    secrets:
      access_token: ${SHOPIFY_ACCESS_TOKEN}
      shop_name: ${SHOPIFY_SHOP_NAME}
```

## Replication

Here is an example replication configuration to sync Shopify data to a PostgreSQL database:

```yaml
source: SHOPIFY
target: MY_POSTGRES

defaults:
  mode: full-refresh
  object: shopify.{stream_name}

streams:
  shop:
  product:
  product_variant:
  collection:
  customer:
  order:
```

The endpoints that are marked "Yes" in the tables below save a sync value (`last_id` or `last_updated_at`). Set the `SLING_STATE` environment variable to keep this value between runs in incremental mode. See [here](/concepts/replication/modes.md) for more details.

## Endpoints

### GraphQL (`shopify`)

| Endpoint             | Description                      | Incremental |
| -------------------- | -------------------------------- | ----------- |
| `shop`               | Shop information                 | No          |
| `product`            | Products                         | Yes         |
| `product_variant`    | Product variants                 | No          |
| `product_image`      | Images of each product           | No (child)  |
| `collection`         | Collections                      | Yes         |
| `inventory_item`     | Inventory items of the variants  | No (child)  |
| `inventory_level`    | Inventory levels of the variants | No (child)  |
| `customer`           | Customers                        | Yes         |
| `customer_address`   | Addresses of each customer       | No (child)  |
| `customer_order`     | Orders of each customer          | No (child)  |
| `order`              | Orders                           | Yes         |
| `order_transaction`  | Transactions of each order       | No (child)  |
| `refund`             | Refunds of each order            | No (child)  |
| `abandoned_checkout` | Abandoned checkouts              | Yes         |

### REST (`shopify_legacy`)

| Endpoint             | Description                      | Incremental |
| -------------------- | -------------------------------- | ----------- |
| `shop`               | Shop information                 | No          |
| `product`            | Products                         | Yes         |
| `product_variant`    | Product variants                 | No          |
| `product_image`      | Images of each product           | No (child)  |
| `collection`         | Custom collections               | Yes         |
| `smart_collection`   | Smart collections                | Yes         |
| `inventory_item`     | Inventory items of the variants  | No (child)  |
| `inventory_level`    | Inventory levels of the variants | No (child)  |
| `customer`           | Customers                        | Yes         |
| `customer_address`   | Addresses of each customer       | No (child)  |
| `customer_order`     | Orders of each customer          | No (child)  |
| `order`              | Orders                           | Yes         |
| `order_transaction`  | Transactions of each order       | No (child)  |
| `refund`             | Refunds of each order            | No (child)  |
| `abandoned_checkout` | Abandoned checkouts              | Yes         |

The child endpoints use the ids that their parent endpoint returns. Run the parent and the child endpoints in the same replication. The parents are:

* `product` for `product_image`
* `product_variant` for `inventory_item` and `inventory_level`
* `customer` for `customer_address` and `customer_order`
* `order` for `order_transaction` and `refund`

## Date Range

The `order` endpoint reads the orders of the last 30 days, one day at a time. The `product`, `product_variant`, `customer`, and `abandoned_checkout` endpoints read the records that changed in the last 30 days. Set the `UPDATED_AT_MIN` environment variable to change this start time. Use the ISO 8601 format, for example `2025-01-01T00:00:00+0000`.

## Rate Limiting

The connector sends up to 20 requests per second with 5 concurrent requests. Shopify limits the calls with a cost budget for each store. Reduce the `concurrency` setting if you get throttling errors.

If you are facing issues connecting, please reach out to us at <support@slingdata.io>, on [discord](https://discord.gg/q5xtaSNDvp) or open a Github Issue [here](https://github.com/slingdata-io/sling-cli/issues).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.slingdata.io/connections/api-connections/shopify.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
