> ## Documentation Index
> Fetch the complete documentation index at: https://docs.khaime.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate Coupon

> Check if a coupon code is valid

# Validate Coupon

Validates a coupon code and returns the discount details.

## Request

<ParamField header="X-API-Key" type="string" required>
  Your API key
</ParamField>

### Body Parameters

<ParamField body="coupon_code" type="string" required>
  The coupon code to validate
</ParamField>

<ParamField body="product_id" type="integer">
  Product ID to check coupon applicability
</ParamField>

## Response

<ResponseExample>
  ```json theme={null}
  {
    "status": true,
    "message": "Coupon is valid",
    "data": {
      "coupon_code": "SAVE20",
      "discount_type": "percentage",
      "discount_value": 20,
      "is_valid": true,
      "applicable_products": [12345, 12346],
      "min_order_amount": 5000,
      "max_uses": 100,
      "current_uses": 45,
      "expires_at": "2024-12-31T23:59:59Z"
    }
  }
  ```
</ResponseExample>

## Errors

| Error Code                   | Description                         |
| ---------------------------- | ----------------------------------- |
| `COUPON_NOT_FOUND`           | Coupon code doesn't exist           |
| `COUPON_EXPIRED`             | Coupon has expired                  |
| `COUPON_USAGE_LIMIT_REACHED` | Coupon has been used too many times |

## Example

```bash theme={null}
curl -X POST "https://api.khaime.com/api/v1/coupon/validate" \
  -H "X-API-Key: pk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "coupon_code": "SAVE20",
    "product_id": 12345
  }'
```
