# Clonely API

Start product, collection and store copies from your own code or AI agent, and read their results.

Source: https://clonelyapp.com/api/


The Clonely API does what the copy page in the app does: it copies a single product, a collection or a whole store from another Shopify store into yours. You can then follow the copy and read the result for each product.

Every request acts on the store that owns the API key. The API is available on every plan.

## Base URL

```text
https://app.clonelyapp.com/api/v1
```

Requests and responses are JSON.

## OpenAPI spec

The full API is described in an OpenAPI 3.1 file: [clonelyapp.com/api/openapi.json](https://clonelyapp.com/api/openapi.json). Load it into Postman, Insomnia or an API client generator, or give it to your AI agent along with these pages.

## Quick start

### 1. Create an API key

In your Shopify admin, open Clonely and go to **Settings > API access**. Name the key and create it. Clonely shows the key once, so save it where your code can read it.

### 2. Start a copy

This copies a supplier's collection into your collection with the handle `boots`:

```bash
curl https://app.clonelyapp.com/api/v1/copies \
  -H "Authorization: Bearer $CLONELY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "kind": "collection",
    "sourceUrl": "https://supplier.example.com/collections/boots",
    "destination": { "collectionHandle": "boots" }
  }'
```

The answer is `202` with the new copy. Its `id` is what you use next.

### 3. Wait for it to finish

Collection and store copies run in the background. Ask for the copy until `status` is `COMPLETED`, `FAILED` or `CANCELLED`:

```bash
curl https://app.clonelyapp.com/api/v1/copies/cmx2zsul80000mn1va6so6jbt \
  -H "Authorization: Bearer $CLONELY_API_KEY"
```

Checking every 15 seconds or so is enough, and keeps you far below the [rate limit](https://clonelyapp.com/api/authentication/#rate-limit).

### 4. Read the results

`outcomes` on the copy counts products per result. For the result of each product, with the reason when one failed:

```bash
curl https://app.clonelyapp.com/api/v1/copies/cmx2zsul80000mn1va6so6jbt/products \
  -H "Authorization: Bearer $CLONELY_API_KEY"
```

A single product works differently: [`POST /products/copy`](https://clonelyapp.com/api/products/#post-productscopy) copies it while you wait and answers with the new product.

## What you can do

| Task | Endpoint |
|---|---|
| Copy one product | [`POST /products/copy`](https://clonelyapp.com/api/products/#post-productscopy) |
| List products copied one at a time | [`GET /products`](https://clonelyapp.com/api/products/#get-products) |
| Start a collection or store copy | [`POST /copies`](https://clonelyapp.com/api/copies/#post-copies) |
| List collection and store copies | [`GET /copies`](https://clonelyapp.com/api/copies/#get-copies) |
| Get one copy | [`GET /copies/{id}`](https://clonelyapp.com/api/copies/#get-copiesid) |
| Read the result for each product | [`GET /copies/{id}/products`](https://clonelyapp.com/api/copies/#get-copiesidproducts) |
| Cancel a copy | [`POST /copies/{id}/cancel`](https://clonelyapp.com/api/copies/#post-copiesidcancel) |

## Settings and options

Each copy uses the settings saved in the app (publishing, tags, SKUs, pricing, stock, what to do with duplicates). To change any of them for one copy, send [`options`](https://clonelyapp.com/api/options/#options) with the request. The saved settings stay as they are; the API can't change them.

## Things to know

Starting a copy is not idempotent. If a start request times out, check [`GET /copies`](https://clonelyapp.com/api/copies/#get-copies) before you send it again, or you may start a second copy.

List endpoints return `{ "data": [...], "nextCursor": "..." }`, newest first. Send `nextCursor` back as `cursor` to get the next page; it is `null` on the last one.

Errors have a stable `code` to branch on and a `message` written for people, which can change. See [Errors](https://clonelyapp.com/api/errors/).


## Pages

- [OpenAPI 3.1 spec](https://clonelyapp.com/api/openapi.json): the whole API as one JSON file.
- [Authentication and limits](https://clonelyapp.com/api/authentication/index.md): API keys, the Authorization header, the rate limit, timeouts and retries.
- [Collection and store copies](https://clonelyapp.com/api/copies/index.md): Start a collection or store copy, follow it, read the result for each product, and cancel it.
- [Single products](https://clonelyapp.com/api/products/index.md): Copy one product while you wait, and list the products copied one at a time.
- [Copy options](https://clonelyapp.com/api/options/index.md): The destination collection, per-copy options, pricing and stock rules, and category and handle text.
- [Errors](https://clonelyapp.com/api/errors/index.md): The error format and every error code the API returns, with its status and what to do.

