API reference
Commerce Partner API
Search products across your brands and hand shoppers to a ready Shopflo checkout.
Available by application Shopping agents, chat and WhatsApp concierges, gifting desks
The Commerce Partner API lets a service you run search the catalogs of the brands Shopflo has enabled for you, then pass the shopper to Shopflo checkout with a cart already built.
To run the whole purchase inside your own chat, use the Commerce MCP instead. Both use the same client id and secret.
Base URL: https://api.shopflo.co
Authentication: Partner token
Exchange your client credentials for a short-lived bearer token, then send it on every call.
Endpoints
Authentication
Get a token
/heimdall/api/v1/commerce-partner/token
Exchange your client id and client secret for a bearer token. expires_in is in seconds.
Request body
- client_idstringRequired
Starts with
sfcp_. - client_secretstringRequired
Shown once when Shopflo issues your keys.
Response fields in data
- access_tokenstringRequired
Send it as
Authorization: Bearer <access_token>. - token_typestringRequired
Always
Bearer. - expires_inintegerRequired
Lifetime in seconds. 3600 by default.
Errors
| Status | Code | When |
|---|---|---|
400 | GE_001 | client_id or client_secret is missing or blank. The message names the field, for example client_id is required. |
401 | AUTH_018 | The client id is unknown, the secret is wrong, or your access is suspended, revoked or past its end date. The response does not say which. |
429 | TOO_MANY_REQUESTS | More than 10 requests a minute from one IP address. An IP address with more than 30 attempts is blocked for 15 minutes. |
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"
}'const res = await fetch("https://api.shopflo.co/heimdall/api/v1/commerce-partner/token", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
client_id: process.env.SHOPFLO_CLIENT_ID,
client_secret: process.env.SHOPFLO_CLIENT_SECRET
}),
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.post(
"https://api.shopflo.co/heimdall/api/v1/commerce-partner/token",
json={
"client_id": os.environ["SHOPFLO_CLIENT_ID"],
"client_secret": os.environ["SHOPFLO_CLIENT_SECRET"]
},
)
print(response.json()["data"])import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
var body = """
{
"client_id": "%s",
"client_secret": "%s"
}
""".formatted(System.getenv("SHOPFLO_CLIENT_ID"), System.getenv("SHOPFLO_CLIENT_SECRET"));
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.shopflo.co/heimdall/api/v1/commerce-partner/token"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := bytes.NewBufferString(fmt.Sprintf(`{
"client_id": "%s",
"client_secret": "%s"
}`, os.Getenv("SHOPFLO_CLIENT_ID"), os.Getenv("SHOPFLO_CLIENT_SECRET")))
req, err := http.NewRequest("POST", "https://api.shopflo.co/heimdall/api/v1/commerce-partner/token", body)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(string(data))
}<?php
$ch = curl_init("https://api.shopflo.co/heimdall/api/v1/commerce-partner/token");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
'client_id' => getenv("SHOPFLO_CLIENT_ID"),
'client_secret' => getenv("SHOPFLO_CLIENT_SECRET")
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"data": {
"access_token": "eyJhbGciOi...",
"token_type": "Bearer",
"expires_in": 3600
}
}Get your account
/heimdall/api/v1/commerce-partner/me
Returns your account and the brands Shopflo has enabled for you. Use it to find the merchant_id values you can pass to the other endpoints.
Response fields in data
- client_idstringRequired
Your client id.
- namestringRequired
Your account name.
- statusstringRequired
ACTIVE,SUSPENDEDorREVOKED. OnlyACTIVEaccounts can call the API. - merchantsarrayRequired
The brands enabled for you. Empty until Shopflo enables one.
- merchant_idstringRequired
Pass this to product search filters and to the checkout endpoint.
- namestringOptional
Brand name. Null for a brand with no profile yet.
- shop_domainstringOptional
The brand's store domain. Null for a brand with no profile yet.
Calls to this endpoint count toward your per-minute limit.
Errors
| Status | Code | When |
|---|---|---|
401 | GE_003 | The token is missing, invalid or expired, or your account is not active. data holds the reason. |
429 | AUTH_001 | You went over your per-minute limit. |
curl -sS "https://api.shopflo.co/heimdall/api/v1/commerce-partner/me" \ -H "Authorization: Bearer your_access_token"
const res = await fetch("https://api.shopflo.co/heimdall/api/v1/commerce-partner/me", {
headers: {
Authorization: `Bearer ${process.env.SHOPFLO_ACCESS_TOKEN}`,
},
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.get(
"https://api.shopflo.co/heimdall/api/v1/commerce-partner/me",
headers={
"Authorization": "Bearer " + os.environ["SHOPFLO_ACCESS_TOKEN"],
},
)
print(response.json()["data"])import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.shopflo.co/heimdall/api/v1/commerce-partner/me"))
.header("Authorization", "Bearer " + System.getenv("SHOPFLO_ACCESS_TOKEN"))
.GET()
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, err := http.NewRequest("GET", "https://api.shopflo.co/heimdall/api/v1/commerce-partner/me", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer " + os.Getenv("SHOPFLO_ACCESS_TOKEN"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(string(data))
}<?php
$ch = curl_init("https://api.shopflo.co/heimdall/api/v1/commerce-partner/me");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("SHOPFLO_ACCESS_TOKEN"),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"data": {
"client_id": "sfcp_your_client_id",
"name": "Example Concierge Ltd",
"status": "ACTIVE",
"merchants": [
{
"merchant_id": "your_merchant_id",
"name": "Example Brand",
"shop_domain": "example-brand.myshopify.com"
}
]
}
}Products
Search products
/ce/api/v1/partner/product/search
Searches the catalogs of the brands enabled for you. Without merchant_ids it searches all of them. Each result is one product, with the id of its cheapest variant. Set include_variants to get every variant.
Request body
- querystringOptional
Free text. Every word must appear in the product name, vendor or product type. Results are ordered by how closely the name matches, then by lowest price. Without a query, results are ordered by lowest price.
- tagsarray of stringOptional
A product matches if it has any one of these tags.
- min_priceintegerOptional
Lowest price in whole currency units (for example rupees), 0 or more.
- max_priceintegerOptional
Highest price in whole currency units, 0 or more.
- limitintegerOptional
1 to 50. Defaults to 10.
- merchant_idsarray of stringOptional
Limit the search to these brands. Every id must be on your
/melist, or the call returns 403. Omit it to search all your brands. - include_variantsbooleanOptional
Defaults to false. When true, each result carries a
variantsarray of up to 25 variants.
Response fields in data
- merchant_idstringRequired
The brand the product belongs to.
- product_idstringRequired
The product.
- variant_idstringRequired
The cheapest variant of the product. This is the id you send to the checkout endpoint.
- namestringRequired
Product name.
- handlestringRequired
Product handle.
- image_urlstringOptional
The main image.
- vendorstringOptional
Vendor.
- product_typestringOptional
Product type.
- tagsarray of stringRequired
Empty when the product has none.
- min_pricenumberRequired
Lowest variant price, in whole currency units with decimals.
- max_pricenumberRequired
Highest variant price, in whole currency units with decimals.
- currencystringRequired
Currency code of the prices.
- variant_countintegerRequired
How many variants the product has.
- variantsarrayOptional
Only present when
include_variantsis true. Up to 25 per product, cheapest first.- variant_idstringRequired
The variant.
- titlestringRequired
Variant title, for example a size.
- pricenumberRequired
Price in whole currency units with decimals.
- compare_at_pricenumberOptional
Higher original price. Null when there is none.
- availablebooleanRequired
False when the variant is out of stock and the brand does not allow overselling.
- image_urlstringOptional
Image linked to this variant, if any.
Products with no price above zero are left out. An empty data array means nothing matched, or no brand is enabled for you.
Errors
| Status | Code | When |
|---|---|---|
400 | GE_001 | A field is out of range, for example Limit cannot exceed 50, or the body is not valid JSON. |
401 | GE_003 | The token is missing, invalid or expired, or your account is not active. |
403 | GE_007 | merchant_ids includes a brand that is not enabled for you. The message is Merchant not available to this partner. |
429 | AUTH_001 | You went over your per-minute limit. |
curl -sS -X POST "https://api.shopflo.co/ce/api/v1/partner/product/search" \
-H "Authorization: Bearer your_access_token" \
-H "Content-Type: application/json" \
-d '{
"query": "linen shirt",
"max_price": 3000,
"limit": 5,
"include_variants": true
}'const res = await fetch("https://api.shopflo.co/ce/api/v1/partner/product/search", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SHOPFLO_ACCESS_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
query: "linen shirt",
max_price: 3000,
limit: 5,
include_variants: true
}),
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.post(
"https://api.shopflo.co/ce/api/v1/partner/product/search",
headers={
"Authorization": "Bearer " + os.environ["SHOPFLO_ACCESS_TOKEN"],
},
json={
"query": "linen shirt",
"max_price": 3000,
"limit": 5,
"include_variants": True
},
)
print(response.json()["data"])import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
var body = """
{
"query": "linen shirt",
"max_price": 3000,
"limit": 5,
"include_variants": true
}
""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.shopflo.co/ce/api/v1/partner/product/search"))
.header("Authorization", "Bearer " + System.getenv("SHOPFLO_ACCESS_TOKEN"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := bytes.NewBufferString(`{
"query": "linen shirt",
"max_price": 3000,
"limit": 5,
"include_variants": true
}`)
req, err := http.NewRequest("POST", "https://api.shopflo.co/ce/api/v1/partner/product/search", body)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer " + os.Getenv("SHOPFLO_ACCESS_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(string(data))
}<?php
$ch = curl_init("https://api.shopflo.co/ce/api/v1/partner/product/search");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("SHOPFLO_ACCESS_TOKEN"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
'query' => 'linen shirt',
'max_price' => 3000,
'limit' => 5,
'include_variants' => true
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"data": [
{
"merchant_id": "your_merchant_id",
"product_id": "prod_123",
"variant_id": "var_456",
"name": "Linen Shirt",
"handle": "linen-shirt",
"image_url": "https://example.com/linen-shirt.jpg",
"vendor": "Example Brand",
"product_type": "Shirts",
"tags": ["linen", "summer"],
"min_price": 1499.00,
"max_price": 1699.00,
"currency": "INR",
"variant_count": 3,
"variants": [
{
"variant_id": "var_456",
"title": "S",
"price": 1499.00,
"compare_at_price": 1999.00,
"available": true,
"image_url": "https://example.com/linen-shirt-s.jpg"
}
]
}
]
}Checkout
Create a checkout link
/kratos/api/v1/partner/merchant/{merchant_id}/token
Creates a checkout for one brand with the items you send, and returns a link to Shopflo checkout. Send the shopper to checkout_url. They finish the order there, and the order is attributed to your account.
Path parameters
- merchant_idstringRequired
The brand. It must be on your
/melist.
Request body
- itemsarrayRequired
At least one item. One checkout holds items from one brand.
- variant_idstringRequired
A
variant_idfrom product search for the same brand. - quantityintegerRequired
1 or more.
Response fields in data
- token_idstringRequired
Identifies the checkout session.
- checkout_urlstringRequired
Open it for the shopper in a browser or in-app web view, or send it in a message. Do not build the link yourself.
This endpoint does not log the shopper in and does not take payment. To run login and payment inside your own chat, use the Commerce MCP.
Errors
| Status | Code | When |
|---|---|---|
400 | GE_001 | items is empty, an item has no variant_id, or a quantity is missing or below 1. The message names the problem. |
401 | GE_003 | The token is missing, invalid or expired, or your account is not active. |
403 | GE_007 | The brand in the path is not enabled for you. The message is Merchant not available to this partner. |
429 | AUTH_001 | You went over your per-minute limit. |
curl -sS -X POST "https://api.shopflo.co/kratos/api/v1/partner/merchant/your_merchant_id/token" \
-H "Authorization: Bearer your_access_token" \
-H "Content-Type: application/json" \
-d '{
"items": [
{
"variant_id": "var_456",
"quantity": 1
}
]
}'const res = await fetch("https://api.shopflo.co/kratos/api/v1/partner/merchant/your_merchant_id/token", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SHOPFLO_ACCESS_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
items: [
{
variant_id: "var_456",
quantity: 1
}
]
}),
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.post(
"https://api.shopflo.co/kratos/api/v1/partner/merchant/your_merchant_id/token",
headers={
"Authorization": "Bearer " + os.environ["SHOPFLO_ACCESS_TOKEN"],
},
json={
"items": [
{
"variant_id": "var_456",
"quantity": 1
}
]
},
)
print(response.json()["data"])import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Example {
public static void main(String[] args) throws Exception {
var body = """
{
"items": [
{
"variant_id": "var_456",
"quantity": 1
}
]
}
""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.shopflo.co/kratos/api/v1/partner/merchant/your_merchant_id/token"))
.header("Authorization", "Bearer " + System.getenv("SHOPFLO_ACCESS_TOKEN"))
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := bytes.NewBufferString(`{
"items": [
{
"variant_id": "var_456",
"quantity": 1
}
]
}`)
req, err := http.NewRequest("POST", "https://api.shopflo.co/kratos/api/v1/partner/merchant/your_merchant_id/token", body)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer " + os.Getenv("SHOPFLO_ACCESS_TOKEN"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, err := io.ReadAll(res.Body)
if err != nil {
panic(err)
}
fmt.Println(string(data))
}<?php
$ch = curl_init("https://api.shopflo.co/kratos/api/v1/partner/merchant/your_merchant_id/token");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . getenv("SHOPFLO_ACCESS_TOKEN"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
'items' => [
[
'variant_id' => 'var_456',
'quantity' => 1
]
]
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"data": {
"token_id": "tok_abc123",
"checkout_url": "https://checkout.shopflo.co/stable/?tokenId=tok_abc123"
}
}