Set up and publish a site from its address
Create a site, its live agent and its Shopify catalog connection from one storefront address with an API key, follow its analysis, and publish its AI Storefront at once or later.
A script can set a site up from nothing but a storefront address, with an organization API key and no member signed in. One call does what the dashboard's storefront address step does: it reads the store, creates the site and an agent put live on it, connects the Shopify catalog when the store runs on Shopify, and starts the site analysis and the sitemap import in the background. The same call with publish, or a second call later, switches the site's AI Storefront on and gives you its link.
For the schemas, see Set a site up from its storefront address and Switch a site's hosted page on or off. To create an API key, see Authentication. A member connected through an MCP client does the same with the tools provision_site_from_url and set_site_hosted_page (see MCP server).
Before you start
- Accept the terms of service in the dashboard. A member accepts them for the organization when creating it. An API key can't stand for that acceptance, so until it is done every call answers
terms_not_acceptedand nothing is fetched or created. - Check the organization can hold one more site. A capped organization at its site quota answers
site_limit_reached. See Usage and limits. Each new site also starts an analysis of its store, so send only addresses you mean to set up.
Set up and publish a site
Send the address
Call POST /api/v1/sites/provision with the storefront address in url, such as shop.example.com or https://shop.example.com. Add "publish": true to switch the AI Storefront on in the same call. Leave it out (it defaults to false) to publish later.
curl -X POST "https://iadvize.ai/api/v1/sites/provision" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "url": "https://demo-storefront.example.com", "publish": true }'The call takes one address and waits for the store to answer and, on Shopify, for the catalog to connect: it can take close to a minute. Give your HTTP client a timeout of a few minutes, and send addresses one at a time.
Read the answer
A new site answers 201. The response (ids and values are illustrative, and site is shortened):
{
"data": {
"status": "provisioned",
"site": {
"id": "site_01kvnwmagvf27rc9cze5rm9e1r",
"name": "Demo Storefront",
"platform": "shopify",
"url": "https://demo-storefront.example.com",
"defaultAgentId": "agt_01kvnwmagvf27rc9cze5rm9e1s",
"hostedPage": {
"enabled": true,
"link": "https://iadvize.ai/s/EXAMPLE_SITE_KEY"
},
"analysisState": "running"
},
"agentId": "agt_01kvnwmagvf27rc9cze5rm9e1s",
"catalogConnector": true,
"catalogProducts": true,
"publication": "published"
}
}| Field | Meaning |
|---|---|
status | provisioned when the call created the agent (and the site, unless one already existed on the address with no agent). existing when the organization already had a site on this address with an agent. |
site | The full site, as Get a site returns it. site.hostedPage.link is the AI Storefront's address while it is published, null otherwise. |
agentId | The agent that was created and put live, or the site's existing agent. |
catalogConnector | true when the agent has a Shopify catalog connector. false when it has none (the store was not confirmed as Shopify, so the agent has no products). null on an existing site, which the call didn't look at. |
catalogProducts | true when the first check of the new connector listed at least one product, false when the catalog answered with none. null when no connector was created, on an existing site, or when the check could not tell or ran out of time. |
publication | What happened to the AI Storefront: published, not_requested (no publish in the call), no_default_agent, agent_not_live or failed. See When the publication is refused. |
The site is named after the brand the storefront declares (else its domain), and the agent after the site with the suffix "AI Shopping Agent" ("Agent Shopping IA" on a French site). The market hosts the storefront declares are added to the site's authorized domains, as at any site creation.
Follow the analysis
The analysis of the store and the sitemap import keep running after the call has answered. Nobody is emailed when they end, since an API key has no member. Poll GET /api/v1/sites/{siteId} and read analysisState:
running: the analysis is still reading the store.acknowledged: the analysis has finished. A site set up this way skips the dashboard's review screen, so a finished analysis ends in this state.failed: the analysis failed or could not start. The site and its live agent stay as they are.
The pages the sitemap import finds arrive as Not read. Follow the import with List a site's sitemap imports, then read the pages with Read all pages.
A site set up through the API never sends a member of the organization to the onboarding progress, review or "We couldn't learn much about your store" screens, while its analysis runs or after it fails. Members who sign in reach the dashboard as usual.
Publish later
To publish a site you set up without publish, or to take its AI Storefront down, call PUT /api/v1/sites/{siteId}/hosted-page:
curl -X PUT "https://iadvize.ai/api/v1/sites/YOUR_SITE_ID/hosted-page" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "enabled": true }'It answers 200 with the site, and hostedPage.link holds the link while the page is on. It follows the rules of the Publish your AI Storefront switch in the dashboard and of the MCP tool set_site_hosted_page. "enabled": false takes the page down but keeps the site's key, so the same link works again once you switch it back on.
Anyone who has the link can talk to the agent, with no login: publish only a site you want to be reachable.
Existing sites and retries
The call is safe to repeat:
- The site and its agent already exist. The call answers
200withstatus: "existing"and creates nothing. If no agent answers on the site yet, its agent is put live. - The site exists but has no agent. The call creates an agent, puts it live and answers
201withstatus: "provisioned". When the site already has a Shopify connector and the store is confirmed as Shopify, the new agent uses that connector and no second one is created.
With publish, an existing site's AI Storefront is switched on too.
When the call is refused
A refused call answers a problem document. A 400, 409 or 422 creates nothing. A 500 can come after the site was created, so the site, and sometimes its agent, may exist: a new call with the same address picks them up, and answers 200 with status: "existing" once the agent exists (see Existing sites and retries).
| Status | code | Cause | What to do |
|---|---|---|---|
409 | terms_not_accepted | The organization has not accepted the terms of service. | A member accepts them in the dashboard. Then retry. |
409 | site_limit_reached | The organization holds as many sites as its site quota allows. | Ask iAdvize to raise the quota, or delete a site you no longer need. |
422 | storefront_unreachable | The address does not answer. | Check that the address opens in a browser, then retry. |
400 | storefront_not_public | The address is not a public one (a private or local host), so it was never requested. | Use the store's public address. |
400 | invalid_request | The body is not valid: url missing or empty, an unknown field, publish not a boolean. | Fix the body. |
500 | internal_error | A fault on our side. | Retry. A retry finds what the first call already created and does not create it a second time. |
When the publication is refused
A refused publication never undoes the site. The call still answers 201 or 200 with the site and its agent, and publication says why the AI Storefront stayed off:
no_default_agent: no agent answers on the site.agent_not_live: the agent that answers on the site has no live version.failed: an error on our side stopped the publication. CallPUT /api/v1/sites/{siteId}/hosted-pageto publish it.
Put an agent live (in the dashboard, or with Put a version live), then call PUT /api/v1/sites/{siteId}/hosted-page. On that route the same two cases answer 409 with hosted_page_no_default_agent or hosted_page_agent_not_live, and the page stays off. An unknown site answers 404 with not_found.
In Admin activity
Every object the calls create or change (the site, its connector, its agent, the go-live, the publication) is recorded in Admin activity under the same actions as in the dashboard, attributed to the API key.