Create a discount code
POST /rest/v1/storefront/discounts
code, type and value are required. Each invalid field answers 422 with its param; 409 code_exists (param: code) when the code is taken.
Required scope: storefront:write.
Authorization
apiKey Authorization: Bearer nbl_live_... (or nbl_test_... for test mode). Test-mode writes are validated and simulated but never persisted and never touch channels; simulated results are marked simulated.
In: header
Header Parameters
Unique client-generated key (max 255 chars), stored 24h.
length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/storefront/discounts" \ -H "Content-Type: application/json" \ -d '{ "code": "string", "type": "percentage", "value": 0 }'{ "id": "disc_66f0a1", "object": "discount", "code": "SUMMER10", "type": "percentage", "value": 0, "min_subtotal": 0, "usage_limit": 0, "used": 0, "ends_at": "2019-08-24T14:15:22Z", "active": true, "created_at": "2019-08-24T14:15:22Z", "simulated": true}Last updated on October 18, 2026
Need help?
Email us and a human replies, usually within one business day.