Starts a store clone inside the caller's multi-retailer group, or replays the one that already exists for the same Idempotency-Key.
What the new store gets
- Plan and franchise are inherited from the source store (
sourceRetailerId). Any plan, price or franchise field in the body is discarded. - Name, CNPJ, address and phone come from the body. They are never copied from the source store. The CNPJ is required and must not belong to another store of the platform.
- One store per CNPJ: the first request of a key reserves the CNPJ for its operation with a conditional write. While another clone of the same CNPJ is alive (or created its store), the answer is
422withTAX_DOCUMENT_ID_ALREADY_REGISTEREDontaxDocumentId. A reservation whose operation never got claimed, or whose sign-up failed for good before creating a store, is taken over. ThesignUpstep checks the CNPJ against the platform again right before the sign-up and fails for good withTAX_DOCUMENT_ID_ALREADY_REGISTEREDwhen another store got it meanwhile. - Duplicating copies only the configurations the person checked in
copyItems, by category (SETTINGS,FEATURES,BUSINESS_HOURS,DISPATCH_LIMIT). The configuration engine says which keys belong to each category. An empty list creates the store from scratch. - The single store has no manager and no email is sent: the login of the caller is linked to the new store and is its first access. A
managerEmailin the body is discarded. - The sign-up identity (email, password and admin name) is generated by the server. The temporary admin user is disabled once the store is provisioned, and the login of the caller is linked to the new store.
Access
Needs an admin session (API users are refused), the multi-retailer-login and store-clone flags active for the caller's retailer, and a caller registered with a groupId. The retailer of the caller must be the MAIN contract of its group and the source store must belong to that group. The admin master may duplicate any store of the group; any other caller only the current store or one of the caller's multi-login stores. When any check fails the answer is 403. With the store-clone flag off, this route answers 403.
Idempotency
The Idempotency-Key becomes the operationId (in lower case). Repeating the call with the same key and the same body returns the current state and runs only the steps not concluded yet. The same key with a different sourceRetailerId, mode, copyItems or store data answers 409. A key already seen skips the field validation, so 422 happens only the first time a key is used.
Result
The call runs the pending steps in order. It stops when all are concluded, when a step fails or is blocked, or when the time budget of the request is nearly out: a step only starts with at least 5 s of budget left, and a step cut by the budget asks to continue later instead of failing.
201: at least one step ran and the operation is completed.200: no step ran. The operation was already completed or is stopped at a step that failed for good.202: the time budget ran out. The body hasnextAction: RESUME. CallPOST /retailers/clones/{operationId}/resume.207: at least one step ran and a step isFAILEDorBLOCKED.
A schema violation, an invalid JSON body or a missing or malformed Idempotency-Key answers 400. The 400 of a schema violation carries the list of violations as the body.
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||