{
  "openapi": "3.1.0",
  "info": {
    "title": "Clonely API",
    "version": "1.0.0",
    "description": "Start copies from other Shopify stores into your store, and follow their results. Every call acts on the store the API key belongs to.\n\n**Auth.** `Authorization: Bearer <key>`, with a key from Settings > API access in Clonely.\n\n**Copies.** A collection or store copy (the app's \"task\") runs in the background: start it with `POST /copies`, poll `GET /copies/{id}` until `status` is COMPLETED, FAILED or CANCELLED, then read `GET /copies/{id}/products` (the task page's Task Log). A single product is copied in the request itself with `POST /products/copy`.\n\n**Options.** Every copy uses the store's saved settings; `options` overrides any of them for that copy only. The settings themselves can't be changed through the API.\n\n**Requests.** JSON bodies. Unknown fields are refused (400 `invalid_request`). Starts are not idempotent: retrying a start that timed out can start a second copy (`copy_running` guards only the same source and existing destination collection), so check `GET /copies` first.\n\n**Paging.** List endpoints return `{ data, nextCursor }`, newest first. Pass `nextCursor` as `cursor` for the next page; it is null on the last page.\n\n**Limits.** 60 requests a minute per key; over that, 429 with `Retry-After`. Single-product copies can take up to 30 seconds.\n\n**Errors.** `{ \"error\": { \"code\", \"message\", \"issues\"?, \"copyId\"? } }`. Branch on `code`:\n\n| code | status | meaning |\n|---|---|---|\n| `unauthorized` | 401 | No API key, a malformed or unknown key, or a revoked key. |\n| `invalid_request` | 400 | The body or query failed validation. `issues` names each field; `(body)` is the whole body. |\n| `invalid_source` | 400 | The source URL is unusable: not a Shopify store, the wrong kind of URL, empty, a page, blocked or behind a login. |\n| `password_required` | 400 | The source store is password protected. Send `sourcePassword`. |\n| `password_wrong` | 400 | `sourcePassword` didn't open the store, or too many wrong passwords were tried. |\n| `collection_failed` | 400 | Shopify refused to create the new destination collection; the message has its reason. |\n| `not_found` | 404 | No copy with this ID in your store, or no endpoint at this path. |\n| `not_cancellable` | 409 | The copy is COMPLETED or FAILED. Cancelling a CANCELLED copy returns 200. |\n| `copy_running` | 409 | A copy of this source into the same destination collection is PENDING or IN_PROGRESS. `copyId` names it. |\n| `product_exists` | 409 | Single product: a product with this handle or SKU is in the store, and the options skip it. The message says which option updates it. |\n| `not_copied` | 409 | Single product: the matching product was not copied by Clonely, and updateMatch is \"copied\". |\n| `variant_limit` | 400 | Single product: the store hit Shopify's daily variant creation limit. Try again tomorrow. |\n| `copy_failed` | 400 | Single product: Shopify refused the product. The message may say why. |\n| `reconnect_required` | 409 | Clonely has no working access token for the store. The merchant has to open Clonely in the Shopify admin. |\n| `rate_limited` | 429 | More than 60 requests in a minute with this key. Wait `Retry-After` seconds. |\n| `shopify_unavailable` | 503 | The Shopify Admin API didn't answer after retries. Nothing was changed. Wait `Retry-After` seconds. |\n| `internal` | 500 | A bug in Clonely. Retrying may work; report it if it keeps happening. |"
  },
  "servers": [
    {
      "url": "https://app.clonelyapp.com/api/v1"
    }
  ],
  "security": [
    {
      "apiKey": []
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "A key from Settings > API access in Clonely."
      }
    },
    "schemas": {
      "Copy": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "cmui5eu0y001psb0jfh7kc9aj"
          },
          "kind": {
            "type": "string",
            "enum": [
              "collection",
              "store"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "IN_PROGRESS",
              "COMPLETED",
              "FAILED",
              "CANCELLED"
            ]
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "The pause, retry or failure reason the task page shows."
          },
          "sourceUrl": {
            "type": "string"
          },
          "destinationCollectionId": {
            "type": [
              "string",
              "null"
            ]
          },
          "productsCopied": {
            "type": "integer",
            "description": "Products added, updated or saved with issues so far. A running counter of copy events: a copy that was paused and resumed can count a product again, so it can differ from `outcomes`."
          },
          "productsTotal": {
            "type": "integer",
            "description": "0 until the copy starts reading the source. While it runs it is the source's product count; on completion it is the number of products the copy processed."
          },
          "totalIsEstimate": {
            "type": "boolean",
            "description": "true until status is COMPLETED: productsTotal can still change."
          },
          "outcomes": {
            "type": "object",
            "properties": {
              "added": {
                "type": "integer"
              },
              "updated": {
                "type": "integer"
              },
              "savedWithIssues": {
                "type": "integer"
              },
              "skippedAlreadyExists": {
                "type": "integer"
              },
              "skippedUnchanged": {
                "type": "integer"
              },
              "skippedNotCopied": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              },
              "waitingForVariantLimit": {
                "type": "integer"
              }
            },
            "description": "Distinct products per result (by the handle this copy gives them), as on the task page. A product recorded twice with the same result counts once, but one product can count under two results (for example added, then skippedAlreadyExists after a resume), so the values can add up to more than the number of products. `failed` excludes products that later got another result."
          },
          "options": {
            "$ref": "#/components/schemas/EffectiveOptions"
          },
          "applyToEach": {
            "type": "object",
            "properties": {
              "categoryId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "categoryName": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "handleStart": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "handleEnd": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "categoryId",
              "categoryName",
              "handleStart",
              "handleEnd"
            ]
          },
          "retryAfter": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "A paused copy resumes after this time."
          },
          "stoppedAtProductLimit": {
            "type": "boolean",
            "description": "Finished at Shopify's 25,000-product limit for a storefront listing: the source may have more products. Copy its collections separately to get the rest."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "message",
          "sourceUrl",
          "destinationCollectionId",
          "productsCopied",
          "productsTotal",
          "totalIsEstimate",
          "outcomes",
          "options",
          "applyToEach",
          "retryAfter",
          "stoppedAtProductLimit",
          "createdAt",
          "updatedAt"
        ]
      },
      "EffectiveOptions": {
        "type": [
          "object",
          "null"
        ],
        "properties": {
          "publish": {
            "type": "boolean"
          },
          "importTags": {
            "type": "boolean"
          },
          "importTax": {
            "type": "boolean"
          },
          "importSku": {
            "type": "boolean"
          },
          "onDuplicate": {
            "type": "string",
            "enum": [
              "skip",
              "update"
            ]
          },
          "updateMatch": {
            "type": "string",
            "enum": [
              "copied",
              "handle",
              "handle_sku"
            ]
          },
          "updateScope": {
            "type": "string",
            "enum": [
              "all",
              "selected"
            ]
          },
          "updatePrice": {
            "type": "boolean"
          },
          "updateCompareAtPrice": {
            "type": "boolean"
          },
          "updateCost": {
            "type": "boolean"
          },
          "updateImagesMode": {
            "type": "string",
            "enum": [
              "none",
              "add",
              "match",
              "replace"
            ]
          },
          "updateTitle": {
            "type": "boolean"
          },
          "updateDescription": {
            "type": "boolean"
          },
          "updateTagsMode": {
            "type": "string",
            "enum": [
              "none",
              "merge",
              "replace"
            ]
          },
          "updateAddVariants": {
            "type": "boolean"
          },
          "updateRemoveVariants": {
            "type": "boolean"
          },
          "updateStock": {
            "type": "boolean"
          },
          "price": {
            "$ref": "#/components/schemas/PriceRules"
          },
          "stock": {
            "$ref": "#/components/schemas/StockRules"
          }
        },
        "required": [
          "publish",
          "importTags",
          "importTax",
          "importSku",
          "onDuplicate",
          "updateMatch",
          "updateScope",
          "updatePrice",
          "updateCompareAtPrice",
          "updateCost",
          "updateImagesMode",
          "updateTitle",
          "updateDescription",
          "updateTagsMode",
          "updateAddVariants",
          "updateRemoveVariants",
          "updateStock",
          "price",
          "stock"
        ],
        "description": "null: the copy reads the store's saved settings when it starts (copies started in the app without advanced options)."
      },
      "PriceRules": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean",
            "description": "Off: prices are copied unchanged, whatever the fields below say."
          },
          "price": {
            "type": "object",
            "properties": {
              "base": {
                "type": "string",
                "enum": [
                  "supplierPrice",
                  "fromSupplierPrice"
                ]
              },
              "type": {
                "type": "string",
                "enum": [
                  "none",
                  "percentage",
                  "amount"
                ],
                "description": "none, percentage or amount. The value carries the sign."
              },
              "value": {
                "type": "number",
                "description": "Percentage or amount. Positive raises the price, negative lowers it."
              },
              "rounding": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0,
                "maximum": 99,
                "description": "Cents the result ends in (99 makes 12.99), or null for no rounding."
              },
              "roundingDirection": {
                "type": "string",
                "enum": [
                  "standard",
                  "up",
                  "down"
                ]
              }
            },
            "additionalProperties": false
          },
          "compareAt": {
            "type": "object",
            "properties": {
              "base": {
                "type": "string",
                "enum": [
                  "supplierCompare",
                  "supplierPrice",
                  "fromSupplierCompare",
                  "fromSupplierPrice",
                  "fromNewPrice",
                  "none"
                ]
              },
              "type": {
                "type": "string",
                "enum": [
                  "none",
                  "percentage",
                  "amount"
                ],
                "description": "none, percentage or amount. The value carries the sign."
              },
              "value": {
                "type": "number",
                "description": "Percentage or amount. Positive raises the price, negative lowers it."
              },
              "rounding": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0,
                "maximum": 99,
                "description": "Cents the result ends in (99 makes 12.99), or null for no rounding."
              },
              "roundingDirection": {
                "type": "string",
                "enum": [
                  "standard",
                  "up",
                  "down"
                ]
              }
            },
            "additionalProperties": false
          },
          "cost": {
            "type": "object",
            "properties": {
              "base": {
                "type": "string",
                "enum": [
                  "supplierPrice",
                  "fromSupplierPrice",
                  "fromNewPrice",
                  "none"
                ]
              },
              "type": {
                "type": "string",
                "enum": [
                  "none",
                  "percentage",
                  "amount"
                ],
                "description": "none, percentage or amount. The value carries the sign."
              },
              "value": {
                "type": "number",
                "description": "Percentage or amount. Positive raises the price, negative lowers it."
              },
              "rounding": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0,
                "maximum": 99,
                "description": "Cents the result ends in (99 makes 12.99), or null for no rounding."
              },
              "roundingDirection": {
                "type": "string",
                "enum": [
                  "standard",
                  "up",
                  "down"
                ]
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false,
        "description": "How prices are set, as under Pricing in Settings. Fields left out keep the saved value (each of price, compareAt and cost field by field)."
      },
      "StockRules": {
        "type": "object",
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "rules": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "locationId": {
                  "type": "string",
                  "example": "gid://shopify/Location/123456789"
                },
                "locationName": {
                  "type": "string",
                  "maxLength": 255,
                  "description": "Shown on the task page."
                },
                "inStock": {
                  "type": "object",
                  "properties": {
                    "action": {
                      "type": "string",
                      "enum": [
                        "set",
                        "ignore"
                      ],
                      "description": "set: set the quantity below. ignore: leave it alone."
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000000,
                      "default": 0
                    }
                  },
                  "required": [
                    "action"
                  ],
                  "additionalProperties": false,
                  "description": "For variants the supplier has in stock."
                },
                "outOfStock": {
                  "type": "object",
                  "properties": {
                    "action": {
                      "type": "string",
                      "enum": [
                        "set",
                        "ignore"
                      ],
                      "description": "set: set the quantity below. ignore: leave it alone."
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000000,
                      "default": 0
                    }
                  },
                  "required": [
                    "action"
                  ],
                  "additionalProperties": false,
                  "description": "For variants the supplier has sold out."
                }
              },
              "required": [
                "locationId",
                "inStock",
                "outOfStock"
              ],
              "additionalProperties": false
            },
            "maxItems": 100,
            "description": "Replaces the saved rules when given. A location with no rule is never changed."
          }
        },
        "additionalProperties": false,
        "description": "Stock quantities per location, as under Stock in Settings. Needs inventory access, which the merchant grants in Settings; without it the rules are skipped."
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "unauthorized",
                  "invalid_request",
                  "invalid_source",
                  "password_required",
                  "password_wrong",
                  "collection_failed",
                  "not_found",
                  "not_cancellable",
                  "copy_running",
                  "product_exists",
                  "not_copied",
                  "variant_limit",
                  "copy_failed",
                  "reconnect_required",
                  "rate_limited",
                  "shopify_unavailable",
                  "internal"
                ],
                "description": "Stable; branch on this, not on `message`. See the table in the API description."
              },
              "message": {
                "type": "string",
                "description": "What went wrong and what to do, for people. Wording can change."
              },
              "issues": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "path": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "path",
                    "message"
                  ]
                },
                "description": "invalid_request: each field that was refused."
              },
              "copyId": {
                "type": "string",
                "description": "copy_running: the copy that is still running."
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      },
      "StartCopyRequest": {
        "type": "object",
        "properties": {
          "kind": {
            "type": "string",
            "enum": [
              "collection",
              "store"
            ]
          },
          "sourceUrl": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "example": "https://supplier.example.com/collections/boots"
          },
          "destination": {
            "$ref": "#/components/schemas/Destination"
          },
          "sourcePassword": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Storefront password of a password-protected source store. Used once to log in, never stored."
          },
          "options": {
            "$ref": "#/components/schemas/CopyOptions"
          },
          "applyToEach": {
            "$ref": "#/components/schemas/ApplyToEach"
          }
        },
        "required": [
          "kind",
          "sourceUrl"
        ],
        "additionalProperties": false,
        "example": {
          "kind": "collection",
          "sourceUrl": "https://supplier.example.com/collections/boots",
          "destination": {
            "collectionHandle": "boots"
          },
          "options": {
            "onDuplicate": "update",
            "updateMatch": "copied",
            "updatePrice": true,
            "price": {
              "enabled": true
            }
          },
          "applyToEach": {
            "handleStart": "acme-"
          }
        }
      },
      "Destination": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "collectionId": {
                "type": "string",
                "pattern": "^gid:\\/\\/shopify\\/Collection\\/\\d+$",
                "description": "Admin API GID of an existing collection. A bare numeric ID is refused.",
                "example": "gid://shopify/Collection/123456789"
              }
            },
            "required": [
              "collectionId"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "collectionHandle": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255,
                "description": "Handle of an existing collection.",
                "example": "boots"
              }
            },
            "required": [
              "collectionHandle"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "newCollectionTitle": {
                "type": "string",
                "minLength": 1,
                "maxLength": 255,
                "description": "Title of a collection to create. Not de-duplicated: each request creates a new collection, even if one with this title exists. For a single product it is created only after the copy succeeds."
              }
            },
            "required": [
              "newCollectionTitle"
            ],
            "additionalProperties": false
          }
        ],
        "description": "The collection copied products are added to: an existing one by GID or handle (checked before the copy starts; unknown is 400 invalid_request), or a new one. Omit to add them to no collection. Smart (automated) collections are left unchanged."
      },
      "CopyOptions": {
        "type": "object",
        "properties": {
          "publish": {
            "type": "boolean",
            "description": "Publish new products (true) or save them as drafts."
          },
          "importTags": {
            "type": "boolean",
            "description": "Copy tags."
          },
          "importTax": {
            "type": "boolean",
            "description": "Copy the \"charge tax\" setting."
          },
          "importSku": {
            "type": "boolean",
            "description": "Copy SKUs."
          },
          "onDuplicate": {
            "type": "string",
            "enum": [
              "skip",
              "update"
            ],
            "description": "When the product is already in the store: skip it, or update it with the fields below."
          },
          "updateMatch": {
            "type": "string",
            "enum": [
              "copied",
              "handle",
              "handle_sku"
            ],
            "description": "Which existing products an update may change. copied: only products Clonely copied. handle: any product with the same URL handle. handle_sku: the same URL handle or SKU."
          },
          "updateScope": {
            "type": "string",
            "enum": [
              "all",
              "selected"
            ],
            "description": "all: update every field. selected: only the fields below."
          },
          "updatePrice": {
            "type": "boolean"
          },
          "updateCompareAtPrice": {
            "type": "boolean"
          },
          "updateCost": {
            "type": "boolean"
          },
          "updateImagesMode": {
            "type": "string",
            "enum": [
              "none",
              "add",
              "match",
              "replace"
            ],
            "description": "none, add (only new images), match (also remove images the source dropped), replace (all)."
          },
          "updateTitle": {
            "type": "boolean"
          },
          "updateDescription": {
            "type": "boolean"
          },
          "updateTagsMode": {
            "type": "string",
            "enum": [
              "none",
              "merge",
              "replace"
            ],
            "description": "none, merge (keep the product's tags) or replace."
          },
          "updateAddVariants": {
            "type": "boolean"
          },
          "updateRemoveVariants": {
            "type": "boolean"
          },
          "updateStock": {
            "type": "boolean",
            "description": "Apply the stock rules to products that already exist."
          },
          "price": {
            "$ref": "#/components/schemas/PriceRules"
          },
          "stock": {
            "$ref": "#/components/schemas/StockRules"
          }
        },
        "additionalProperties": false,
        "description": "Options for this copy only, as in the copy page's advanced options. Fields left out use the store's saved settings at the time the copy starts. Unknown fields are refused."
      },
      "ApplyToEach": {
        "type": "object",
        "properties": {
          "categoryId": {
            "type": "string",
            "pattern": "^gid:\\/\\/shopify\\/TaxonomyCategory\\/[a-z]{2}(-\\d+)*$",
            "description": "Product category set on every product the copy creates (and updates).",
            "example": "gid://shopify/TaxonomyCategory/aa-1-13-8"
          },
          "handleStart": {
            "type": "string",
            "maxLength": 100,
            "description": "Text added to the start of each new URL handle."
          },
          "handleEnd": {
            "type": "string",
            "maxLength": 100,
            "description": "Text added to the end of each new URL handle."
          }
        },
        "additionalProperties": false,
        "description": "Applied to each product this copy creates."
      },
      "CopyList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Copy"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` for the next page. null on the last page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CopyProductList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CopyProductResult"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` for the next page. null on the last page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CopyProductResult": {
        "type": "object",
        "properties": {
          "handle": {
            "type": "string",
            "description": "The URL handle this copy gives the product."
          },
          "storeHandle": {
            "type": [
              "string",
              "null"
            ],
            "description": "The handle of the matched product in your store, when it differs from `handle` (a SKU match). Recorded for updates and update-mode skips; null for skips in skip mode."
          },
          "sourceHandle": {
            "type": "string",
            "description": "The product's handle in the source store."
          },
          "result": {
            "type": "string",
            "enum": [
              "added",
              "updated",
              "savedWithIssues",
              "skippedAlreadyExists",
              "skippedUnchanged",
              "skippedNotCopied",
              "failed",
              "waitingForVariantLimit"
            ]
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it failed or was saved with issues, when known."
          },
          "at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "handle",
          "storeHandle",
          "sourceHandle",
          "result",
          "message",
          "at"
        ]
      },
      "ProductCopyResponse": {
        "type": "object",
        "properties": {
          "product": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "handle": {
                "type": "string"
              },
              "title": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "handle",
              "title"
            ]
          },
          "sourceUrl": {
            "type": "string"
          },
          "outcome": {
            "type": "string",
            "enum": [
              "created",
              "updated",
              "partial"
            ],
            "description": "partial: created or updated, but part of it failed (see message). A product that was skipped because it is already in the store is not a 200: it is 409 product_exists or not_copied."
          },
          "message": {
            "type": [
              "string",
              "null"
            ],
            "description": "What failed, for partial; why the product is not in the collection."
          },
          "addedToCollection": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "null when no destination was given. false: the product was copied, but not added (see message)."
          }
        },
        "required": [
          "product",
          "sourceUrl",
          "outcome",
          "message",
          "addedToCollection"
        ]
      },
      "CopyProductRequest": {
        "type": "object",
        "properties": {
          "sourceUrl": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "example": "https://supplier.example.com/products/trail-boot"
          },
          "destination": {
            "$ref": "#/components/schemas/Destination"
          },
          "sourcePassword": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "description": "Storefront password of a password-protected source store. Used once to log in, never stored."
          },
          "options": {
            "$ref": "#/components/schemas/CopyOptions"
          },
          "applyToEach": {
            "$ref": "#/components/schemas/ApplyToEach"
          }
        },
        "required": [
          "sourceUrl"
        ],
        "additionalProperties": false,
        "example": {
          "sourceUrl": "https://supplier.example.com/products/trail-boot",
          "destination": {
            "newCollectionTitle": "New arrivals"
          },
          "options": {
            "publish": false
          }
        }
      },
      "CopiedProductList": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CopiedProduct"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` for the next page. null on the last page."
          }
        },
        "required": [
          "data",
          "nextCursor"
        ]
      },
      "CopiedProduct": {
        "type": "object",
        "properties": {
          "productId": {
            "type": "string",
            "example": "gid://shopify/Product/1234567890"
          },
          "handle": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "sourceUrl": {
            "type": [
              "string",
              "null"
            ]
          },
          "copiedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "productId",
          "handle",
          "title",
          "sourceUrl",
          "copiedAt"
        ],
        "description": "One single-product copy. Each copy or update is its own row, so a productId can repeat."
      }
    },
    "parameters": {}
  },
  "paths": {
    "/copies": {
      "post": {
        "operationId": "startCopy",
        "summary": "Start a collection or store copy (a task)",
        "description": "Checks the source as the copy page does and queues the copy, which runs in the background. Poll `GET /copies/{id}` until its status is COMPLETED, FAILED or CANCELLED. Only one PENDING or IN_PROGRESS copy of the same source into the same existing collection (or no collection) is allowed; `newCollectionTitle` always starts a new one. Not idempotent.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartCopyRequest"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "The copy was queued.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Copy"
                }
              }
            }
          },
          "400": {
            "description": "The request or the source was refused. `code` says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is malformed, unknown or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflicts with the state of the store or of the copy. `code` says which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests in a minute with this key.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "A bug in Clonely.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "The Shopify Admin API didn't answer after retries. Nothing was changed.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listCopies",
        "summary": "List copies (the Tasks page), newest first",
        "description": "Collection and store copies only. Single-product copies are in `GET /products`.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "IN_PROGRESS",
                "COMPLETED",
                "FAILED",
                "CANCELLED"
              ]
            },
            "required": false,
            "name": "status",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "collection",
                "store"
              ]
            },
            "required": false,
            "name": "kind",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200,
              "description": "Part of the source URL."
            },
            "required": false,
            "description": "Part of the source URL.",
            "name": "source",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "format": "date-time",
              "description": "Copies started at or after this time."
            },
            "required": false,
            "description": "Copies started at or after this time.",
            "name": "since",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 25
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of copies.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CopyList"
                }
              }
            }
          },
          "400": {
            "description": "The request or the source was refused. `code` says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is malformed, unknown or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests in a minute with this key.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "A bug in Clonely.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/copies/{id}": {
      "get": {
        "operationId": "getCopy",
        "summary": "Get one copy",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "cmui5eu0y001psb0jfh7kc9aj"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The copy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Copy"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is malformed, unknown or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No copy with this ID in your store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests in a minute with this key.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "A bug in Clonely.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/copies/{id}/products": {
      "get": {
        "operationId": "listCopyProducts",
        "summary": "List a copy's product results (the task's Task Log), newest first",
        "description": "One row per recorded result, as in the Task Log on the task page, with the reason for failed and partial products. A copy that was paused and resumed can record a product more than once.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "cmui5eu0y001psb0jfh7kc9aj"
            },
            "required": true,
            "name": "id",
            "in": "path"
          },
          {
            "schema": {
              "type": "string",
              "enum": [
                "added",
                "updated",
                "savedWithIssues",
                "skippedAlreadyExists",
                "skippedUnchanged",
                "skippedNotCopied",
                "failed",
                "waitingForVariantLimit"
              ]
            },
            "required": false,
            "name": "result",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 25
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of product results.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CopyProductList"
                }
              }
            }
          },
          "400": {
            "description": "The request or the source was refused. `code` says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is malformed, unknown or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No copy with this ID in your store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests in a minute with this key.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "A bug in Clonely.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/copies/{id}/cancel": {
      "post": {
        "operationId": "cancelCopy",
        "summary": "Cancel a pending or running copy",
        "description": "The copy stops after the product it is working on. Products already copied stay in the store. Cancelling a CANCELLED copy returns it unchanged (200); a COMPLETED or FAILED copy is 409 `not_cancellable`. No request body.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "example": "cmui5eu0y001psb0jfh7kc9aj"
            },
            "required": true,
            "name": "id",
            "in": "path"
          }
        ],
        "responses": {
          "200": {
            "description": "The cancelled copy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Copy"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is malformed, unknown or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No copy with this ID in your store.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflicts with the state of the store or of the copy. `code` says which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests in a minute with this key.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "A bug in Clonely.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/products/copy": {
      "post": {
        "operationId": "copyProduct",
        "summary": "Copy one product",
        "description": "Copies the product now and answers when it is done, which can take up to 30 seconds. Recorded in `GET /products`. A product already in the store is skipped or updated as `options.onDuplicate` and `options.updateMatch` say; a skip is 409 `product_exists` or `not_copied`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CopyProductRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The product was copied (check `outcome` for a partial copy).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductCopyResponse"
                }
              }
            }
          },
          "400": {
            "description": "The request or the source was refused. `code` says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is malformed, unknown or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Conflicts with the state of the store or of the copy. `code` says which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests in a minute with this key.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "A bug in Clonely.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "The Shopify Admin API didn't answer after retries. Nothing was changed.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/products": {
      "get": {
        "operationId": "listCopiedProducts",
        "summary": "List products copied one at a time, newest first",
        "description": "Single-product copies only (the app's History page). Products from collection and store copies are in each copy's results. Every copy or update is its own row, so a product can appear more than once.",
        "parameters": [
          {
            "schema": {
              "type": "string",
              "maxLength": 200,
              "description": "Part of the title, handle or source URL."
            },
            "required": false,
            "description": "Part of the title, handle or source URL.",
            "name": "query",
            "in": "query"
          },
          {
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 50,
              "default": 25
            },
            "required": false,
            "name": "limit",
            "in": "query"
          },
          {
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "required": false,
            "name": "cursor",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of copied products.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CopiedProductList"
                }
              }
            }
          },
          "400": {
            "description": "The request or the source was refused. `code` says why.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "No API key, or the key is malformed, unknown or revoked.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "More than 60 requests in a minute with this key.",
            "headers": {
              "Retry-After": {
                "description": "Seconds to wait before the next request.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "A bug in Clonely.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "webhooks": {}
}
