Skip to Content
devhelp shopDocs

Admin — Customers & Discounts

Customer records, discount codes, and automatic sale campaigns.

Of Customer

GET
/admin/v1/customers/{id}/tags

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Response Body

OK

application/json
  1. response
tags*array<string>
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/customers/string/tags'
Example Response
{  "tags": [    "string"  ]}

Set For Customer

PUT
/admin/v1/customers/{id}/tags

Replace a customer's tags; new names create tags.

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Request Body

application/json
  1. body
tags*array<string>

Response Body

OK

application/json
  1. response
tags*array<string>
Example Request
curl -X PUT 'https://api.devhelp.pk/admin/v1/customers/string/tags' \  -H 'Content-Type: application/json' \  -d '{  "tags": [    "string"  ]}'
Example Response
{  "tags": [    "string"  ]}

List customers

GET
/admin/v1/customers

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Query Parameters

limit?number
Default24
cursor?string
q?string
segment?string
Value in"returning""ordered""not_ordered"

Response Body

OK

application/json
  1. response
items*array<>
nextCursor*string|null
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/customers'
Example Response
{  "items": [    {      "id": "string",      "email": "string",      "phone": "string",      "origin": "checkout",      "firstName": "string",      "lastName": "string",      "acceptsMarketing": true,      "note": "string",      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z",      "orderCount": 0,      "spentPaisa": 0,      "lastOrderAt": "2019-08-24T14:15:22Z",      "emailSubscription": "none"    }  ],  "nextCursor": "string"}
POST
/admin/v1/customers

Goes through the identity resolver, so submitting someone who already exists returns them rather than failing: email is matched first, then phone.

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Request Body

application/json
  1. body
phone?string
email?string
firstName?string
lastName?string
acceptsMarketing?boolean
Defaultfalse
note?string

Response Body

OK

application/json
  1. response
id*string
email*string|null
phone*string|null
origin*string
Value in"checkout""order""popup""newsletter""back_in_stock""contact""booking""enquiry""review""whatsapp""account""admin""pos""import"
firstName*string|null
lastName*string|null
acceptsMarketing*boolean
note*string|null
createdAt*string
Formatdate-time
updatedAt*string
Formatdate-time
Example Request
curl -X POST 'https://api.devhelp.pk/admin/v1/customers' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "string",  "email": "string",  "phone": "string",  "origin": "checkout",  "firstName": "string",  "lastName": "string",  "acceptsMarketing": true,  "note": "string",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}
GET
/admin/v1/customers/counts

Exact counts for the customer list: customers, returning customers (two or more placed orders, including cancellations), active newsletter subscribers and back-in-stock requests still waiting.

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Response Body

OK

application/json
  1. response
customers*number
returning*number
emailSubscribers*number
waitingForStock*number
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/customers/counts'
Example Response
{  "customers": 0,  "returning": 0,  "emailSubscribers": 0,  "waitingForStock": 0}

Get a customer

GET
/admin/v1/customers/{id}

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Response Body

OK

application/json
  1. response
id*string
email*string|null
phone*string|null
origin*string
Value in"checkout""order""popup""newsletter""back_in_stock""contact""booking""enquiry""review""whatsapp""account""admin""pos""import"
firstName*string|null
lastName*string|null
acceptsMarketing*boolean
note*string|null
createdAt*string
Formatdate-time
updatedAt*string
Formatdate-time
risk*
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/customers/string'
Example Response
{  "id": "string",  "email": "string",  "phone": "string",  "origin": "checkout",  "firstName": "string",  "lastName": "string",  "acceptsMarketing": true,  "note": "string",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z",  "risk": {    "orderCount": 0,    "deliveredCount": 0,    "rtoCount": 0,    "cancelledCount": 0,    "returnedCount": 0,    "rtoRate": 0  }}

Update a customer

PATCH
/admin/v1/customers/{id}

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Request Body

application/json
  1. body
email?string|null
phone?string|null
firstName?string|null
lastName?string|null
acceptsMarketing?boolean
note?string|null

Response Body

OK

application/json
  1. response
id*string
email*string|null
phone*string|null
origin*string
Value in"checkout""order""popup""newsletter""back_in_stock""contact""booking""enquiry""review""whatsapp""account""admin""pos""import"
firstName*string|null
lastName*string|null
acceptsMarketing*boolean
note*string|null
createdAt*string
Formatdate-time
updatedAt*string
Formatdate-time
Example Request
curl -X PATCH 'https://api.devhelp.pk/admin/v1/customers/string' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "string",  "email": "string",  "phone": "string",  "origin": "checkout",  "firstName": "string",  "lastName": "string",  "acceptsMarketing": true,  "note": "string",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}

Delete a customer

DELETE
/admin/v1/customers/{id}

Retires the customer and their addresses; nothing is removed.

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Response Body

OK

application/json
  1. response
id*string
deleted*unknown
Example Request
curl -X DELETE 'https://api.devhelp.pk/admin/v1/customers/string'
Example Response
{  "id": "string",  "deleted": true}
GET
/admin/v1/customers/{id}/journey

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Response Body

OK

application/json
  1. response
firstTouch*|null
events*array<>
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/customers/string/journey'
Example Response
{  "firstTouch": {    "landingPath": "string",    "referrerHost": "string",    "utmSource": "string",    "utmMedium": "string",    "utmCampaign": "string",    "at": "2019-08-24T14:15:22Z"  },  "events": [    {      "kind": "page_view",      "detail": "string",      "at": "2019-08-24T14:15:22Z"    }  ]}
GET
/admin/v1/customers/{customerId}/addresses

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

customerId*string

Query Parameters

limit?number
Default24
cursor?string

Response Body

OK

application/json
  1. response
items*array<>
nextCursor*string|null
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/customers/string/addresses'
Example Response
{  "items": [    {      "id": "string",      "line1": "string",      "line2": "string",      "city": "string",      "province": "string",      "postalCode": "string",      "landmark": "string",      "country": "AD",      "recipientName": "string",      "recipientPhone": "string",      "isDefault": true,      "createdAt": "2019-08-24T14:15:22Z"    }  ],  "nextCursor": "string"}

Add an address

POST
/admin/v1/customers/{customerId}/addresses

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

customerId*string

Request Body

application/json
  1. body
line1*string
line2?string|null
city*string
province?string
Default""
postalCode?string
Default""
landmark?string|null
country?string
Default"PK"
Value in"AD""AE""AF""AG""AI""AL""AM""AO""AQ""AR""AS""AT""AU""AW""AX""AZ""BA""BB""BD""BE""BF""BG""BH""BI""BJ""BL""BM""BN""BO""BQ""BR""BS""BT""BV""BW""BY""BZ""CA""CC""CD""CF""CG""CH""CI""CK""CL""CM""CN""CO""CR""CU""CV""CW""CX""CY""CZ""DE""DJ""DK""DM""DO""DZ""EC""EE""EG""EH""ER""ES""ET""FI""FJ""FK""FM""FO""FR""GA""GB""GD""GE""GF""GG""GH""GI""GL""GM""GN""GP""GQ""GR""GS""GT""GU""GW""GY""HK""HM""HN""HR""HT""HU""ID""IE""IL""IM""IN""IO""IQ""IR""IS""IT""JE""JM""JO""JP""KE""KG""KH""KI""KM""KN""KP""KR""KW""KY""KZ""LA""LB""LC""LI""LK""LR""LS""LT""LU""LV""LY""MA""MC""MD""ME""MF""MG""MH""MK""ML""MM""MN""MO""MP""MQ""MR""MS""MT""MU""MV""MW""MX""MY""MZ""NA""NC""NE""NF""NG""NI""NL""NO""NP""NR""NU""NZ""OM""PA""PE""PF""PG""PH""PK""PL""PM""PN""PR""PS""PT""PW""PY""QA""RE""RO""RS""RU""RW""SA""SB""SC""SD""SE""SG""SH""SI""SJ""SK""SL""SM""SN""SO""SR""SS""ST""SV""SX""SY""SZ""TC""TD""TF""TG""TH""TJ""TK""TL""TM""TN""TO""TR""TT""TV""TW""TZ""UA""UG""UM""US""UY""UZ""VA""VC""VE""VG""VI""VN""VU""WF""WS""YE""YT""ZA""ZM""ZW"
recipientName*string
recipientPhone*string
isDefault?boolean
Defaultfalse

Response Body

OK

application/json
  1. response
id*string
line1*string
line2*string|null
city*string
province*string
postalCode*string
landmark*string|null
country*string
Value in"AD""AE""AF""AG""AI""AL""AM""AO""AQ""AR""AS""AT""AU""AW""AX""AZ""BA""BB""BD""BE""BF""BG""BH""BI""BJ""BL""BM""BN""BO""BQ""BR""BS""BT""BV""BW""BY""BZ""CA""CC""CD""CF""CG""CH""CI""CK""CL""CM""CN""CO""CR""CU""CV""CW""CX""CY""CZ""DE""DJ""DK""DM""DO""DZ""EC""EE""EG""EH""ER""ES""ET""FI""FJ""FK""FM""FO""FR""GA""GB""GD""GE""GF""GG""GH""GI""GL""GM""GN""GP""GQ""GR""GS""GT""GU""GW""GY""HK""HM""HN""HR""HT""HU""ID""IE""IL""IM""IN""IO""IQ""IR""IS""IT""JE""JM""JO""JP""KE""KG""KH""KI""KM""KN""KP""KR""KW""KY""KZ""LA""LB""LC""LI""LK""LR""LS""LT""LU""LV""LY""MA""MC""MD""ME""MF""MG""MH""MK""ML""MM""MN""MO""MP""MQ""MR""MS""MT""MU""MV""MW""MX""MY""MZ""NA""NC""NE""NF""NG""NI""NL""NO""NP""NR""NU""NZ""OM""PA""PE""PF""PG""PH""PK""PL""PM""PN""PR""PS""PT""PW""PY""QA""RE""RO""RS""RU""RW""SA""SB""SC""SD""SE""SG""SH""SI""SJ""SK""SL""SM""SN""SO""SR""SS""ST""SV""SX""SY""SZ""TC""TD""TF""TG""TH""TJ""TK""TL""TM""TN""TO""TR""TT""TV""TW""TZ""UA""UG""UM""US""UY""UZ""VA""VC""VE""VG""VI""VN""VU""WF""WS""YE""YT""ZA""ZM""ZW"
recipientName*string
recipientPhone*string
isDefault*boolean
createdAt*string
Formatdate-time
Example Request
curl -X POST 'https://api.devhelp.pk/admin/v1/customers/string/addresses' \  -H 'Content-Type: application/json' \  -d '{  "line1": "string",  "city": "string",  "recipientName": "string",  "recipientPhone": "string"}'
Example Response
{  "id": "string",  "line1": "string",  "line2": "string",  "city": "string",  "province": "string",  "postalCode": "string",  "landmark": "string",  "country": "AD",  "recipientName": "string",  "recipientPhone": "string",  "isDefault": true,  "createdAt": "2019-08-24T14:15:22Z"}

Update an address

PATCH
/admin/v1/customers/{customerId}/addresses/{addressId}

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

customerId*string
addressId*string

Request Body

application/json
  1. body
line1?string
line2?string|null
city?string
province?string
postalCode?string
landmark?string|null
country?string
Value in"AD""AE""AF""AG""AI""AL""AM""AO""AQ""AR""AS""AT""AU""AW""AX""AZ""BA""BB""BD""BE""BF""BG""BH""BI""BJ""BL""BM""BN""BO""BQ""BR""BS""BT""BV""BW""BY""BZ""CA""CC""CD""CF""CG""CH""CI""CK""CL""CM""CN""CO""CR""CU""CV""CW""CX""CY""CZ""DE""DJ""DK""DM""DO""DZ""EC""EE""EG""EH""ER""ES""ET""FI""FJ""FK""FM""FO""FR""GA""GB""GD""GE""GF""GG""GH""GI""GL""GM""GN""GP""GQ""GR""GS""GT""GU""GW""GY""HK""HM""HN""HR""HT""HU""ID""IE""IL""IM""IN""IO""IQ""IR""IS""IT""JE""JM""JO""JP""KE""KG""KH""KI""KM""KN""KP""KR""KW""KY""KZ""LA""LB""LC""LI""LK""LR""LS""LT""LU""LV""LY""MA""MC""MD""ME""MF""MG""MH""MK""ML""MM""MN""MO""MP""MQ""MR""MS""MT""MU""MV""MW""MX""MY""MZ""NA""NC""NE""NF""NG""NI""NL""NO""NP""NR""NU""NZ""OM""PA""PE""PF""PG""PH""PK""PL""PM""PN""PR""PS""PT""PW""PY""QA""RE""RO""RS""RU""RW""SA""SB""SC""SD""SE""SG""SH""SI""SJ""SK""SL""SM""SN""SO""SR""SS""ST""SV""SX""SY""SZ""TC""TD""TF""TG""TH""TJ""TK""TL""TM""TN""TO""TR""TT""TV""TW""TZ""UA""UG""UM""US""UY""UZ""VA""VC""VE""VG""VI""VN""VU""WF""WS""YE""YT""ZA""ZM""ZW"
recipientName?string
recipientPhone?string
isDefault?boolean

Response Body

OK

application/json
  1. response
id*string
line1*string
line2*string|null
city*string
province*string
postalCode*string
landmark*string|null
country*string
Value in"AD""AE""AF""AG""AI""AL""AM""AO""AQ""AR""AS""AT""AU""AW""AX""AZ""BA""BB""BD""BE""BF""BG""BH""BI""BJ""BL""BM""BN""BO""BQ""BR""BS""BT""BV""BW""BY""BZ""CA""CC""CD""CF""CG""CH""CI""CK""CL""CM""CN""CO""CR""CU""CV""CW""CX""CY""CZ""DE""DJ""DK""DM""DO""DZ""EC""EE""EG""EH""ER""ES""ET""FI""FJ""FK""FM""FO""FR""GA""GB""GD""GE""GF""GG""GH""GI""GL""GM""GN""GP""GQ""GR""GS""GT""GU""GW""GY""HK""HM""HN""HR""HT""HU""ID""IE""IL""IM""IN""IO""IQ""IR""IS""IT""JE""JM""JO""JP""KE""KG""KH""KI""KM""KN""KP""KR""KW""KY""KZ""LA""LB""LC""LI""LK""LR""LS""LT""LU""LV""LY""MA""MC""MD""ME""MF""MG""MH""MK""ML""MM""MN""MO""MP""MQ""MR""MS""MT""MU""MV""MW""MX""MY""MZ""NA""NC""NE""NF""NG""NI""NL""NO""NP""NR""NU""NZ""OM""PA""PE""PF""PG""PH""PK""PL""PM""PN""PR""PS""PT""PW""PY""QA""RE""RO""RS""RU""RW""SA""SB""SC""SD""SE""SG""SH""SI""SJ""SK""SL""SM""SN""SO""SR""SS""ST""SV""SX""SY""SZ""TC""TD""TF""TG""TH""TJ""TK""TL""TM""TN""TO""TR""TT""TV""TW""TZ""UA""UG""UM""US""UY""UZ""VA""VC""VE""VG""VI""VN""VU""WF""WS""YE""YT""ZA""ZM""ZW"
recipientName*string
recipientPhone*string
isDefault*boolean
createdAt*string
Formatdate-time
Example Request
curl -X PATCH 'https://api.devhelp.pk/admin/v1/customers/string/addresses/string' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "string",  "line1": "string",  "line2": "string",  "city": "string",  "province": "string",  "postalCode": "string",  "landmark": "string",  "country": "AD",  "recipientName": "string",  "recipientPhone": "string",  "isDefault": true,  "createdAt": "2019-08-24T14:15:22Z"}

Delete an address

DELETE
/admin/v1/customers/{customerId}/addresses/{addressId}

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

customerId*string
addressId*string

Response Body

OK

application/json
  1. response
id*string
deleted*unknown
Example Request
curl -X DELETE 'https://api.devhelp.pk/admin/v1/customers/string/addresses/string'
Example Response
{  "id": "string",  "deleted": true}
GET
/admin/v1/discounts

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Query Parameters

limit?number
Default24
cursor?string
q?string
state?string
Value in"active""scheduled""expired""disabled"
method?string
Value in"code""automatic""sale"
type?string
Value in"product""order""shipping"

Response Body

OK

application/json
  1. response
items*array<>
nextCursor*string|null
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/discounts'
Example Response
{  "items": [    {      "id": "string",      "title": "string",      "method": "code",      "code": "string",      "type": "product",      "valueType": "percentage",      "percentageBps": 0,      "amountPaisa": 0,      "fixedApplies": "once_per_order",      "maxDiscountPaisa": 0,      "appliesTo": "all",      "productIds": [        "string"      ],      "collectionIds": [        "string"      ],      "minRequirement": "none",      "minSubtotalPaisa": 0,      "minQuantity": 0,      "customerEligibility": "all",      "customerIds": [        "string"      ],      "shippingZoneIds": [        "string"      ],      "maxShippingRatePaisa": 0,      "usageLimit": 0,      "oncePerCustomer": true,      "combinesWith": {        "product": true,        "order": true,        "shipping": true      },      "startsAt": "2019-08-24T14:15:22Z",      "endsAt": "2019-08-24T14:15:22Z",      "excludedProductIds": [        "string"      ],      "excludedCollectionIds": [        "string"      ],      "includeMarkedDown": true,      "status": "active",      "state": "active",      "usageCount": 0,      "createdAt": "2019-08-24T14:15:22Z",      "updatedAt": "2019-08-24T14:15:22Z"    }  ],  "nextCursor": "string"}

Create a discount

POST
/admin/v1/discounts

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Request Body

application/json
  1. body
title*string
method*string
Value in"code""automatic""sale"
code?|
Defaultnull
type*string
Value in"product""order""shipping"
valueType*string
Value in"percentage""fixed_amount""free"
percentageBps?|
Defaultnull
amountPaisa?|
Defaultnull
fixedApplies?|
Defaultnull
maxDiscountPaisa?|
Defaultnull
appliesTo?string
Default"all"
Value in"all""products""collections"
productIds?array<string>
Default[]
collectionIds?array<string>
Default[]
minRequirement?string
Default"none"
Value in"none""subtotal""quantity"
minSubtotalPaisa?|
Defaultnull
minQuantity?|
Defaultnull
customerEligibility?string
Default"all"
Value in"all""specific"
customerIds?array<string>
Default[]
shippingZoneIds?array<string>
Default[]
maxShippingRatePaisa?|
Defaultnull
usageLimit?|
Defaultnull
oncePerCustomer?boolean
Defaultfalse
combinesWith?
Default
{  "product": false,  "order": false,  "shipping": false}
startsAt?string
Formatdate-time
endsAt?|
Defaultnull
excludedProductIds?array<string>
Default[]
excludedCollectionIds?array<string>
Default[]
includeMarkedDown?boolean
Defaultfalse
status?string
Default"active"
Value in"active""disabled"

Response Body

OK

application/json
  1. response
id*string
title*string
method*string
Value in"code""automatic""sale"
code*string|null
type*string
Value in"product""order""shipping"
valueType*string
Value in"percentage""fixed_amount""free"
percentageBps*number|null
amountPaisa*number|null
fixedApplies*|null
maxDiscountPaisa*number|null
appliesTo*string
Value in"all""products""collections"
productIds*array<string>
collectionIds*array<string>
minRequirement*string
Value in"none""subtotal""quantity"
minSubtotalPaisa*number|null
minQuantity*number|null
customerEligibility*string
Value in"all""specific"
customerIds*array<string>
shippingZoneIds*array<string>
maxShippingRatePaisa*number|null
usageLimit*number|null
oncePerCustomer*boolean
combinesWith*
startsAt*string
Formatdate-time
endsAt*|null
excludedProductIds*array<string>
excludedCollectionIds*array<string>
includeMarkedDown*boolean
status*string
Value in"active""disabled""deleted"
state*string
Value in"active""scheduled""expired""disabled"
usageCount*number
createdAt*string
Formatdate-time
updatedAt*string
Formatdate-time
Example Request
curl -X POST 'https://api.devhelp.pk/admin/v1/discounts' \  -H 'Content-Type: application/json' \  -d '{  "title": "string",  "method": "code",  "type": "product",  "valueType": "percentage"}'
Example Response
{  "id": "string",  "title": "string",  "method": "code",  "code": "string",  "type": "product",  "valueType": "percentage",  "percentageBps": 0,  "amountPaisa": 0,  "fixedApplies": "once_per_order",  "maxDiscountPaisa": 0,  "appliesTo": "all",  "productIds": [    "string"  ],  "collectionIds": [    "string"  ],  "minRequirement": "none",  "minSubtotalPaisa": 0,  "minQuantity": 0,  "customerEligibility": "all",  "customerIds": [    "string"  ],  "shippingZoneIds": [    "string"  ],  "maxShippingRatePaisa": 0,  "usageLimit": 0,  "oncePerCustomer": true,  "combinesWith": {    "product": true,    "order": true,    "shipping": true  },  "startsAt": "2019-08-24T14:15:22Z",  "endsAt": "2019-08-24T14:15:22Z",  "excludedProductIds": [    "string"  ],  "excludedCollectionIds": [    "string"  ],  "includeMarkedDown": true,  "status": "active",  "state": "active",  "usageCount": 0,  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}

Count discounts by state

GET
/admin/v1/discounts/counts

Exact counts for the discount list's views: every discount that is not deleted, and how many are active, scheduled, expired or disabled right now.

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Response Body

OK

application/json
  1. response
all*number
active*number
scheduled*number
expired*number
disabled*number
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/discounts/counts'
Example Response
{  "all": 0,  "active": 0,  "scheduled": 0,  "expired": 0,  "disabled": 0}

Get a discount

GET
/admin/v1/discounts/{id}

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Response Body

OK

application/json
  1. response
id*string
title*string
method*string
Value in"code""automatic""sale"
code*string|null
type*string
Value in"product""order""shipping"
valueType*string
Value in"percentage""fixed_amount""free"
percentageBps*number|null
amountPaisa*number|null
fixedApplies*|null
maxDiscountPaisa*number|null
appliesTo*string
Value in"all""products""collections"
productIds*array<string>
collectionIds*array<string>
minRequirement*string
Value in"none""subtotal""quantity"
minSubtotalPaisa*number|null
minQuantity*number|null
customerEligibility*string
Value in"all""specific"
customerIds*array<string>
shippingZoneIds*array<string>
maxShippingRatePaisa*number|null
usageLimit*number|null
oncePerCustomer*boolean
combinesWith*
startsAt*string
Formatdate-time
endsAt*|null
excludedProductIds*array<string>
excludedCollectionIds*array<string>
includeMarkedDown*boolean
status*string
Value in"active""disabled""deleted"
state*string
Value in"active""scheduled""expired""disabled"
usageCount*number
createdAt*string
Formatdate-time
updatedAt*string
Formatdate-time
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/discounts/string'
Example Response
{  "id": "string",  "title": "string",  "method": "code",  "code": "string",  "type": "product",  "valueType": "percentage",  "percentageBps": 0,  "amountPaisa": 0,  "fixedApplies": "once_per_order",  "maxDiscountPaisa": 0,  "appliesTo": "all",  "productIds": [    "string"  ],  "collectionIds": [    "string"  ],  "minRequirement": "none",  "minSubtotalPaisa": 0,  "minQuantity": 0,  "customerEligibility": "all",  "customerIds": [    "string"  ],  "shippingZoneIds": [    "string"  ],  "maxShippingRatePaisa": 0,  "usageLimit": 0,  "oncePerCustomer": true,  "combinesWith": {    "product": true,    "order": true,    "shipping": true  },  "startsAt": "2019-08-24T14:15:22Z",  "endsAt": "2019-08-24T14:15:22Z",  "excludedProductIds": [    "string"  ],  "excludedCollectionIds": [    "string"  ],  "includeMarkedDown": true,  "status": "active",  "state": "active",  "usageCount": 0,  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}

Update a discount

PATCH
/admin/v1/discounts/{id}

Any subset of settings; the merged result must still be a coherent discount. Product, collection and customer lists are replaced when given.

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Request Body

application/json
  1. body
title?string
method?string
Value in"code""automatic""sale"
code?string|null
type?string
Value in"product""order""shipping"
valueType?string
Value in"percentage""fixed_amount""free"
percentageBps?number|null
amountPaisa?number|null
fixedApplies?|null
maxDiscountPaisa?number|null
appliesTo?string
Value in"all""products""collections"
productIds?array<string>
collectionIds?array<string>
minRequirement?string
Value in"none""subtotal""quantity"
minSubtotalPaisa?number|null
minQuantity?number|null
customerEligibility?string
Value in"all""specific"
customerIds?array<string>
shippingZoneIds?array<string>
maxShippingRatePaisa?number|null
usageLimit?number|null
oncePerCustomer?boolean
combinesWith?
startsAt?string
Formatdate-time
endsAt?|null
excludedProductIds?array<string>
excludedCollectionIds?array<string>
includeMarkedDown?boolean
status?string
Value in"active""disabled"

Response Body

OK

application/json
  1. response
id*string
title*string
method*string
Value in"code""automatic""sale"
code*string|null
type*string
Value in"product""order""shipping"
valueType*string
Value in"percentage""fixed_amount""free"
percentageBps*number|null
amountPaisa*number|null
fixedApplies*|null
maxDiscountPaisa*number|null
appliesTo*string
Value in"all""products""collections"
productIds*array<string>
collectionIds*array<string>
minRequirement*string
Value in"none""subtotal""quantity"
minSubtotalPaisa*number|null
minQuantity*number|null
customerEligibility*string
Value in"all""specific"
customerIds*array<string>
shippingZoneIds*array<string>
maxShippingRatePaisa*number|null
usageLimit*number|null
oncePerCustomer*boolean
combinesWith*
startsAt*string
Formatdate-time
endsAt*|null
excludedProductIds*array<string>
excludedCollectionIds*array<string>
includeMarkedDown*boolean
status*string
Value in"active""disabled""deleted"
state*string
Value in"active""scheduled""expired""disabled"
usageCount*number
createdAt*string
Formatdate-time
updatedAt*string
Formatdate-time
Example Request
curl -X PATCH 'https://api.devhelp.pk/admin/v1/discounts/string' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "string",  "title": "string",  "method": "code",  "code": "string",  "type": "product",  "valueType": "percentage",  "percentageBps": 0,  "amountPaisa": 0,  "fixedApplies": "once_per_order",  "maxDiscountPaisa": 0,  "appliesTo": "all",  "productIds": [    "string"  ],  "collectionIds": [    "string"  ],  "minRequirement": "none",  "minSubtotalPaisa": 0,  "minQuantity": 0,  "customerEligibility": "all",  "customerIds": [    "string"  ],  "shippingZoneIds": [    "string"  ],  "maxShippingRatePaisa": 0,  "usageLimit": 0,  "oncePerCustomer": true,  "combinesWith": {    "product": true,    "order": true,    "shipping": true  },  "startsAt": "2019-08-24T14:15:22Z",  "endsAt": "2019-08-24T14:15:22Z",  "excludedProductIds": [    "string"  ],  "excludedCollectionIds": [    "string"  ],  "includeMarkedDown": true,  "status": "active",  "state": "active",  "usageCount": 0,  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}

Delete a discount

DELETE
/admin/v1/discounts/{id}

Soft: orders that used it keep their record of what it took off.

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Response Body

OK

application/json
  1. response
id*string
deleted*unknown
Example Request
curl -X DELETE 'https://api.devhelp.pk/admin/v1/discounts/string'
Example Response
{  "id": "string",  "deleted": true}
GET
/admin/v1/discounts/{id}/usages

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Query Parameters

limit?number
Default24
cursor?string

Response Body

OK

application/json
  1. response
items*array<>
nextCursor*string|null
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/discounts/string/usages'
Example Response
{  "items": [    {      "orderId": "string",      "orderNumber": 0,      "customerId": "string",      "phone": "string",      "status": "active",      "createdAt": "2019-08-24T14:15:22Z"    }  ],  "nextCursor": "string"}

Preview a sale

POST
/admin/v1/discounts/sale-preview

What a sale with these settings would price now: products and variants, sample prices, variants it skips and why, overlapping sales and discounts that will not reduce sale items. Nothing is saved.

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Request Body

application/json
  1. body
id?string
percentageBps*number
appliesTo*string
Value in"all""products""collections"
productIds?array<string>
Default[]
collectionIds?array<string>
Default[]
excludedProductIds?array<string>
Default[]
excludedCollectionIds?array<string>
Default[]
includeMarkedDown?boolean
Defaultfalse
combinesWith?
Default
{  "product": false,  "order": false,  "shipping": true}
startsAt?string
Formatdate-time
endsAt?|
Defaultnull

Response Body

OK

application/json
  1. response
products*number
variants*number
skippedMarkedDown*number
skippedExcluded*number
skippedOtherSale*number
samples*array<>
overlaps*array<>
conflicts*array<>
Example Request
curl -X POST 'https://api.devhelp.pk/admin/v1/discounts/sale-preview' \  -H 'Content-Type: application/json' \  -d '{  "percentageBps": 0,  "appliesTo": "all"}'
Example Response
{  "products": 0,  "variants": 0,  "skippedMarkedDown": 0,  "skippedExcluded": 0,  "skippedOtherSale": 0,  "samples": [    {      "productId": "string",      "productTitle": "string",      "variantTitle": "string",      "pricePaisa": 0,      "salePricePaisa": 0,      "compareAtPricePaisa": 0    }  ],  "overlaps": [    {      "discountId": "string",      "title": "string",      "percentageBps": 0,      "state": "active",      "wins": 0,      "loses": 0    }  ],  "conflicts": [    {      "discountId": "string",      "title": "string",      "code": "string",      "type": "product",      "effect": "items"    }  ]}
GET
/admin/v1/discounts/{id}/stats

How many orders used the discount, those orders' totals and what the discount took off them. Cancelled and test orders are left out.

Authorization

secretKey
headerx-api-key<token>

Admin secret API key (dh_sk_live_…). Keep server-side only; never expose in browser code. Also accepted as Authorization: Bearer.

Path Parameters

id*string

Response Body

OK

application/json
  1. response
orders*number
sales*
discountGiven*
Example Request
curl -X GET 'https://api.devhelp.pk/admin/v1/discounts/string/stats'
Example Response
{  "orders": 0,  "sales": {    "amount": 0,    "currency": "PKR"  },  "discountGiven": {    "amount": 0,    "currency": "PKR"  }}

On this page