API reference
Discount API
Create and manage your store's coupons.
Available Brands and agencies
Use the Discount API to create coupons, change them, turn them on or off, and see where a code was used. It manages the same coupons you see in your Shopflo dashboard.
Every path starts with /de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}. issuer_id is always 8d593cf0-99a5-4c0b-8988-0069fff0c197. merchant_id must be your own Shopflo merchant id, or the call returns 400. Ask [email protected] if you do not have it.
Calls are made from your server with a channel API key.
Base URL: https://api.shopflo.co
Authentication: Merchant API key
A channel API key from your Shopflo dashboard, sent as the whole value of the Authorization header.
Endpoints
Coupons
Create a coupon
/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon
Creates a coupon for your store. Send is_active as true if the coupon should work straight away.
Path parameters
- issuer_idstringRequired
Always
8d593cf0-99a5-4c0b-8988-0069fff0c197. - merchant_idstringRequired
Your own Shopflo merchant id. A different id returns 400. Ask [email protected] if you do not have it.
Request body
- codestringOptional
The code shoppers enter. No spaces. Stored in upper case, and must be unique for your store. If you leave it out, Shopflo generates a random one.
- titlestringOptional
Internal title.
- descriptionstringOptional
Text shown to shoppers. If you leave it out, Shopflo writes one from the coupon rules.
- coupon_typestringRequired
Use
AMOUNT. Other types exist and have extra rules that this reference does not cover. - amount_typestringOptional
FLATorPERCENTAGE. - concession_amountnumberRequired
The discount value, 0 or more. Its meaning follows
amount_type. - maximum_concession_amountnumberOptional
Upper limit on the discount. Not allowed when
amount_typeisFLAT. - prerequisite_subtotal_rangenumberOptional
Minimum cart subtotal for the coupon to apply.
- start_dateintegerOptional
Start time in epoch milliseconds.
- end_dateintegerOptional
End time in epoch milliseconds.
- once_per_userbooleanOptional
Defaults to false.
- is_activebooleanOptional
Defaults to false. A coupon that is not active cannot be used.
- is_discoverablebooleanOptional
Defaults to false. Discoverable coupons are offered to shoppers at checkout.
- is_auto_applicablebooleanOptional
Defaults to false. Applies the coupon automatically when it qualifies.
- is_stackablebooleanOptional
Defaults to false. Allows the coupon to combine with other discounts.
- tagsarray of stringOptional
Labels you can filter by.
Response fields in data
- coupon_idstringRequired
The coupon's id. Use it in the other endpoints.
- merchant_idstringRequired
Your merchant id.
- codestringRequired
The coupon code, in upper case.
- titlestringOptional
Title.
- descriptionstringOptional
Shopper-facing text.
- coupon_typestringRequired
The coupon type.
- amount_typestringOptional
FLATorPERCENTAGE. - concession_amountnumberOptional
The discount value.
- maximum_concession_amountnumberOptional
Upper limit on the discount.
- prerequisite_subtotal_rangenumberOptional
Minimum cart subtotal.
- start_dateintegerOptional
Start time in epoch milliseconds.
- end_dateintegerOptional
End time in epoch milliseconds.
- once_per_userbooleanRequired
Once per shopper.
- activebooleanRequired
Whether the coupon is active. This is
is_activein requests. - discoverablebooleanRequired
Whether the coupon is offered to shoppers. This is
is_discoverablein requests. - auto_applicablebooleanRequired
Applied automatically. This is
is_auto_applicablein requests. - stackablebooleanRequired
Combines with other discounts. This is
is_stackablein requests. - tagsarray of stringOptional
Labels.
- created_bystringOptional
Who created the coupon.
- created_atintegerOptional
Creation time in epoch milliseconds.
- updated_atintegerOptional
Last update time in epoch milliseconds.
Shopflo supports more fields for specific integrations. Contact [email protected] if you need one.
Errors
| Status | Code | When |
|---|---|---|
400 | GE_001 | A rule failed. The message names it, for example Invalid Coupon Type, Concession Amount cannot be null, Invalid Coupon Code, code cannot contain spaces, or Maximum Concession Amount cannot be set for Flat Amount Type. Also returned when merchant_id is not yours. |
400 | DEE_001 | A coupon with this code already exists for your store. |
401 | GE_003 | The Authorization header is missing or the key is not recognised. |
curl -sS -X POST "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon" \
-H "Authorization: sfat-your_key" \
-H "Content-Type: application/json" \
-d '{
"code": "WELCOME10",
"title": "Welcome offer",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10,
"maximum_concession_amount": 200,
"prerequisite_subtotal_range": 999,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": true,
"is_active": true,
"is_discoverable": true,
"tags": ["welcome"]
}'const res = await fetch("https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon", {
method: "POST",
headers: {
Authorization: process.env.SHOPFLO_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
code: "WELCOME10",
title: "Welcome offer",
coupon_type: "AMOUNT",
amount_type: "PERCENTAGE",
concession_amount: 10,
maximum_concession_amount: 200,
prerequisite_subtotal_range: 999,
start_date: 1767225600000,
end_date: 1769817600000,
once_per_user: true,
is_active: true,
is_discoverable: true,
tags: ["welcome"]
}),
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.post(
"https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon",
headers={
"Authorization": os.environ["SHOPFLO_API_KEY"],
},
json={
"code": "WELCOME10",
"title": "Welcome offer",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10,
"maximum_concession_amount": 200,
"prerequisite_subtotal_range": 999,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": True,
"is_active": True,
"is_discoverable": True,
"tags": ["welcome"]
},
)
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 = """
{
"code": "WELCOME10",
"title": "Welcome offer",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10,
"maximum_concession_amount": 200,
"prerequisite_subtotal_range": 999,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": true,
"is_active": true,
"is_discoverable": true,
"tags": ["welcome"]
}
""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon"))
.header("Authorization", System.getenv("SHOPFLO_API_KEY"))
.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(`{
"code": "WELCOME10",
"title": "Welcome offer",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10,
"maximum_concession_amount": 200,
"prerequisite_subtotal_range": 999,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": true,
"is_active": true,
"is_discoverable": true,
"tags": ["welcome"]
}`)
req, err := http.NewRequest("POST", "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon", body)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", os.Getenv("SHOPFLO_API_KEY"))
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: " . getenv("SHOPFLO_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
'code' => 'WELCOME10',
'title' => 'Welcome offer',
'coupon_type' => 'AMOUNT',
'amount_type' => 'PERCENTAGE',
'concession_amount' => 10,
'maximum_concession_amount' => 200,
'prerequisite_subtotal_range' => 999,
'start_date' => 1767225600000,
'end_date' => 1769817600000,
'once_per_user' => true,
'is_active' => true,
'is_discoverable' => true,
'tags' => ['welcome']
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"message": "Coupon created successfully",
"data": {
"coupon_id": "c1f0a5e2-6a43-4a8c-bd1e-3d9d5f1a7b10",
"merchant_id": "your_merchant_id",
"code": "WELCOME10",
"title": "Welcome offer",
"description": "10% off your order",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10.0,
"maximum_concession_amount": 200.0,
"prerequisite_subtotal_range": 999.0,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": true,
"active": true,
"discoverable": true,
"auto_applicable": false,
"stackable": false,
"tags": ["welcome"],
"created_at": 1766000000000,
"updated_at": 1766000000000
}
}List coupons
/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon
Returns a page of your coupons.
Path parameters
- issuer_idstringRequired
Always
8d593cf0-99a5-4c0b-8988-0069fff0c197. - merchant_idstringRequired
Your own Shopflo merchant id. A different id returns 400. Ask [email protected] if you do not have it.
Query parameters
- offsetintegerOptional
Page number, starting at 1. Defaults to 1.
- limitintegerOptional
Page size, 1 to 50. Defaults to 10.
- coupon_codestringOptional
Matches coupon codes that contain this text, in any case.
- titlestringOptional
Matches titles that contain this text, in any case.
- statusstringOptional
ACTIVE,INACTIVEorSCHEDULED. - coupon_typestringOptional
One type, or several separated by commas.
- discoverablebooleanOptional
Only discoverable or only non-discoverable coupons.
- tagsstringOptional
Coupons with any of these tags, separated by commas. When you send
tags, onlytagsanddiscoverableare applied and the other filters are ignored.
Response fields in data
- coupon_idstringRequired
The coupon's id. Use it in the other endpoints.
- merchant_idstringRequired
Your merchant id.
- codestringRequired
The coupon code, in upper case.
- titlestringOptional
Title.
- descriptionstringOptional
Shopper-facing text.
- coupon_typestringRequired
The coupon type.
- amount_typestringOptional
FLATorPERCENTAGE. - concession_amountnumberOptional
The discount value.
- maximum_concession_amountnumberOptional
Upper limit on the discount.
- prerequisite_subtotal_rangenumberOptional
Minimum cart subtotal.
- start_dateintegerOptional
Start time in epoch milliseconds.
- end_dateintegerOptional
End time in epoch milliseconds.
- once_per_userbooleanRequired
Once per shopper.
- activebooleanRequired
Whether the coupon is active. This is
is_activein requests. - discoverablebooleanRequired
Whether the coupon is offered to shoppers. This is
is_discoverablein requests. - auto_applicablebooleanRequired
Applied automatically. This is
is_auto_applicablein requests. - stackablebooleanRequired
Combines with other discounts. This is
is_stackablein requests. - tagsarray of stringOptional
Labels.
- created_bystringOptional
Who created the coupon.
- created_atintegerOptional
Creation time in epoch milliseconds.
- updated_atintegerOptional
Last update time in epoch milliseconds.
data is an array of coupons with the fields below. Beside data, the response carries current_page, page_size, max_pages, total_count, and counts of coupons by state: active_count, scheduled_count, inactive_count, discoverable_count and non_discoverable_count.
Errors
| Status | Code | When |
|---|---|---|
400 | GE_001 | A query value is out of range, or merchant_id is not yours. |
401 | GE_003 | The Authorization header is missing or the key is not recognised. |
curl -sS "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon?limit=10&status=ACTIVE" \ -H "Authorization: sfat-your_key"
const res = await fetch("https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon?limit=10&status=ACTIVE", {
headers: {
Authorization: process.env.SHOPFLO_API_KEY,
},
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.get(
"https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon?limit=10&status=ACTIVE",
headers={
"Authorization": os.environ["SHOPFLO_API_KEY"],
},
)
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon?limit=10&status=ACTIVE"))
.header("Authorization", System.getenv("SHOPFLO_API_KEY"))
.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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon?limit=10&status=ACTIVE", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", os.Getenv("SHOPFLO_API_KEY"))
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon?limit=10&status=ACTIVE");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: " . getenv("SHOPFLO_API_KEY"),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"message": "Coupons fetched successfully",
"data": [
{
"coupon_id": "c1f0a5e2-6a43-4a8c-bd1e-3d9d5f1a7b10",
"merchant_id": "your_merchant_id",
"code": "WELCOME10",
"title": "Welcome offer",
"description": "10% off your order",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10.0,
"maximum_concession_amount": 200.0,
"prerequisite_subtotal_range": 999.0,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": true,
"active": true,
"discoverable": true,
"auto_applicable": false,
"stackable": false,
"tags": ["welcome"],
"created_at": 1766000000000,
"updated_at": 1766000000000
}
],
"current_page": 1,
"page_size": 10,
"max_pages": 1,
"total_count": 1,
"active_count": 1,
"scheduled_count": 0,
"inactive_count": 0,
"discoverable_count": 1,
"non_discoverable_count": 0
}Get a coupon
/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}
Returns one coupon.
Path parameters
- issuer_idstringRequired
Always
8d593cf0-99a5-4c0b-8988-0069fff0c197. - merchant_idstringRequired
Your own Shopflo merchant id. A different id returns 400. Ask [email protected] if you do not have it.
- coupon_idstringRequired
The
coupon_idreturned when the coupon was created.
Response fields in data
- coupon_idstringRequired
The coupon's id. Use it in the other endpoints.
- merchant_idstringRequired
Your merchant id.
- codestringRequired
The coupon code, in upper case.
- titlestringOptional
Title.
- descriptionstringOptional
Shopper-facing text.
- coupon_typestringRequired
The coupon type.
- amount_typestringOptional
FLATorPERCENTAGE. - concession_amountnumberOptional
The discount value.
- maximum_concession_amountnumberOptional
Upper limit on the discount.
- prerequisite_subtotal_rangenumberOptional
Minimum cart subtotal.
- start_dateintegerOptional
Start time in epoch milliseconds.
- end_dateintegerOptional
End time in epoch milliseconds.
- once_per_userbooleanRequired
Once per shopper.
- activebooleanRequired
Whether the coupon is active. This is
is_activein requests. - discoverablebooleanRequired
Whether the coupon is offered to shoppers. This is
is_discoverablein requests. - auto_applicablebooleanRequired
Applied automatically. This is
is_auto_applicablein requests. - stackablebooleanRequired
Combines with other discounts. This is
is_stackablein requests. - tagsarray of stringOptional
Labels.
- created_bystringOptional
Who created the coupon.
- created_atintegerOptional
Creation time in epoch milliseconds.
- updated_atintegerOptional
Last update time in epoch milliseconds.
Errors
| Status | Code | When |
|---|---|---|
400 | GE_001 | merchant_id in the path is not your merchant id. The message is Merchant Id in Header and in Path is not matching. |
401 | GE_003 | The Authorization header is missing or the key is not recognised. |
404 | GE_004 | No coupon with this coupon_id exists for your merchant. |
curl -sS "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id" \ -H "Authorization: sfat-your_key"
const res = await fetch("https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id", {
headers: {
Authorization: process.env.SHOPFLO_API_KEY,
},
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.get(
"https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id",
headers={
"Authorization": os.environ["SHOPFLO_API_KEY"],
},
)
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id"))
.header("Authorization", System.getenv("SHOPFLO_API_KEY"))
.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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", os.Getenv("SHOPFLO_API_KEY"))
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: " . getenv("SHOPFLO_API_KEY"),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"message": "Coupon fetched successfully",
"data": {
"coupon_id": "c1f0a5e2-6a43-4a8c-bd1e-3d9d5f1a7b10",
"merchant_id": "your_merchant_id",
"code": "WELCOME10",
"title": "Welcome offer",
"description": "10% off your order",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10.0,
"maximum_concession_amount": 200.0,
"prerequisite_subtotal_range": 999.0,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": true,
"active": true,
"discoverable": true,
"auto_applicable": false,
"stackable": false,
"tags": ["welcome"],
"created_at": 1766000000000,
"updated_at": 1766000000000
}
}Update a coupon
/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}
Changes a coupon. Fields you leave out keep their value, with one exception: the true or false flags (once_per_user, is_active, is_discoverable, is_auto_applicable, is_stackable) are always applied, and a flag you leave out is set to false. Send every flag you want to keep.
Path parameters
- issuer_idstringRequired
Always
8d593cf0-99a5-4c0b-8988-0069fff0c197. - merchant_idstringRequired
Your own Shopflo merchant id. A different id returns 400. Ask [email protected] if you do not have it.
- coupon_idstringRequired
The
coupon_idreturned when the coupon was created.
Request body
- codestringOptional
The code shoppers enter. No spaces. Stored in upper case, and must be unique for your store. If you leave it out, Shopflo generates a random one.
- titlestringOptional
Internal title.
- descriptionstringOptional
Text shown to shoppers. If you leave it out, Shopflo writes one from the coupon rules.
- coupon_typestringRequired
Use
AMOUNT. Other types exist and have extra rules that this reference does not cover. - amount_typestringOptional
FLATorPERCENTAGE. - concession_amountnumberOptional
The discount value, 0 or more. Its meaning follows
amount_type. - maximum_concession_amountnumberOptional
Upper limit on the discount. Not allowed when
amount_typeisFLAT. - prerequisite_subtotal_rangenumberOptional
Minimum cart subtotal for the coupon to apply.
- start_dateintegerOptional
Start time in epoch milliseconds.
- end_dateintegerOptional
End time in epoch milliseconds.
- once_per_userbooleanOptional
Defaults to false.
- is_activebooleanOptional
Defaults to false. A coupon that is not active cannot be used.
- is_discoverablebooleanOptional
Defaults to false. Discoverable coupons are offered to shoppers at checkout.
- is_auto_applicablebooleanOptional
Defaults to false. Applies the coupon automatically when it qualifies.
- is_stackablebooleanOptional
Defaults to false. Allows the coupon to combine with other discounts.
- tagsarray of stringOptional
Labels you can filter by.
Response fields in data
- coupon_idstringRequired
The coupon's id. Use it in the other endpoints.
- merchant_idstringRequired
Your merchant id.
- codestringRequired
The coupon code, in upper case.
- titlestringOptional
Title.
- descriptionstringOptional
Shopper-facing text.
- coupon_typestringRequired
The coupon type.
- amount_typestringOptional
FLATorPERCENTAGE. - concession_amountnumberOptional
The discount value.
- maximum_concession_amountnumberOptional
Upper limit on the discount.
- prerequisite_subtotal_rangenumberOptional
Minimum cart subtotal.
- start_dateintegerOptional
Start time in epoch milliseconds.
- end_dateintegerOptional
End time in epoch milliseconds.
- once_per_userbooleanRequired
Once per shopper.
- activebooleanRequired
Whether the coupon is active. This is
is_activein requests. - discoverablebooleanRequired
Whether the coupon is offered to shoppers. This is
is_discoverablein requests. - auto_applicablebooleanRequired
Applied automatically. This is
is_auto_applicablein requests. - stackablebooleanRequired
Combines with other discounts. This is
is_stackablein requests. - tagsarray of stringOptional
Labels.
- created_bystringOptional
Who created the coupon.
- created_atintegerOptional
Creation time in epoch milliseconds.
- updated_atintegerOptional
Last update time in epoch milliseconds.
coupon_type is checked on every update, so send it even when it does not change. Shopflo supports more fields for specific integrations. Contact [email protected] if you need one.
Errors
| Status | Code | When |
|---|---|---|
400 | GE_001 | A rule failed, for example Invalid Coupon Type, or the new code contains spaces or is already used by another coupon of yours. Also returned when merchant_id is not yours. |
401 | GE_003 | The Authorization header is missing or the key is not recognised. |
404 | GE_004 | No coupon with this coupon_id exists for your merchant. |
curl -sS -X PATCH "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id" \
-H "Authorization: sfat-your_key" \
-H "Content-Type: application/json" \
-d '{
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 15,
"is_active": true,
"is_discoverable": true
}'const res = await fetch("https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id", {
method: "PATCH",
headers: {
Authorization: process.env.SHOPFLO_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
coupon_type: "AMOUNT",
amount_type: "PERCENTAGE",
concession_amount: 15,
is_active: true,
is_discoverable: true
}),
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.patch(
"https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id",
headers={
"Authorization": os.environ["SHOPFLO_API_KEY"],
},
json={
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 15,
"is_active": True,
"is_discoverable": 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 = """
{
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 15,
"is_active": true,
"is_discoverable": true
}
""";
var request = HttpRequest.newBuilder()
.uri(URI.create("https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id"))
.header("Authorization", System.getenv("SHOPFLO_API_KEY"))
.header("Content-Type", "application/json")
.method("PATCH", 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(`{
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 15,
"is_active": true,
"is_discoverable": true
}`)
req, err := http.NewRequest("PATCH", "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id", body)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", os.Getenv("SHOPFLO_API_KEY"))
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: " . getenv("SHOPFLO_API_KEY"),
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
'coupon_type' => 'AMOUNT',
'amount_type' => 'PERCENTAGE',
'concession_amount' => 15,
'is_active' => true,
'is_discoverable' => true
]),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"message": "Coupon updated successfully",
"data": {
"coupon_id": "c1f0a5e2-6a43-4a8c-bd1e-3d9d5f1a7b10",
"merchant_id": "your_merchant_id",
"code": "WELCOME10",
"title": "Welcome offer",
"description": "10% off your order",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10.0,
"maximum_concession_amount": 200.0,
"prerequisite_subtotal_range": 999.0,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": true,
"active": true,
"discoverable": true,
"auto_applicable": false,
"stackable": false,
"tags": ["welcome"],
"created_at": 1766000000000,
"updated_at": 1766000000000
}
}Delete a coupon
/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}
Deletes a coupon and returns it as it was. This cannot be undone.
Path parameters
- issuer_idstringRequired
Always
8d593cf0-99a5-4c0b-8988-0069fff0c197. - merchant_idstringRequired
Your own Shopflo merchant id. A different id returns 400. Ask [email protected] if you do not have it.
- coupon_idstringRequired
The
coupon_idreturned when the coupon was created.
Response fields in data
- coupon_idstringRequired
The coupon's id. Use it in the other endpoints.
- merchant_idstringRequired
Your merchant id.
- codestringRequired
The coupon code, in upper case.
- titlestringOptional
Title.
- descriptionstringOptional
Shopper-facing text.
- coupon_typestringRequired
The coupon type.
- amount_typestringOptional
FLATorPERCENTAGE. - concession_amountnumberOptional
The discount value.
- maximum_concession_amountnumberOptional
Upper limit on the discount.
- prerequisite_subtotal_rangenumberOptional
Minimum cart subtotal.
- start_dateintegerOptional
Start time in epoch milliseconds.
- end_dateintegerOptional
End time in epoch milliseconds.
- once_per_userbooleanRequired
Once per shopper.
- activebooleanRequired
Whether the coupon is active. This is
is_activein requests. - discoverablebooleanRequired
Whether the coupon is offered to shoppers. This is
is_discoverablein requests. - auto_applicablebooleanRequired
Applied automatically. This is
is_auto_applicablein requests. - stackablebooleanRequired
Combines with other discounts. This is
is_stackablein requests. - tagsarray of stringOptional
Labels.
- created_bystringOptional
Who created the coupon.
- created_atintegerOptional
Creation time in epoch milliseconds.
- updated_atintegerOptional
Last update time in epoch milliseconds.
Errors
| Status | Code | When |
|---|---|---|
400 | GE_001 | merchant_id in the path is not your merchant id. The message is Merchant Id in Header and in Path is not matching. |
401 | GE_003 | The Authorization header is missing or the key is not recognised. |
404 | GE_004 | No coupon with this coupon_id exists for your merchant. |
curl -sS -X DELETE "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id" \ -H "Authorization: sfat-your_key"
const res = await fetch("https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id", {
method: "DELETE",
headers: {
Authorization: process.env.SHOPFLO_API_KEY,
},
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.delete(
"https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id",
headers={
"Authorization": os.environ["SHOPFLO_API_KEY"],
},
)
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id"))
.header("Authorization", System.getenv("SHOPFLO_API_KEY"))
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.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("DELETE", "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", os.Getenv("SHOPFLO_API_KEY"))
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: " . getenv("SHOPFLO_API_KEY"),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"message": "Coupon deleted successfully",
"data": {
"coupon_id": "c1f0a5e2-6a43-4a8c-bd1e-3d9d5f1a7b10",
"merchant_id": "your_merchant_id",
"code": "WELCOME10",
"title": "Welcome offer",
"description": "10% off your order",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10.0,
"maximum_concession_amount": 200.0,
"prerequisite_subtotal_range": 999.0,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": true,
"active": true,
"discoverable": true,
"auto_applicable": false,
"stackable": false,
"tags": ["welcome"],
"created_at": 1766000000000,
"updated_at": 1766000000000
}
}Coupon state
Turn a coupon on or off
/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}/toggle-status
Flips the coupon between active and inactive and returns it. Turning a coupon off also makes it not discoverable.
Path parameters
- issuer_idstringRequired
Always
8d593cf0-99a5-4c0b-8988-0069fff0c197. - merchant_idstringRequired
Your own Shopflo merchant id. A different id returns 400. Ask [email protected] if you do not have it.
- coupon_idstringRequired
The
coupon_idreturned when the coupon was created.
Response fields in data
- coupon_idstringRequired
The coupon's id. Use it in the other endpoints.
- merchant_idstringRequired
Your merchant id.
- codestringRequired
The coupon code, in upper case.
- titlestringOptional
Title.
- descriptionstringOptional
Shopper-facing text.
- coupon_typestringRequired
The coupon type.
- amount_typestringOptional
FLATorPERCENTAGE. - concession_amountnumberOptional
The discount value.
- maximum_concession_amountnumberOptional
Upper limit on the discount.
- prerequisite_subtotal_rangenumberOptional
Minimum cart subtotal.
- start_dateintegerOptional
Start time in epoch milliseconds.
- end_dateintegerOptional
End time in epoch milliseconds.
- once_per_userbooleanRequired
Once per shopper.
- activebooleanRequired
Whether the coupon is active. This is
is_activein requests. - discoverablebooleanRequired
Whether the coupon is offered to shoppers. This is
is_discoverablein requests. - auto_applicablebooleanRequired
Applied automatically. This is
is_auto_applicablein requests. - stackablebooleanRequired
Combines with other discounts. This is
is_stackablein requests. - tagsarray of stringOptional
Labels.
- created_bystringOptional
Who created the coupon.
- created_atintegerOptional
Creation time in epoch milliseconds.
- updated_atintegerOptional
Last update time in epoch milliseconds.
Errors
| Status | Code | When |
|---|---|---|
400 | DEE_011 | The coupon has already ended, so it cannot be changed here. |
400 | DEE_003 | Turning the coupon on would go over the limit on active discoverable coupons. |
400 | GE_001 | merchant_id in the path is not your merchant id. The message is Merchant Id in Header and in Path is not matching. |
401 | GE_003 | The Authorization header is missing or the key is not recognised. |
404 | GE_004 | No coupon with this coupon_id exists for your merchant. |
curl -sS -X PATCH "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-status" \ -H "Authorization: sfat-your_key"
const res = await fetch("https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-status", {
method: "PATCH",
headers: {
Authorization: process.env.SHOPFLO_API_KEY,
},
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.patch(
"https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-status",
headers={
"Authorization": os.environ["SHOPFLO_API_KEY"],
},
)
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-status"))
.header("Authorization", System.getenv("SHOPFLO_API_KEY"))
.method("PATCH", HttpRequest.BodyPublishers.noBody())
.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("PATCH", "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-status", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", os.Getenv("SHOPFLO_API_KEY"))
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-status");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: " . getenv("SHOPFLO_API_KEY"),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"message": "Coupon updated successfully",
"data": {
"coupon_id": "c1f0a5e2-6a43-4a8c-bd1e-3d9d5f1a7b10",
"merchant_id": "your_merchant_id",
"code": "WELCOME10",
"title": "Welcome offer",
"description": "10% off your order",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10.0,
"maximum_concession_amount": 200.0,
"prerequisite_subtotal_range": 999.0,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": true,
"active": true,
"discoverable": true,
"auto_applicable": false,
"stackable": false,
"tags": ["welcome"],
"created_at": 1766000000000,
"updated_at": 1766000000000
}
}Show or hide a coupon
/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}/toggle-discovery
Flips the coupon between discoverable and not discoverable and returns it. Only an active coupon inside its start and end dates can be made discoverable.
Path parameters
- issuer_idstringRequired
Always
8d593cf0-99a5-4c0b-8988-0069fff0c197. - merchant_idstringRequired
Your own Shopflo merchant id. A different id returns 400. Ask [email protected] if you do not have it.
- coupon_idstringRequired
The
coupon_idreturned when the coupon was created.
Response fields in data
- coupon_idstringRequired
The coupon's id. Use it in the other endpoints.
- merchant_idstringRequired
Your merchant id.
- codestringRequired
The coupon code, in upper case.
- titlestringOptional
Title.
- descriptionstringOptional
Shopper-facing text.
- coupon_typestringRequired
The coupon type.
- amount_typestringOptional
FLATorPERCENTAGE. - concession_amountnumberOptional
The discount value.
- maximum_concession_amountnumberOptional
Upper limit on the discount.
- prerequisite_subtotal_rangenumberOptional
Minimum cart subtotal.
- start_dateintegerOptional
Start time in epoch milliseconds.
- end_dateintegerOptional
End time in epoch milliseconds.
- once_per_userbooleanRequired
Once per shopper.
- activebooleanRequired
Whether the coupon is active. This is
is_activein requests. - discoverablebooleanRequired
Whether the coupon is offered to shoppers. This is
is_discoverablein requests. - auto_applicablebooleanRequired
Applied automatically. This is
is_auto_applicablein requests. - stackablebooleanRequired
Combines with other discounts. This is
is_stackablein requests. - tagsarray of stringOptional
Labels.
- created_bystringOptional
Who created the coupon.
- created_atintegerOptional
Creation time in epoch milliseconds.
- updated_atintegerOptional
Last update time in epoch milliseconds.
Errors
| Status | Code | When |
|---|---|---|
400 | DEE_004 | The coupon is not active, or it has not started yet or has already ended. |
400 | GE_001 | merchant_id in the path is not your merchant id. The message is Merchant Id in Header and in Path is not matching. |
401 | GE_003 | The Authorization header is missing or the key is not recognised. |
404 | GE_004 | No coupon with this coupon_id exists for your merchant. |
curl -sS -X PATCH "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-discovery" \ -H "Authorization: sfat-your_key"
const res = await fetch("https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-discovery", {
method: "PATCH",
headers: {
Authorization: process.env.SHOPFLO_API_KEY,
},
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.patch(
"https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-discovery",
headers={
"Authorization": os.environ["SHOPFLO_API_KEY"],
},
)
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-discovery"))
.header("Authorization", System.getenv("SHOPFLO_API_KEY"))
.method("PATCH", HttpRequest.BodyPublishers.noBody())
.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("PATCH", "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-discovery", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", os.Getenv("SHOPFLO_API_KEY"))
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/your_coupon_id/toggle-discovery");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: " . getenv("SHOPFLO_API_KEY"),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"message": "Toggling Coupon Discoverability",
"data": {
"coupon_id": "c1f0a5e2-6a43-4a8c-bd1e-3d9d5f1a7b10",
"merchant_id": "your_merchant_id",
"code": "WELCOME10",
"title": "Welcome offer",
"description": "10% off your order",
"coupon_type": "AMOUNT",
"amount_type": "PERCENTAGE",
"concession_amount": 10.0,
"maximum_concession_amount": 200.0,
"prerequisite_subtotal_range": 999.0,
"start_date": 1767225600000,
"end_date": 1769817600000,
"once_per_user": true,
"active": true,
"discoverable": true,
"auto_applicable": false,
"stackable": false,
"tags": ["welcome"],
"created_at": 1766000000000,
"updated_at": 1766000000000
}
}Usage
Get usage of a coupon code
/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/analytics/code
Returns a page of the orders that used a coupon code.
Path parameters
- issuer_idstringRequired
Always
8d593cf0-99a5-4c0b-8988-0069fff0c197. - merchant_idstringRequired
Your own Shopflo merchant id. A different id returns 400. Ask [email protected] if you do not have it.
Query parameters
- coupon_codestringRequired
The code to look up.
- offsetintegerRequired
Page number, starting at 1. Always send it.
- limitintegerOptional
Page size, 5 to 50. Defaults to 10.
Response fields in data
- discount_application_history_idstringRequired
The usage record.
- coupon_idstringRequired
The coupon.
- coupon_codestringRequired
The code that was used.
- order_idstringOptional
The order the coupon was used on.
- order_valuenumberOptional
The order value.
- discount_amountnumberOptional
The discount given.
- created_atintegerRequired
When the coupon was used, in epoch milliseconds.
Beside data, the response carries current_page, page_size, max_pages and total_count. Each record also holds details of the shopper who used the code. Shopflo supports more fields for specific integrations. Contact [email protected] if you need one.
Errors
| Status | Code | When |
|---|---|---|
400 | GE_001 | coupon_code is missing, limit is out of range, or merchant_id is not yours. |
401 | GE_003 | The Authorization header is missing or the key is not recognised. |
curl -sS "https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/analytics/code?coupon_code=WELCOME10&offset=1&limit=10" \ -H "Authorization: sfat-your_key"
const res = await fetch("https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/analytics/code?coupon_code=WELCOME10&offset=1&limit=10", {
headers: {
Authorization: process.env.SHOPFLO_API_KEY,
},
});
const body = await res.json();
console.log(body.data);import os
import requests
response = requests.get(
"https://api.shopflo.co/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/analytics/code?coupon_code=WELCOME10&offset=1&limit=10",
headers={
"Authorization": os.environ["SHOPFLO_API_KEY"],
},
)
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/analytics/code?coupon_code=WELCOME10&offset=1&limit=10"))
.header("Authorization", System.getenv("SHOPFLO_API_KEY"))
.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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/analytics/code?coupon_code=WELCOME10&offset=1&limit=10", nil)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", os.Getenv("SHOPFLO_API_KEY"))
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/de/api/v1/issuer/8d593cf0-99a5-4c0b-8988-0069fff0c197/merchant/your_merchant_id/coupon/analytics/code?coupon_code=WELCOME10&offset=1&limit=10");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: " . getenv("SHOPFLO_API_KEY"),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;{
"success": true,
"message": "Discount Application History By Code",
"data": [
{
"discount_application_history_id": "h_123",
"coupon_id": "c1f0a5e2-6a43-4a8c-bd1e-3d9d5f1a7b10",
"coupon_code": "WELCOME10",
"order_id": "order_456",
"order_value": 1499.0,
"discount_amount": 149.9,
"created_at": 1766100000000
}
],
"current_page": 1,
"page_size": 10,
"max_pages": 1,
"total_count": 1
}