---
title: "Create a single coupon code for a cart rule"
method: POST
path: "/marketing/cart-rules/{cartRuleId}/coupons"
tags: ["Admin Marketing: Promotions"]
---

# Create a single coupon code for a cart rule

`POST /marketing/cart-rules/{cartRuleId}/coupons`

## Request

- Base URL: `http://localhost:8000/api/admin`
- URL: `http://localhost:8000/api/admin/marketing/cart-rules/{cartRuleId}/coupons`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/bagisto/apis/bagisto-admin-api/docs/marketing/cart-rules/:cartRuleId/coupons/post.ts> (a function with typed inputs; its response is checked against the schema)

Create a single coupon code for a cart rule

## Path parameters

- `cartRuleId` integer, required

## Request body

- object
  - `code` string, required
  - `usage_limit` integer, nullable
  - `usage_per_customer` integer, nullable
  - `expired_at` string, date, nullable

## Response `201`

Coupon created.

## Other responses

- `400`: Invalid input
- `404`: Cart rule not found.
- `422`: Validation failed (e.g. code missing or already in use).

---

[API](https://skmtc.dev/bagisto/apis/bagisto-admin-api.md) - [All operations](https://skmtc.dev/bagisto/apis/bagisto-admin-api/llms.txt) - [OpenAPI document](https://skmtc.dev/bagisto/apis/bagisto-admin-api/revisions/3198f11be70f?raw)
