---
title: "Generate coupon codes"
method: POST
path: "/coupons/actions/generate-codes"
tags: ["Coupons"]
---

# Generate coupon codes

`POST /coupons/actions/generate-codes`

## Request

- Base URL: `https://api.fabric.inc/v3`
- URL: `https://api.fabric.inc/v3/coupons/actions/generate-codes`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/fabric/apis/offers-coupons/docs/coupons/actions/generate-codes/post.ts> (a function with typed inputs; its response is checked against the schema)

Generate coupon codes based on the given parameter.

## Headers

- `x-fabric-tenant-id` string, required
- `x-fabric-channel-id` string
- `x-client-id` string
- `x-fabric-request-id` string

## Request body

- GenerateCouponCodesRequest: A sample request to generated coupon codes.
  - `prefix` string, required: The prefix to be added while generating coupon codes.
  - `start` integer, required: The initial number to begin generating the coupon codes.
  - `count` integer, required: The number of coupon codes to be generated.

## Response `200`

OK

- GenerateCouponCodesResponse: The details of generated coupon codes.
  - `data` string[]: An array containing generated coupon codes.

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `500`: Internal server error

---

[API](https://skmtc.dev/fabric/apis/offers-coupons.md) - [All operations](https://skmtc.dev/fabric/apis/offers-coupons/llms.txt) - [OpenAPI document](https://skmtc.dev/fabric/apis/offers-coupons/revisions/4769f4b9212e?raw)
