Cognis
Commerce Discounts

Get Usage Analytics

GET
/brands/{brandId}/ecom/discount-rules/usage-analytics

Windowed redemption analytics from commerce_discount_redemptions joined to rules and orders (not Stripe Promotion Code API).

Required scopes: brand:settings:read

Authorization

bearerAuth
AuthorizationBearer <token>

API key (prefix: cogn_) from Account → Developer

In: header

Path Parameters

brandId*string

Brand ID (prefix: br_)

Query Parameters

windowDays?integer
Default30
Range1 <= value <= 365
recentLimit?integer
Default20
Range1 <= value <= 100
ruleId?string
Length1 <= length

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X GET "http://localhost:3013/api/v1/brands/string/ecom/discount-rules/usage-analytics"
{
  "success": true,
  "data": {
    "windowDays": 30,
    "totals": {
      "redemptionCount": 12,
      "discountAmountMinor": 48500,
      "distinctOrderCount": 11
    },
    "byRule": [
      {
        "ruleId": "rule_abc",
        "code": "SAVE10",
        "type": "percent_off",
        "enabled": true,
        "redemptionCount": 8,
        "discountAmountMinor": 32000,
        "distinctOrderCount": 8
      }
    ],
    "recentRedemptions": [
      {
        "redemptionId": "red_abc",
        "ruleId": "rule_abc",
        "code": "SAVE10",
        "orderId": "ord_abc",
        "orderNumber": "1001",
        "amountMinor": 4000,
        "currency": "usd",
        "createdAt": "2026-06-01T12:00:00.000Z"
      }
    ]
  },
  "message": "Success",
  "traceId": "req_abc123"
}
{
  "success": false,
  "message": "Invalid data",
  "errors": [
    {
      "code": 400,
      "message": "Invalid data"
    }
  ],
  "traceId": "req_xxx"
}
{
  "success": false,
  "message": "Unauthorized",
  "errors": [
    {
      "code": 401,
      "message": "Unauthorized"
    }
  ],
  "traceId": "req_xxx"
}
{
  "success": false,
  "message": "Forbidden",
  "errors": [
    {
      "code": 403,
      "message": "Forbidden"
    }
  ],
  "traceId": "req_xxx"
}
{
  "success": false,
  "message": "Not found",
  "errors": [
    {
      "code": 404,
      "message": "Not found"
    }
  ],
  "traceId": "req_xxx"
}
{
  "success": false,
  "message": "Conflict",
  "errors": [
    {
      "code": 409,
      "message": "Conflict"
    }
  ],
  "traceId": "req_xxx"
}
{
  "success": false,
  "message": "string",
  "errors": [
    {
      "code": 0,
      "message": "string",
      "details": {}
    }
  ],
  "traceId": "string",
  "params": {},
  "readableMessage": "string"
}
{
  "success": false,
  "message": "Rate limit exceeded",
  "errors": [],
  "traceId": "req_xxx"
}
{
  "success": false,
  "message": "Unexpected error",
  "errors": [
    {
      "code": 500,
      "message": "Unexpected error"
    }
  ],
  "traceId": "req_xxx"
}