Import a coupon’s codes
Creates a coupon from a CSV of codes made elsewhere: Postforge hands them out and sees them used in orders; the discount stays where the codes came from. Codes the store has already are left out. A code works until a date or as long as the coupon is active (422 `invalid_validity` for days). 422 `no_codes` when no row is a code.
Creates a coupon from a CSV of codes made elsewhere: Postforge hands them out and sees them used in orders; the discount stays where the codes came from. Codes the store has already are left out. A code works until a date or as long as the coupon is active (422 invalid_validity for days). 422 no_codes when no row is a code.
apiKey writeAuthorizationBearer <token>A workspace API key (pf_…), created under Developers → API keys.
Scope: write
idempotency-key?stringRun this write once: a retry with the same key gets the first answer (24 hours).
1 <= length <= 255application/json- body
storeId*stringuuidname*string1 <= length <= 100csv*stringlength <= 25000000validity*||reissue*string"after_use_or_expiry""every_email"OK
application/json- response
id*stringuuidstore*name*stringsource*string"platform""import"kind*string"personal""bulk"quantity*integer|nullprefix*string|nullvalueType*|"percentage""amount"nullvalue*integer|nullminimumSubtotal*validity*||combinesWith*|nullreissue*string"after_use_or_expiry""every_email"status*string"active""ended""archived"externalId*string|nulladminUrl*|uriimportSkipped*integer|nullcodes*createdAt*stringdate-timearchivedAt*|date-timecurl -X POST 'https://api.postforge.dev/v1/coupons/imports' \ -H 'Content-Type: application/json' \ -d '{ "storeId": "b8adcdc8-9238-4168-90f8-77b2d14c211c", "name": "string", "csv": "string", "validity": { "type": "days", "days": 1 }, "reissue": "after_use_or_expiry"}'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "store": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "platform": "string", "currency": "string" }, "name": "string", "source": "platform", "kind": "personal", "quantity": 0, "prefix": "string", "valueType": "percentage", "value": 0, "minimumSubtotal": { "amount": 0, "currency": "str" }, "validity": { "type": "days", "days": 1 }, "combinesWith": { "orderDiscounts": true, "productDiscounts": true, "shippingDiscounts": true }, "reissue": "after_use_or_expiry", "status": "active", "externalId": "string", "adminUrl": "http://example.com", "importSkipped": 0, "codes": { "available": 0, "assigned": 0, "used": 0, "expired": 0, "pending": 0, "failed": 0 }, "createdAt": "2019-08-24T14:15:22Z", "archivedAt": "2019-08-24T14:15:22Z"}