> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stateset.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect Shopify with a custom-app Admin API token

> The token is verified against the store live before it is stored, and is never returned by any read. Replacing an existing connection requires confirm_replace…

The token is verified against the store live before it is stored, and is never returned by any read. Replacing an existing connection requires confirm\_replace. For browser OAuth instead, use the connect\_url from the status endpoint.

### Request body

`ConnectShopify`

<ParamField body="shop" type="string" required>
  The store handle or myshopify domain, e.g. 'acme' or 'acme.myshopify.com'.
</ParamField>

<ParamField body="access_token" type="string" required>
  An Admin API access token (shpat\_…) from a custom app.
</ParamField>

<ParamField body="confirm_replace" type="boolean">
  Required (true) when the organization already has a Shopify connection — connecting replaces it.
</ParamField>

### Response

`object`

<ResponseField name="object" type="string" required />

<ResponseField name="provider" type="string" required />

<ResponseField name="connected" type="boolean" required />

<ResponseField name="shop" type="string" required>
  The normalised myshopify handle (without `.myshopify.com`).
</ResponseField>

<ResponseField name="shop_name" type="string,null" required>
  The store's display name as reported by Shopify.
</ResponseField>

<ResponseField name="scopes" type="string,null" required>
  Comma-separated scopes the token was granted, when Shopify reports them.
</ResponseField>

<ResponseField name="next_action" type="string" required />

### Status codes

| Code  | Meaning                                                                                                                                                                                                                                        |
| ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `200` | The verified connection. The token was validated with a live call to the store before being stored.                                                                                                                                            |
| `400` | Invalid request. `issues` names the offending field(s).                                                                                                                                                                                        |
| `401` | Missing, invalid, or expired API key.                                                                                                                                                                                                          |
| `403` | The key lacks a required scope.                                                                                                                                                                                                                |
| `409` | Conflict — either the creation ceiling was reached for this organization (`agent_limit_reached`), or a request with the same Idempotency-Key is still in flight (`idempotency_in_progress`); retry the latter after the first attempt settles. |
| `429` | Rate limit exceeded.                                                                                                                                                                                                                           |

### Access

|                |                        |
| -------------- | ---------------------- |
| Required scope | `agents:write`         |
| Rate limit     | 30 requests per minute |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://response.stateset.com/api/v1/integrations/shopify' \
    --header "Authorization: Bearer $RESPONSECX_API_KEY" \
    --header 'Content-Type: application/json' \
    --data '{
    "shop": "string",
    "access_token": "YOUR_API_KEY",
    "confirm_replace": true
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "object": "integration.connection",
    "provider": "shopify",
    "connected": true,
    "shop": "string",
    "shop_name": "string",
    "scopes": "string",
    "next_action": "string"
  }
  ```
</ResponseExample>
