Hand out a code
Hands a code to a profile (its email): the same code never goes to two people. With `after_use_or_expiry` a person whose code still works gets that code again. Its days start when it’s first handed out. 409 `coupon_archived` or `coupon_ended`; 409 `coupon_codes_unavailable` when none is ready yet (more are being made); 422 `profile_without_email`.
Hands a code to a profile (its email): the same code never goes to two people. With after_use_or_expiry a person whose code still works gets that code again. Its days start when it’s first handed out. 409 coupon_archived or coupon_ended; 409 coupon_codes_unavailable when none is ready yet (more are being made); 422 profile_without_email.
apiKey writeAuthorizationBearer <token>A workspace API key (pf_…), created under Developers → API keys.
Scope: write
id*stringuuididempotency-key?stringRun this write once: a retry with the same key gets the first answer (24 hours).
1 <= length <= 255application/json- body
profileId*stringuuidOK
application/json- response
id*stringuuidcode*stringstatus*string"pending""available""assigned""used""expired""failed"profile*|nullorder*|nullassignedAt*|date-timeexpiresAt*|date-timeusedAt*|date-timeerror*string|nullcreatedAt*stringdate-timecurl -X POST 'https://api.postforge.dev/v1/coupons/497f6eca-6276-4993-bfeb-53cbbbba6f08/codes/assign' \ -H 'Content-Type: application/json' \ -d '{ "profileId": "faebe71b-2bf8-4bdb-9b67-258e4d6aa00a"}'{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "code": "string", "status": "pending", "profile": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "email": "string" }, "order": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "number": "string" }, "assignedAt": "2019-08-24T14:15:22Z", "expiresAt": "2019-08-24T14:15:22Z", "usedAt": "2019-08-24T14:15:22Z", "error": "string", "createdAt": "2019-08-24T14:15:22Z"}