---
title: "Stop a discount code"
method: POST
path: "/gateway/discount-codes/{id}/archive"
tags: ["Discount Codes"]
---

# Stop a discount code

`POST /gateway/discount-codes/{id}/archive`

## Request

- Base URL: `https://api.agentaos.ai/api/v1`
- URL: `https://api.agentaos.ai/api/v1/gateway/discount-codes/{id}/archive`
- Auth: API key in header `x-api-key`

The code stops working immediately. Subscribers who already redeemed it keep the discount they were given.

## Path parameters

- `id` string, uuid, required

## Response `200`

The archived discount code.

- DiscountCode: Fully camelCase on the wire.
  - `id` string, uuid, required
  - `code` string, required: As you typed it. Buyers may type it in any case.
  - `kind` 'discount' | 'tracking', required: `discount` changes the price. `tracking` changes nothing and only records who used it.
  - `planLinkId` string, uuid, nullable, required: The one plan this code works on; null means every subscription plan you own.
  - `planName` string, nullable, required
  - `archivedAt` string, date-time, nullable, required
  - `createdAt` string, date-time, required
  - `active` boolean, required: Usable as far as this list can tell: not archived, and fully created. Whether the code has since been used up is answered by the single-code route.

## Other responses

- `401`: Missing or invalid `x-api-key`.
- `404`: Resource not found (or not visible to your key; the two are not distinguished).

---

[API](https://skmtc.dev/agentaos/apis/agentaos-gateway-api.md) · [All operations](https://skmtc.dev/agentaos/apis/agentaos-gateway-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agentaos/apis/agentaos-gateway-api/revisions/3a8ad3c6b965?raw)
