# Commerce & blogs

Connect Shopify, WooCommerce, WordPress, Wix and Webflow to manage catalogs, read orders, publish blog articles and install ad pixels with one API.

Stores and websites are accounts too. Connect a Shopify store, a WooCommerce shop or a WordPress, Wix or Webflow site to a profile, and you can manage its catalog, read its orders, publish its blog and put ad pixels on it, with the same API key and request shapes you use for social posting. Write the integration once and it works on every platform that supports the job.

## What each platform supports

| Job | Shopify | WooCommerce | WordPress | Wix | Webflow |
| --- | --- | --- | --- | --- | --- |
| Products, variants, images, stock | Yes | Yes | Through WooCommerce | No | No |
| Collections and discounts | Yes | Categories and coupons | Through WooCommerce | No | No |
| Orders (read-only) | Yes | Yes | Through WooCommerce | No | No |
| Store pages | Yes | Yes | Yes | No | No |
| Menus, redirects, markets, metaobjects, sales channels | Yes | No | No | No | No |
| Meta catalog sync | Yes | Yes | Through WooCommerce | No | No |
| Blog articles | Yes | Via WordPress | Yes | Yes | Yes (CMS items) |
| Native scheduling of articles | Yes | Via WordPress | Yes | Yes | No |
| Ad pixels on the site | Yes, with storefront events | Via WordPress | Yes, page views | Yes, page views | Yes, page views |

WooCommerce is not a separate connection: it is a self-hosted [WordPress](https://pozy.ai/docs/platforms/wordpress) site with WooCommerce installed, connected with an Application Password. Store objects from it report `platform: "woocommerce"`.

## Two APIs, one account

- **Commerce API** at `/v1/commerce/...` covers the catalog, stock, orders, discounts and store content. Every call names the store with `accountId`: in the query on reads, in the body on writes. See [Products](https://pozy.ai/docs/commerce/products) and [Orders](https://pozy.ai/docs/commerce/orders).
- **Blogs API** at `/v1/accounts/{accountId}/blogs/...` publishes articles. The same five calls work on Shopify, WordPress, Wix and Webflow. See [Blogs](https://pozy.ai/docs/commerce/blogs).

Ad pixels use the tracking tag endpoints of your ads account and name the site as `storeAccountId`. See [Site pixels](https://pozy.ai/docs/commerce/site-pixels).

## Start with the store's capabilities

Call `GET /v1/commerce/store` before anything else. It tells you the currency and country, what the store can do now, and what it could do once the owner grants more permissions.

```bash cURL
curl "https://api.pozy.ai/v1/commerce/store?accountId=6710c4b2e4b0d2f1a8c95e3a" \
  -H "Authorization: Bearer $POZY_API_KEY"
```
```ts Node
const res = await fetch("https://api.pozy.ai/v1/commerce/store?accountId=6710c4b2e4b0d2f1a8c95e3a", {
  headers: { Authorization: `Bearer ${process.env.POZY_API_KEY}` },
});
const data = await res.json();
if (!res.ok) throw new Error(data.error);

if (data.store.missingCapabilities.includes("orders.read")) {
  console.log("Ask the owner to approve:", data.store.grantPermissionsUrl);
}
```
```python Python
import os, requests

store = requests.get(
    "https://api.pozy.ai/v1/commerce/store",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    params={"accountId": "6710c4b2e4b0d2f1a8c95e3a"},
).json()["store"]

print(store["capabilities"], store["grantPermissionsUrl"])
```

```json
{
  "store": {
    "accountId": "6710c4b2e4b0d2f1a8c95e3a",
    "platform": "shopify",
    "name": "Acme",
    "domain": "acme.myshopify.com",
    "url": "https://acme.com",
    "currency": "USD",
    "country": "US",
    "capabilities": ["products.read", "products.create", "products.update", "collections.read", "pages.read", "pages.write"],
    "missingCapabilities": ["inventory.read", "inventory.write", "discounts.read", "orders.read"],
    "grantPermissionsUrl": "https://admin.shopify.com/store/acme/oauth/install?..."
  }
}
```

On Shopify, send the owner to `grantPermissionsUrl` to approve the missing capabilities on the existing install, then read the store again. `grantPermissionsUrl` is `null` when nothing is missing, on stores connected with a custom-app token, and always on WooCommerce. The capability-to-scope table is on the [Shopify](https://pozy.ai/docs/platforms/shopify#permissions) page.

## Shared conventions

| Topic | Rule |
| --- | --- |
| Ids | The platform's own ids, as strings. Read them from responses, never build them |
| Money | Responses return `{ "amount": "24.00", "currency": "USD" }`. Write bodies take a plain decimal in the store currency, as a number or string |
| Product status | `active`, `draft`, `pending_review`, `rejected`, `inactive`, `archived` or `deleted`. The platform's raw value is in `platformStatus` |
| Timestamps | ISO 8601, UTC |
| Pagination | Lists return `{ <resource>, nextCursor }`. Pass `limit` and the previous `nextCursor` as `cursor`. `nextCursor` is `null` on the last page |
| Storage | Pozy keeps no copy of store data. Each call goes to the store live, so results are always current |
| Unsupported operations | `400 platform_not_supported`. Check `capabilities` first |

## Errors

| Error | Cause | Fix |
| --- | --- | --- |
| `400 platform_not_supported` | The account is not a store, or its platform lacks the operation | Check `capabilities` on `GET /v1/commerce/store` |
| `400 invalid_field_value` | The platform rejected a field, or it does not exist there | Read the message; see the WooCommerce differences on [WordPress](https://pozy.ai/docs/platforms/wordpress#woocommerce) |
| `403 insufficient_permissions` | The store has not granted the scope | Send the owner to `grantPermissionsUrl`, or reconnect |
| `404 product_not_found`, `404 resource_not_found` | Deleted, or another store's id | List the resource for a current id |
| `409 catalog_sync_conflict` | A sync for that store and catalog exists, or a run is in progress | Run the existing sync, or wait |
| `429` | Your rate limit or the platform's | Wait for `Retry-After` |
| `502` | The platform failed or was unavailable | Check the result of the earlier write before retrying |

## In this section

- [Products](https://pozy.ai/docs/commerce/products): Catalog, variants, images, stock, collections, discounts and Meta catalog sync.
- [Orders](https://pozy.ai/docs/commerce/orders): Read orders in one shape across stores, with attribution and webhooks.
- [Blogs](https://pozy.ai/docs/commerce/blogs): One request to publish or schedule an article on four platforms.
- [Site pixels](https://pozy.ai/docs/commerce/site-pixels): Put Meta, TikTok, Google and other tags on a store or site in one call.

## Endpoints

| Endpoint | What it does |
| --- | --- |
| [`GET /v1/commerce/store`](https://pozy.ai/docs/api/getCommerceStore) | Get a store |
| [`GET /v1/commerce/orders`](https://pozy.ai/docs/api/listCommerceOrders) | List orders |
| [`GET /v1/commerce/orders/{orderId}`](https://pozy.ai/docs/api/getCommerceOrder) | Get an order |
| [`GET /v1/commerce/products`](https://pozy.ai/docs/api/listCommerceProducts) | List products |
| [`POST /v1/commerce/products`](https://pozy.ai/docs/api/createCommerceProduct) | Create a product |
| [`POST /v1/commerce/products/state`](https://pozy.ai/docs/api/changeCommerceProductState) | Activate, deactivate, archive or delete products |
| [`GET /v1/commerce/products/{productId}`](https://pozy.ai/docs/api/getCommerceProduct) | Get a product |
| [`PATCH /v1/commerce/products/{productId}`](https://pozy.ai/docs/api/updateCommerceProduct) | Update a product |
| [`POST /v1/commerce/products/{productId}/price`](https://pozy.ai/docs/api/updateCommerceProductPrices) | Update variant prices |
| [`GET /v1/commerce/collections`](https://pozy.ai/docs/api/listCommerceCollections) | List collections |
| [`POST /v1/commerce/collections`](https://pozy.ai/docs/api/createCommerceCollection) | Create a collection |
| [`GET /v1/commerce/collections/{collectionId}`](https://pozy.ai/docs/api/getCommerceCollection) | Get a collection |
| [`PATCH /v1/commerce/collections/{collectionId}`](https://pozy.ai/docs/api/updateCommerceCollection) | Update a collection |
| [`DELETE /v1/commerce/collections/{collectionId}`](https://pozy.ai/docs/api/deleteCommerceCollection) | Delete a collection |
| [`POST /v1/commerce/collections/{collectionId}/products`](https://pozy.ai/docs/api/changeCommerceCollectionProducts) | Add or remove products in a collection |
| [`POST /v1/commerce/products/{productId}/variants`](https://pozy.ai/docs/api/createCommerceProductVariants) | Add variants |
| [`DELETE /v1/commerce/products/{productId}/variants`](https://pozy.ai/docs/api/deleteCommerceProductVariants) | Delete variants |
| [`POST /v1/commerce/products/{productId}/options`](https://pozy.ai/docs/api/createCommerceProductOptions) | Add options |
| [`DELETE /v1/commerce/products/{productId}/options`](https://pozy.ai/docs/api/deleteCommerceProductOptions) | Delete options |
| [`POST /v1/commerce/products/{productId}/images`](https://pozy.ai/docs/api/addCommerceProductImages) | Add images |
| [`DELETE /v1/commerce/products/{productId}/images`](https://pozy.ai/docs/api/removeCommerceProductImages) | Remove images |
| [`POST /v1/commerce/products/{productId}/images/reorder`](https://pozy.ai/docs/api/reorderCommerceProductImages) | Reorder images |
| [`POST /v1/commerce/products/{productId}/duplicate`](https://pozy.ai/docs/api/duplicateCommerceProduct) | Duplicate a product |
| [`GET /v1/commerce/products/{productId}/metafields`](https://pozy.ai/docs/api/listCommerceProductMetafields) | List product metafields |
| [`PUT /v1/commerce/products/{productId}/metafields`](https://pozy.ai/docs/api/setCommerceProductMetafields) | Set product metafields |
| [`DELETE /v1/commerce/products/{productId}/metafields`](https://pozy.ai/docs/api/deleteCommerceProductMetafields) | Delete product metafields |
| [`POST /v1/commerce/products/{productId}/channels`](https://pozy.ai/docs/api/changeCommerceProductChannels) | Publish or unpublish a product |
| [`GET /v1/commerce/collections/{collectionId}/metafields`](https://pozy.ai/docs/api/listCommerceCollectionMetafields) | List collection metafields |
| [`PUT /v1/commerce/collections/{collectionId}/metafields`](https://pozy.ai/docs/api/setCommerceCollectionMetafields) | Set collection metafields |
| [`DELETE /v1/commerce/collections/{collectionId}/metafields`](https://pozy.ai/docs/api/deleteCommerceCollectionMetafields) | Delete collection metafields |
| [`POST /v1/commerce/collections/{collectionId}/channels`](https://pozy.ai/docs/api/changeCommerceCollectionChannels) | Publish or unpublish a collection |
| [`POST /v1/commerce/products/tags`](https://pozy.ai/docs/api/changeCommerceProductTags) | Add or remove tags in bulk |
| [`POST /v1/commerce/collections/{collectionId}/reorder`](https://pozy.ai/docs/api/reorderCommerceCollectionProducts) | Reorder products in a collection |
| [`GET /v1/commerce/pages`](https://pozy.ai/docs/api/listCommercePages) | List pages |
| [`POST /v1/commerce/pages`](https://pozy.ai/docs/api/createCommercePage) | Create a page |
| [`GET /v1/commerce/pages/{pageId}`](https://pozy.ai/docs/api/getCommercePage) | Get a page |
| [`PATCH /v1/commerce/pages/{pageId}`](https://pozy.ai/docs/api/updateCommercePage) | Update a page |
| [`DELETE /v1/commerce/pages/{pageId}`](https://pozy.ai/docs/api/deleteCommercePage) | Delete a page |
| [`GET /v1/commerce/locations`](https://pozy.ai/docs/api/listCommerceLocations) | List locations |
| [`GET /v1/commerce/inventory`](https://pozy.ai/docs/api/listCommerceInventory) | Get a product's stock |
| [`POST /v1/commerce/products/{productId}/inventory`](https://pozy.ai/docs/api/changeCommerceInventory) | Set or adjust stock |
| [`GET /v1/commerce/channels`](https://pozy.ai/docs/api/listCommerceChannels) | List sales channels |
| [`GET /v1/commerce/discounts`](https://pozy.ai/docs/api/listCommerceDiscounts) | List discounts |
| [`POST /v1/commerce/discounts`](https://pozy.ai/docs/api/createCommerceDiscount) | Create a discount |
| [`GET /v1/commerce/discounts/{discountId}`](https://pozy.ai/docs/api/getCommerceDiscount) | Get a discount |
| [`PATCH /v1/commerce/discounts/{discountId}`](https://pozy.ai/docs/api/updateCommerceDiscount) | Update a discount |
| [`DELETE /v1/commerce/discounts/{discountId}`](https://pozy.ai/docs/api/deleteCommerceDiscount) | Delete a discount |
| [`POST /v1/commerce/discounts/{discountId}/state`](https://pozy.ai/docs/api/setCommerceDiscountActive) | Activate or deactivate a discount |
| [`POST /v1/commerce/discounts/{discountId}/codes`](https://pozy.ai/docs/api/addCommerceDiscountCodes) | Add codes to a discount |
| [`GET /v1/commerce/redirects`](https://pozy.ai/docs/api/listCommerceRedirects) | List URL redirects |
| [`POST /v1/commerce/redirects`](https://pozy.ai/docs/api/createCommerceRedirect) | Create a URL redirect |
| [`PATCH /v1/commerce/redirects/{redirectId}`](https://pozy.ai/docs/api/updateCommerceRedirect) | Update a URL redirect |
| [`DELETE /v1/commerce/redirects/{redirectId}`](https://pozy.ai/docs/api/deleteCommerceRedirect) | Delete a URL redirect |
| [`GET /v1/commerce/menus`](https://pozy.ai/docs/api/listCommerceMenus) | List navigation menus |
| [`POST /v1/commerce/menus`](https://pozy.ai/docs/api/createCommerceMenu) | Create a navigation menu |
| [`GET /v1/commerce/menus/{menuId}`](https://pozy.ai/docs/api/getCommerceMenu) | Get a navigation menu |
| [`PUT /v1/commerce/menus/{menuId}`](https://pozy.ai/docs/api/updateCommerceMenu) | Replace a navigation menu |
| [`DELETE /v1/commerce/menus/{menuId}`](https://pozy.ai/docs/api/deleteCommerceMenu) | Delete a navigation menu |
| [`GET /v1/commerce/metaobject-definitions`](https://pozy.ai/docs/api/listCommerceMetaobjectDefinitions) | List metaobject definitions |
| [`GET /v1/commerce/metaobjects`](https://pozy.ai/docs/api/listCommerceMetaobjects) | List metaobjects of a type |
| [`POST /v1/commerce/metaobjects`](https://pozy.ai/docs/api/createCommerceMetaobject) | Create a metaobject |
| [`GET /v1/commerce/metaobjects/{metaobjectId}`](https://pozy.ai/docs/api/getCommerceMetaobject) | Get a metaobject |
| [`PATCH /v1/commerce/metaobjects/{metaobjectId}`](https://pozy.ai/docs/api/updateCommerceMetaobject) | Update a metaobject |
| [`DELETE /v1/commerce/metaobjects/{metaobjectId}`](https://pozy.ai/docs/api/deleteCommerceMetaobject) | Delete a metaobject |
| [`GET /v1/commerce/markets`](https://pozy.ai/docs/api/listCommerceMarkets) | List markets |
| [`GET /v1/commerce/price-lists`](https://pozy.ai/docs/api/listCommercePriceLists) | List price lists |
| [`PUT /v1/commerce/price-lists/{priceListId}/prices`](https://pozy.ai/docs/api/setCommercePriceListPrices) | Set fixed prices |
| [`DELETE /v1/commerce/price-lists/{priceListId}/prices`](https://pozy.ai/docs/api/deleteCommercePriceListPrices) | Remove fixed prices |
| [`PUT /v1/commerce/marketing-activities`](https://pozy.ai/docs/api/upsertCommerceMarketingActivity) | Record a marketing activity |
| [`DELETE /v1/commerce/marketing-activities/{remoteId}`](https://pozy.ai/docs/api/deleteCommerceMarketingActivity) | Delete a marketing activity |
| [`POST /v1/commerce/marketing-activities/{remoteId}/engagements`](https://pozy.ai/docs/api/addCommerceMarketingEngagement) | Report daily engagement |
| [`GET /v1/commerce/catalog-syncs`](https://pozy.ai/docs/api/listCommerceCatalogSyncs) | List catalog syncs |
| [`POST /v1/commerce/catalog-syncs`](https://pozy.ai/docs/api/createCommerceCatalogSync) | Sync a store into a Meta catalog |
| [`GET /v1/commerce/catalog-syncs/{syncId}`](https://pozy.ai/docs/api/getCommerceCatalogSync) | Get a catalog sync |
| [`DELETE /v1/commerce/catalog-syncs/{syncId}`](https://pozy.ai/docs/api/deleteCommerceCatalogSync) | Stop a catalog sync |
| [`POST /v1/commerce/catalog-syncs/{syncId}/run`](https://pozy.ai/docs/api/runCommerceCatalogSync) | Run a catalog sync now |

## Webhook events

| Event | When it fires |
| --- | --- |
| [`commerce.product.created`](https://pozy.ai/docs/webhooks/events#commerce-product-created) | Commerce product created. |
| [`commerce.product.updated`](https://pozy.ai/docs/webhooks/events#commerce-product-updated) | Commerce product updated. |
| [`commerce.product.deleted`](https://pozy.ai/docs/webhooks/events#commerce-product-deleted) | Commerce product deleted. |
| [`commerce.order.created`](https://pozy.ai/docs/webhooks/events#commerce-order-created) | Commerce order created. |
| [`commerce.order.updated`](https://pozy.ai/docs/webhooks/events#commerce-order-updated) | Commerce order updated. |
| [`commerce.order.refunded`](https://pozy.ai/docs/webhooks/events#commerce-order-refunded) | Commerce order refunded. |
