Skip to content
Create API key

Customer API quickstart

  • A Plunk Commerce plan (or Studio Storefront). See which plans include the API.
  • A workspace owner or admin to create the key. See API keys.
  • Decide where the key will run. Browser code gets a publishable key (pk_live_…), locked to your site’s origins. Server code gets a secret key (sk_live_…). See authentication and keys.

Every integration starts here. It lists the resource families and endpoints your key can reach.

Terminal
curl https://api.plunk.io/cx/v1/capabilities \
-H "Authorization: Bearer sk_test_••••"
Response (shortened)
{
"tenant": "youraccount",
"tenantType": "retailer",
"mode": "test",
"aggregationFloor": 5,
"labels": { "location": "Showroom" },
"families": [
{
"name": "products",
"key": "publishable",
"scopes": ["products:read", "recommendations:read"],
"label": null,
"endpoints": ["GET /cx/v1/products/top/{range}", "GET /cx/v1/products/{id}", "…"]
}
]
}
Terminal
curl "https://api.plunk.io/cx/v1/products/top/this_month?limit=3" \
-H "Authorization: Bearer sk_test_••••"

A secret key also gets revenue and aov on each row. A publishable key gets rank, units and orders only, and rows under 5 orders are left out.

Publishable keys can write events. Register your site’s origins on the key first, or the call is refused with 401.

Terminal
curl -X POST https://api.plunk.io/cx/v1/ingest/event \
-H "Authorization: Bearer pk_test_••••" \
-H "Content-Type: application/json" \
-d '{ "type": "product_view", "visitorRef": "v_84af", "productId": "SF-1042" }'
202 Accepted
{ "accepted": true, "eventId": "9d1c…", "type": "product_view" }

Sales need a secret key. Posting the same orderId again replaces that order’s lines, so webhook retries are safe.

Terminal
curl -X POST https://api.plunk.io/cx/v1/ingest/sale \
-H "Authorization: Bearer sk_test_••••" \
-H "Content-Type: application/json" \
-d '{
"orderId": "cs_a1B2c3",
"customerRef": "cus_R8xT2m",
"email": "buyer@example.com",
"lines": [ { "productId": "SF-1042", "description": "Harbor Sofa", "quantity": 2, "price": 2398.00 } ]
}'
  • 401 means the key is missing or wrong, a publishable key came from an origin that isn’t registered on it, or a secret key came from a browser. See API returns 401 or 403.
  • 403 secret_key_required means you sent a sale, order status or reorder request with a publishable key. Move the call to your server.
  • 403 scope_not_permitted means the key’s class or scopes don’t cover that family, or the family isn’t enabled for your account yet. Check your capabilities document.
Was this helpful?

Still stuck? Contact support and include the job or page you were on.