Validate store clone

Dry run of the create route. It checks a clone request and writes nothing: no operation is created and no store is touched.

It runs the same access checks as the create route, including the store-clone flag and the caller's access to the source store, which answer 403 when they fail. A missing or blank taxDocumentId answers 400 from the request schema, with the Joi violations as the body. Then it checks:

  • the required store fields (taxDocumentId, retailerName, street, streetNumber, suburb, zipCode, city, state);
  • the CNPJ: valid check digits (INVALID_TAX_DOCUMENT_ID) and not used by another store of the platform (TAX_DOCUMENT_ID_ALREADY_REGISTERED);
  • the contract and plan of the source store: they must exist, be active and not be billed by users (reported on the field sourceRetailerId, code SOURCE_NOT_COPYABLE);
  • the availability of retailerName and, when sent, hostName in parse-server (REJECTED_BY_PLATFORM).

Answers 200 with valid: true when nothing is wrong. Otherwise it answers 422 with every problem in details.fieldErrors, each with field, code and a pt-BR message. It does not take an Idempotency-Key.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

Request to create one store, from scratch or duplicating a store.
The request schema checks sourceRetailerId, mode, copyItems and taxDocumentId (400). A missing or blank taxDocumentId is answered with 400 and the message Informe o CNPJ da loja.. At least one of mode and copyItems is required.
The other store fields are checked by the validation rules: a problem is answered with 422 and one fieldErrors item per field, each with field, code and a pt-BR message.
Field error codes: REQUIRED, INVALID_TAX_DOCUMENT_ID, TAX_DOCUMENT_ID_ALREADY_REGISTERED, REJECTED_BY_PLATFORM, SOURCE_NOT_COPYABLE.
"Duplicate a store" sends the checked items in copyItems with that store as sourceRetailerId. "Create from scratch" sends copyItems: [] (or mode: SHELL_ONLY) with the current store as sourceRetailerId.
The single store has no manager: the caller becomes the first user of the new store. A managerEmail sent here is discarded; only the spreadsheet has a manager.
Fields not listed here are discarded. That includes any plan, price or franchise value, because the new store always inherits plan and franchise from the source store.

string
required

ID of the store that plan and franchise are copied from. It must belong to the caller's group. The admin master may pick any store of the group; any other caller only the current store or one of the caller's multi-login stores, otherwise 403.

copyItems
array of strings, unique

Categories of the source store configuration the person checked to copy. The configuration engine (retailer-config-api) files every key under one category in GET /group-config/keys ({ configKey, category }), and only the keys of the checked categories are copied.
Today SETTINGS (Store settings) covers the store details, customer registration, custom fields, sales pipelines and sales channels; FEATURES the Features tab; BUSINESS_HOURS the store hours and the automatic logout; DISPATCH_LIMIT the dispatch limit.
A checked category the engine does not list is not copied and shows up in the configuration step as ignored, with reason categoryNotListedByEngine; it does not fail the store.
A key whose change the engine refuses with 403 (for example marketing.dispatchLimit@v2 when the caller lacks the usage-limit permission) is not copied either and shows up in the configuration step as ignored, with reason changeNotAllowed; the other keys are still copied and the store does not fail.
An empty list creates the store from scratch (SHELL_ONLY). Any other value, such as USAGE_LIMITS, answers 400.
When mode is also sent, it must agree with the list, otherwise 400 with the message O modo não combina com os itens marcados para copiar.. When only mode is sent, WITH_CONFIGURATION means every item and SHELL_ONLY means none.

string
enum

Kept for older clients; prefer copyItems.
SHELL_ONLY creates the store, its contract and the login link, and skips the configuration copy.
WITH_CONFIGURATION also copies the configuration of the source store. GET /retailers/clones/capabilities offers it only while the store-clone-with-configuration flag is active for the caller's retailer.

Allowed:
string
required

Name of the new store, typed by the person. It is checked for availability in parse-server (422 on retailerName).

string
required

Street of the new store. Never copied from the source store.

string
required

Street number of the new store. Never copied from the source store.

string
required

Suburb of the new store. Required. Never copied from the source store.

string
required

Zip code of the new store. Never copied from the source store.

string
required

City of the new store. Never copied from the source store.

string
required

State of the new store. Never copied from the source store.

string

Optional host name of the new store. When sent, it is checked for availability in parse-server (422 on hostName).

string

Optional phone of the new store. Never copied from the source store.

string

Optional address complement. Never copied from the source store.

string

Optional country of the new store.

string
required

CNPJ of the new store, with or without the mask. Required. It must have valid check digits (INVALID_TAX_DOCUMENT_ID) and must not belong to another store of the platform nor to another clone in progress (TAX_DOCUMENT_ID_ALREADY_REGISTERED).

string

Optional business name used on invoices of the new store.

Responses

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json