ShopfloDevelopers

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.

Read how this authentication works

Endpoints

Coupons

POST

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.

Authentication: Merchant API key

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

    FLAT or PERCENTAGE.

  • 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_type is FLAT.

  • 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

    FLAT or PERCENTAGE.

  • 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_active in requests.

  • discoverablebooleanRequired

    Whether the coupon is offered to shoppers. This is is_discoverable in requests.

  • auto_applicablebooleanRequired

    Applied automatically. This is is_auto_applicable in requests.

  • stackablebooleanRequired

    Combines with other discounts. This is is_stackable in 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

StatusCodeWhen
400GE_001A 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.
400DEE_001A coupon with this code already exists for your store.
401GE_003The Authorization header is missing or the key is not recognised.
POST/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon
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"]
}'
Response200 OK
{
  "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
  }
}
GET

List coupons

/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon

Returns a page of your coupons.

Authentication: Merchant API key

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, INACTIVE or SCHEDULED.

  • 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, only tags and discoverable are 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

    FLAT or PERCENTAGE.

  • 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_active in requests.

  • discoverablebooleanRequired

    Whether the coupon is offered to shoppers. This is is_discoverable in requests.

  • auto_applicablebooleanRequired

    Applied automatically. This is is_auto_applicable in requests.

  • stackablebooleanRequired

    Combines with other discounts. This is is_stackable in 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

StatusCodeWhen
400GE_001A query value is out of range, or merchant_id is not yours.
401GE_003The Authorization header is missing or the key is not recognised.
GET/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon
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"
Response200 OK
{
  "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

Get a coupon

/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}

Returns one coupon.

Authentication: Merchant API key

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_id returned 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

    FLAT or PERCENTAGE.

  • 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_active in requests.

  • discoverablebooleanRequired

    Whether the coupon is offered to shoppers. This is is_discoverable in requests.

  • auto_applicablebooleanRequired

    Applied automatically. This is is_auto_applicable in requests.

  • stackablebooleanRequired

    Combines with other discounts. This is is_stackable in 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

StatusCodeWhen
400GE_001merchant_id in the path is not your merchant id. The message is Merchant Id in Header and in Path is not matching.
401GE_003The Authorization header is missing or the key is not recognised.
404GE_004No coupon with this coupon_id exists for your merchant.
GET/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}
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"
Response200 OK
{
  "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
  }
}
PATCH

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.

Authentication: Merchant API key

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_id returned 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

    FLAT or PERCENTAGE.

  • 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_type is FLAT.

  • 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

    FLAT or PERCENTAGE.

  • 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_active in requests.

  • discoverablebooleanRequired

    Whether the coupon is offered to shoppers. This is is_discoverable in requests.

  • auto_applicablebooleanRequired

    Applied automatically. This is is_auto_applicable in requests.

  • stackablebooleanRequired

    Combines with other discounts. This is is_stackable in 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

StatusCodeWhen
400GE_001A 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.
401GE_003The Authorization header is missing or the key is not recognised.
404GE_004No coupon with this coupon_id exists for your merchant.
PATCH/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}
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
}'
Response200 OK
{
  "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

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.

Authentication: Merchant API key

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_id returned 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

    FLAT or PERCENTAGE.

  • 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_active in requests.

  • discoverablebooleanRequired

    Whether the coupon is offered to shoppers. This is is_discoverable in requests.

  • auto_applicablebooleanRequired

    Applied automatically. This is is_auto_applicable in requests.

  • stackablebooleanRequired

    Combines with other discounts. This is is_stackable in 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

StatusCodeWhen
400GE_001merchant_id in the path is not your merchant id. The message is Merchant Id in Header and in Path is not matching.
401GE_003The Authorization header is missing or the key is not recognised.
404GE_004No coupon with this coupon_id exists for your merchant.
DELETE/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}
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"
Response200 OK
{
  "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

PATCH

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.

Authentication: Merchant API key

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_id returned 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

    FLAT or PERCENTAGE.

  • 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_active in requests.

  • discoverablebooleanRequired

    Whether the coupon is offered to shoppers. This is is_discoverable in requests.

  • auto_applicablebooleanRequired

    Applied automatically. This is is_auto_applicable in requests.

  • stackablebooleanRequired

    Combines with other discounts. This is is_stackable in 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

StatusCodeWhen
400DEE_011The coupon has already ended, so it cannot be changed here.
400DEE_003Turning the coupon on would go over the limit on active discoverable coupons.
400GE_001merchant_id in the path is not your merchant id. The message is Merchant Id in Header and in Path is not matching.
401GE_003The Authorization header is missing or the key is not recognised.
404GE_004No coupon with this coupon_id exists for your merchant.
PATCH/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}/toggle-status
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"
Response200 OK
{
  "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
  }
}
PATCH

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.

Authentication: Merchant API key

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_id returned 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

    FLAT or PERCENTAGE.

  • 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_active in requests.

  • discoverablebooleanRequired

    Whether the coupon is offered to shoppers. This is is_discoverable in requests.

  • auto_applicablebooleanRequired

    Applied automatically. This is is_auto_applicable in requests.

  • stackablebooleanRequired

    Combines with other discounts. This is is_stackable in 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

StatusCodeWhen
400DEE_004The coupon is not active, or it has not started yet or has already ended.
400GE_001merchant_id in the path is not your merchant id. The message is Merchant Id in Header and in Path is not matching.
401GE_003The Authorization header is missing or the key is not recognised.
404GE_004No coupon with this coupon_id exists for your merchant.
PATCH/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/{coupon_id}/toggle-discovery
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"
Response200 OK
{
  "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

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.

Authentication: Merchant API key

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

StatusCodeWhen
400GE_001coupon_code is missing, limit is out of range, or merchant_id is not yours.
401GE_003The Authorization header is missing or the key is not recognised.
GET/de/api/v1/issuer/{issuer_id}/merchant/{merchant_id}/coupon/analytics/code
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"
Response200 OK
{
  "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
}