# Get a discount

URL: https://docs.sparklayer.io/developers/api/core/get-a-discount
Operation: `GET /api/v1/discounts/{id}` (operationId `getDiscount`)
OpenAPI spec: https://docs.sparklayer.io/openapi/core.yaml

Returns a single discount by its UUID. Returns `404` if the discount doesn't exist or has been deleted.

`GET /api/v1/discounts/{id}`

**Base URLs:** `https://app.sparklayer.io` (Live), `https://test.app.sparklayer.io` (Test)

**Authentication:** send `Authorization: Bearer <access_token>` and `Site-Id: <site id>` with every request. Get the token from [Get an access token](https://docs.sparklayer.io/developers/api/core/get-an-access-token.md); see [Authentication](https://docs.sparklayer.io/developers/authentication.md).

### Example request

```bash
curl "https://app.sparklayer.io/api/v1/discounts/942651af-f950-4716-9916-16170fe0645f" \
  -H "Authorization: Bearer $SPARKLAYER_TOKEN" \
  -H "Site-Id: $SPARKLAYER_SITE_ID"
```

Set `SPARKLAYER_TOKEN` to an access token and `SPARKLAYER_SITE_ID` to your Site ID. For the test environment, use `https://test.app.sparklayer.io`.

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The discount's ID (a UUID). Example: `942651af-f950-4716-9916-16170fe0645f` |

### Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Site-Id` | string | Yes | Your SparkLayer Site ID, from Settings > API in the SparkLayer Dashboard. Example: `jones-climbing` |

### Responses

#### 200: The discount.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string (uuid) | | Discount ID (uuid) |
| `created_at` | string (date-time) | | |
| `deleted_at` | string (date-time) \| null | | |
| `updated_at` | string (date-time) | | |
| `name` | string | | A user friendly name for the discount. Length: max 256. |
| `internal_name` | string | Yes | Length: max 45. |
| `internal_slug` | string | Yes | Length: max 45. |
| `template` | string \| null | | Discount template type. If not null allowed values are - 'order_level_get_amount_off', 'order_level_get_free_product', 'product_level_get_amount_off', 'order_level_get_shipping_reward', 'advanced_order_level_get_amount_off', 'order_level_requirement_amount_off', 'advanced_discount', 'advanced_free_products' |
| `calculation_group` | number | Yes | Dependency level = Calculation Group. All discounts with the same dependency level will share the same base, pre-discount totals. E.g. discount A (50% off) and discount B (50% off) will reward 100% off - not 75% off. Min 0, max 127. |
| `priority` | number | Yes | The sequence to apply the discounts (within each discount 'dependency level'). Min 0, max 10000. |
| `times_applicable_per_order` | number | Yes | Per order application limits. If -1 allow unlimited applications, otherwise limited. Min -1, max 127. |
| `max_rewards` | number \| null | | Used when rewardSelectionType is cheapest or expensive to determine the number of rewards available. Default: `1`. Min 1, max 127. |
| `groups` | string[] | Yes | Customer groups covered by this discount (use default to cover all groups) |
| `excluded_customers` | string[] | | Array of email address or accounting ids of customers to exclude from the discount |
| `simultaneity` | (string (uuid))[] \| null | | Other discounts which can be applied simultaneous, if null no limitation |
| `requirement_selection_type` | "any" \| "all" | Yes | Products which must be in the cart must match all or any one of the combo groups |
| `reward_selection_type` | "all" \| "cheapest" \| "expensive" | Yes | |
| `currency_code` | string \| null | Yes | Length: min 3, max 3. |
| `start_date` | string (date-time) \| null | Yes | Start Date |
| `end_date` | string (date-time) \| null | Yes | End Date |
| `active` | boolean | Yes | |
| `requirements` | object[] | Yes | |
| `requirements[].items` | object[] | Yes | |
| `requirements[].items[].restrictions` | object[] | Yes | |
| `requirements[].items[].restrictions[].type` | "productSKU" \| "excludeProductSKU" \| "productSKUContains" \| "excludeProductSKUContains" \| "productMetadata" \| "excludeProductMetadata" | Yes | |
| `requirements[].items[].restrictions[].ref` | string | Yes | |
| `requirements[].items[].restrictions[].metadata_namespace` | string \| null | | Length: max 256. |
| `requirements[].items[].restrictions[].metadata_key` | string \| null | | Length: max 128. |
| `requirements[].items[].points_type` | "line" \| "item" | Yes | Add X point(s) for each matching product OR Add X point(s) for once only |
| `requirements[].items[].points` | integer | Yes | Default: `1`. |
| `requirements[].items[].quantity` | integer | Yes | |
| `requirements[].items[].selection_type` | "minimum" \| "exact" | Yes | At least X quantity of product(s) must match OR Exactly X quantity of product(s) |
| `requirements[].max_rewards` | integer \| null | Yes | Limit the number of rewards when this requirement applies |
| `requirements[].min_spend` | number \| null | Yes | The cart must contain between min_spend and max_spend based on spend_tax_type of the requirement. |
| `requirements[].max_spend` | number \| null | Yes | |
| `requirements[].spend_tax_type` | "net" | Yes | |
| `requirements[].selection_type` | "minimum" \| "all" | Yes | Apply only if 'all' items matched in the cart OR if cart worth minimum of min_points requirement items(s) using requirements |
| `requirements[].min_points` | integer \| null | Yes | Only applies when selection_type is minimum |
| `rewards` | object[] | | |
| `rewards[].type` | "requirements\|all" \| "requirements\|cheapest" \| "cart\|productSKU" \| "cart\|cheapestProductSKU" \| "cart\|productMetadata" \| "cart\|cheapestProductMetadata" \| "product" \| "shipping" \| "order" | Yes | |
| `rewards[].amount_type` | "percent" \| "percentPreDiscount" \| "priceAllGross" \| "priceAllNet" \| "priceLineGross" \| "priceLineNet" \| "fixedAllGross" \| "fixedAllNet" \| "fixedLineGross" \| "fixedLineNet" \| "none" | Yes | |
| `rewards[].restriction_type` | "equals" \| "notEquals" \| "contains" \| "notContains" | | |
| `rewards[].item_id` | string | Yes | Length: max 100. |
| `rewards[].metadata_namespace` | string \| null | | Length: max 256. |
| `rewards[].metadata_key` | string \| null | | Length: max 128. |
| `rewards[].amount` | number | Yes | Max 1000000000. |
| `other_requirements` | (Discount.OtherRequirements.Coupons \| Discount.OtherRequirements.NumItems \| Discount.OtherRequirements.SpendAmount \| Discount.OtherRequirements.MaxUsesPerCustomer)[] | Yes | |
| `other_requirements[].requirement_type` | "coupons" | | |
| `other_requirements[].coupons` | object[] | | Items: min 1. |
| `other_requirements[].coupons[].code` | string | | |
| `other_requirements[].min` | number \| null | | |
| `other_requirements[].max` | number \| null | | |
| `other_requirements[].type` | "productsTotalItems" \| "productsTotalQuantity" | | |
| `other_requirements[].tax_type` | "net" | | |
| `other_requirements[].number` | number | | |

```json
{
  "id": "942651af-f950-4716-9916-16170fe0645f",
  "created_at": "2026-01-31T09:00:00Z",
  "deleted_at": "2026-01-31T09:00:00Z",
  "updated_at": "2026-01-31T09:00:00Z",
  "name": "<name>",
  "internal_name": "<internal_name>",
  "internal_slug": "<internal_slug>",
  "template": "<template>",
  "calculation_group": 0,
  "priority": 0,
  "times_applicable_per_order": -1,
  "max_rewards": 1,
  "groups": [
    "default"
  ],
  "excluded_customers": [
    "customer@b2b.com"
  ],
  "simultaneity": [
    "default"
  ],
  "requirement_selection_type": "any",
  "reward_selection_type": "all",
  "currency_code": "gbp",
  "start_date": "2026-01-31T09:00:00Z",
  "end_date": "2026-01-31T09:00:00Z",
  "active": true,
  "requirements": [
    {
      "items": [
        {
          "restrictions": [
            {
              "type": "productSKU",
              "ref": "<ref>",
              "metadata_namespace": "erp",
              "metadata_key": "vendor"
            }
          ],
          "points_type": "line",
          "points": 1,
          "quantity": 0,
          "selection_type": "minimum"
        }
      ],
      "max_rewards": 0,
      "min_spend": 0,
      "max_spend": 0,
      "spend_tax_type": "net",
      "selection_type": "minimum",
      "min_points": 0
    }
  ],
  "rewards": [
    {
      "type": "requirements|all",
      "amount_type": "percent",
      "restriction_type": "equals",
      "item_id": "<item_id>",
      "metadata_namespace": "erp",
      "metadata_key": "vendor",
      "amount": 0
    }
  ],
  "other_requirements": [
    {
      "requirement_type": "coupons",
      "coupons": [
        {
          "code": "<code>"
        }
      ]
    }
  ]
}
```

#### Other statuses: An error. The body describes the problem: see [Errors](https://docs.sparklayer.io/developers/errors.md).

`application/problem+json`: the standard error body (below).

### Error body

Error responses with a body use this RFC 7807 problem details object. See [Errors](https://docs.sparklayer.io/developers/errors.md) for every status code and which errors to retry.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `detail` | string | | Human-readable summary of the error |
| `status` | integer | | HTTP Status code returned from API |
| `title` | string | | Machine-readable error code |
| `type` | string \| null | | |
| `errors` | object[] \| null | | A list of errors related to the call |
| `errors[].code` | string | | Machine-readable error code |
| `errors[].property` | string | | The property the error relates to |
| `errors[].message` | string | | Human readable summary of the error |

```json
{
  "detail": "Data Validation Failed",
  "status": 400,
  "title": "invalid-api-request-contents",
  "type": "https://docs.sparklayer.io/api/errors#invalid-api-request-contents",
  "errors": [
    {
      "code": "resource-not-found",
      "property": "stock_location_id",
      "message": "stock_location_id not found"
    }
  ]
}
```
