ShopfloDevelopers

Docs

Authentication

How to prove who you are on each Shopflo API.

Partner token

Exchange your client credentials for a short-lived bearer token, then send it on every call.

Used by: Commerce Partner API.

How it works

  1. Shopflo issues a client id (it starts with sfcp_) and a client secret after your application is approved. The secret is shown once.
  2. Call the token endpoint with both values. Do this from your server only, never from a browser or a mobile app.
  3. Send the token on every call as Authorization: Bearer <access_token>.
  4. A token is valid for 3600 seconds (60 minutes). Ask for a new one a few minutes before it ends, or when a call returns 401.
  5. If Shopflo rotates your secret, tokens issued before the rotation stop working.

Get a token

Request
curl -sS -X POST "https://api.shopflo.co/heimdall/api/v1/commerce-partner/token" \
  -H "Content-Type: application/json" \
  -d '{"client_id": "sfcp_your_client_id", "client_secret": "your_client_secret"}'
Response
{
  "success": true,
  "data": {
    "access_token": "eyJhbGciOi...",
    "token_type": "Bearer",
    "expires_in": 3600
  }
}

Call the API

Send the credential in the Authorization header on every call.

Header
Authorization: Bearer your_access_token

Cache the token and reuse it until it is close to expiry. The token endpoint is limited to 10 requests a minute per IP address.

Merchant API key

A channel API key from your Shopflo dashboard, sent as the whole value of the Authorization header.

Used by: Checkout API, Discount API, Shipping API, Catalog API.

How it works

  1. This key is for engineers working on a brand's own Shopflo store, the brand or its agency. Make calls from your server, never from a browser or an app.
  2. In the Shopflo dashboard, go to Settings, then Channels, and create a channel.
  3. Open the channel's details and copy its API key. It starts with sfat-. Store it as a secret.
  4. Send it as the Authorization header with the key as the whole value, for example Authorization: sfat-your_key. Do not add Bearer. A Bearer prefix is rejected.
  5. A channel key acts for your whole Shopflo account through these APIs, so treat it like a password. To replace a key, delete the channel and create a new one.

Call the API

Send the credential in the Authorization header on every call.

Header
Authorization: sfat-your_key

A missing or unrecognised key returns 401. Successful responses use the envelope described in Errors and rate limits.

Keep secrets on your server

  • Never put a client secret, a token or an API key in a browser, a mobile app or a public repository.
  • If a secret or key is exposed, replace it straight away. For a partner secret, tell Shopflo so it can be rotated. For a channel key, delete the channel and create a new one.