Merchant API: keys & endpoints
This article's section starts at 1:39 in the video.
The Merchant API lets your own backend read your cashback configuration, trigger rewards (birthdays collected in your mobile app, social follows verified by your own system, fully custom rewards), and move credit directly with no program behind it. This article covers key management, authentication, and all seven endpoints.
Prerequisites
A DollarBack plan that includes API access. On other plans, Developer API shows "Developer API is available on a higher plan" with an Upgrade plan button, and you can't generate or rotate a key. See Plans, usage & overage billing.
A server-side environment to call the API from. The key must never ship in client or browser code.
For the birthday, social, and custom endpoints: a matching cashback config of that type, enabled (see Custom rewards via API).
The credit and debit endpoints need no config: they move credit directly.
Manage your API key
The key lives on the REST API page, two steps in:
Open DollarBack admin β Settings β Developer API and click Manage.
You land on Developer API, a hub with two cards: REST API β everything in this article β and Storefront API, which needs no key (Storefront window API). Open REST API.
Click Generate API key. The key appears straight away, masked: use the eye button to Show key / Hide key, and Copy to put it on your clipboard.

Once a key exists, that page leads with it, then documents Authentication and Endpoints below. Two fields sit alongside the key:
Created
When the current key was issued. Rotating resets it.
Last used
When a request last authenticated with it. Never means no call has ever got through β the quickest way to tell a silent integration from a working one.

Rotating a key
Rotate issues a new key and invalidates the old one the moment you click it. There is no confirmation dialog and no overlap window where both keys work, so any server still sending the old key starts getting 401 unauthorized immediately. Have the new value ready to deploy before you rotate, not after.
Authentication
Every request needs two headers:
A missing or wrong key returns 401 {"error": "unauthorized"}. Unexpected server errors return 500 {"error": "internal"}.

GET /api/v1/merchant/config
Returns your enabled cashback configurations and tier setup. Use it to discover config IDs for the POST endpoints and to render program details in your own UI. The DollarBack admin doesn't display config IDs, so this endpoint is where you find them.
Success (200):
Only enabled programs are listed. Each entry in configurations is the program's saved settings. The fields you'll use most:
id
The config ID to send as configId on the POST endpoints.
configType
purchase, birthday, social, custom, and so on.
title
The program name.
enabled
Always true here.
cashbackType, cashbackValue
percentage, fixed or orderGoal, and the amount.
rewardKind
store_credit or discount_code.
expiresAfter
Days until issued credit expires.
startDate, endDate
The program's dates, when set.
birthdayTrigger, birthdayLimit, birthdayCooldownDays
Birthday programs only.
socialLabel, socialUrl
Social programs only.
Each entry in tiers.tiers has id, name, isEnabled, priority, configIds (the programs linked to that tier) and multiplier.
The response is cached for about a minute, so a program you have just enabled or edited can take up to a minute to appear.
The endpoint URLs (with your app host filled in) are listed with Copy buttons in the Endpoints section of the REST API page.
POST /api/v1/merchant/birthday
Submits a customer's birthday and schedules the birthday credit, the API equivalent of the widget's birthday form.
customerId
string or number
The Shopify customer ID.
birthday
object
{ "day": 14, "month": 3, "year": 1992 }
configId
string
The birthday config's ID (from GET /config).
currency
string
Required. Currency to credit in, e.g. "USD".
Success (200):
Errors: 400 {"error": "missing_fields: ..."} (including a missing currency), {"error": "invalid_json"} or {"error": "invalid_birthday"}, 404 {"error": "Birthday config not found"}.
The birthday endpoint only schedules the gift: the credit itself lands on nextCreditDate.
POST /api/v1/merchant/social
Claims a social-follow reward for a customer. Use it when your own system verifies the follow.
customerId
string or number
The Shopify customer ID.
socialUrl
string
The social link the customer followed.
configId
string
The social config's ID.
currency
string
Required. Currency to credit in, e.g. "USD".
The response waits for the outcome, so a 200 means the reward has landed. For a store credit reward:
A program that pays a discount code answers {"success": true, "rewardKind": "discount_code", "code": "...", "creditAmount": ..., "currency": "USD"}. Each customer is rewarded once per social URL: a repeat claim for the same socialUrl answers duplicate: true and moves nothing.
If a discount-code program issues no code, the claim is skipped and the URL stays claimable: {"success": true, "skipped": true, "reason": "issuance_cap_reached"} when the customer already holds as many codes from that program as it allows, or "reason": "rule_unavailable" when the reward-marketplace rule behind it is off, deleted, or not available for cashback.
Errors: 400 {"error": "missing_fields: ..."} (including a missing currency) or {"error": "invalid_json"}, 400 {"error": "invalid_config", "reason": "no_matching_config"} when the config ID doesn't match an enabled social program, 400 {"error": "operation_failed", "message": "..."} when Shopify refuses the credit, 502 {"error": "...", "message": "..."} when the reward run ends in a failure that isn't one of the above, and 503 {"error": "unavailable", "runId": "..."} (see below).
POST /api/v1/merchant/custom
Dispatches a custom (API-only) reward, the endpoint behind Custom rewards via API. Credit any behavior you can detect: reviews, referral milestones, offline events.
configId
string
Must be a custom-type config that is enabled.
customerId
string or number
The Shopify customer ID.
currency
string
Required. Currency to credit in, e.g. "USD".
idempotencyKey
string
Optional. A retry with the same key joins the first grant instead of granting twice.
The response waits for the outcome. For a store credit reward:
A discount-code program answers {"success": true, "requestId": "...", "rewardKind": "discount_code", "code": "..."}. If the customer has reached the program's per-customer limit, nothing moves and you get {"success": true, "requestId": "...", "skipped": true, "reason": "frequency_limit", "count": 3, "limit": 3}. A discount-code program that issues no code answers {"success": true, "requestId": "...", "skipped": true, "reason": "issuance_cap_reached" | "rule_unavailable"}, with the same meanings as on /social. Full example and walkthrough: Custom rewards via API.
Errors: 400 {"error": "missing_fields: ..."} (including a missing currency), {"error": "invalid_json"}, {"error": "invalid_config", "reason": "not_found" | "not_custom" | "disabled" | "not_scheduled"}, {"error": "operation_failed", "message": "..."} when Shopify refuses the credit, 502 {"error": "...", "message": "..."} when the reward run ends in any other failure, and 503 {"error": "unavailable", "runId": "..."} (see below). The invalid_config reason tells you whether the config ID is wrong, isn't a custom config, is turned off, or is outside its start and end dates.
POST /api/v1/merchant/credit
Credits a customer directly, with no cashback program involved. Use it for goodwill gestures, support resolutions, or any credit your own system decides on. Like /social and /custom, it is synchronous: the response tells you whether the money actually moved, and hands back the transaction ID and the new balance.
customerId
string or number
Yes
The numeric Shopify customer ID.
amount
number
Yes
Greater than 0, expressed in currency. Anything above 1,000,000 is rejected.
currency
string
Yes
The currency amount is in, e.g. "USD". Converted to your shop currency for the credit log.
reason
string
No
Shown in the credit log and in the customer's email.
expiryInDays
number
No
Whole days until the credit expires. Default 0 β the credit never expires.
expiresAt
string
No
An exact expiry instead of expiryInDays, in ISO 8601: "2027-02-28" (the end of that day), "2027-02-28T18:00" (that time in your store's time zone) or "2027-02-28T18:00:00Z" (that exact moment). It must be at least an hour in the future. Send either expiryInDays or expiresAt, not both; otherwise the call returns 400 with invalid_expiry.
notify
boolean
No
Default true β send the customer the Store Credit Credited email (Store Credit Debited on /debit), if that template is enabled.
sendToIntegrations
boolean
No
Default true β forward the event to Klaviyo, Omnisend, Mailchimp, and Flow.
idempotencyKey
string
No
A retry with the same key never moves money twice.
Success (200):
Errors: 400 {"error": "missing_fields: ..."}, {"error": "invalid_amount: ..."}, {"error": "invalid_expiry", "message": "..."}, {"error": "invalid_json"}, or {"error": "operation_failed", "message": "..."} when Shopify itself refuses the movement, and 503 {"error": "unavailable", "message": "...", "runId": "..."} when the request didn't finish in time (see the hint above).
POST /api/v1/merchant/debit
Removes store credit from a customer. Body, headers, and response are identical to /credit, except expiryInDays and expiresAt are ignored.
Success (200):
Debiting more than the customer holds fails rather than pushing the balance negative: you get 400 {"error": "operation_failed", "message": "..."} carrying Shopify's own message, and nothing moves. If you need to take "up to" whatever someone has, read GET /balance first and debit what it reports.
GET /api/v1/merchant/balance
Reads a customer's current store credit. Use it before a debit, to show a balance in your own app or portal, or to reconcile against your records.
Shopify keeps one store credit account per currency, so a customer who has earned in more than one currency has more than one balance. The endpoint returns all of them and is never cached.
customerId
Yes
The numeric Shopify customer ID. A gid:// prefix is rejected.
currency
No
Narrow the response to a single account, e.g. USD. Case-insensitive.
Success (200):
A customer who holds no store credit returns "balances": [] with a 200, not an error. Treat an empty array as a zero balance.
Errors: 400 {"error": "missing_fields: customerId is required"}, 400 {"error": "invalid_customer_id"} when the ID isn't numeric, and 404 {"error": "customer_not_found"} when no such customer exists in your store.
Verify it works
Call GET /config or GET /balance first: a 200 confirms your key and headers, and neither one writes anything. Then fire one POST for a test customer and check DollarBack admin β Analytics β Activity for the credit. /social, /custom, /credit and /debit are synchronous: a 200 with duplicate: false means the reward has already landed, and the response shows it. /birthday only schedules the gift for the customer's next birthday date.
Common issues
401 unauthorized: wrong or rotated key, or a missingX-DollarBack-Shopheader.400 missing_fields: currency is required: the birthday, social, and custom endpoints needcurrency. Older examples usedcustomerCurrency, which is not read.invalid_configon/custom: the config ID isn't a custom config, or the config is disabled or outside its dates.skipped: truewithreason: "frequency_limit"on/custom: the customer has reached the program's limit. Nothing moved.503 unavailable: the request didn't finish in time. Retry the same request (sameidempotencyKeyon/custom,/creditand/debit).502on/socialor/custom: the reward run failed for a reason other than a bad config or a Shopify refusal. Theerrorandmessagefields say why.You can't generate a key, or Developer API asks you to upgrade: your plan doesn't include API access.
A birthday was submitted but no credit appears: the gift is scheduled for
nextCreditDate; check Activity: credit logs & scheduled rewards.operation_failedon/debit: the customer's balance is smaller thanamount. Nothing moved; callGET /balanceand debit what they actually hold.balances: []from/balance: the customer exists but has never held store credit on your store. That's a zero balance, not a failure β a missing customer returns404 customer_not_foundinstead.duplicate: truein the response: an earlier call with the sameidempotencyKeyalready succeeded. That's the retry working as intended, not an error.
Related articles
Last updated