Skip to main content
GET
/
api
/
v3
/
admin
/
promotion_rules
/
types
Spree Admin SDK
import { createAdminClient } from '@spree/admin-sdk'

const client = createAdminClient({
  baseUrl: 'https://your-store.com',
  secretKey: 'sk_xxx',
})

const { data: ruleTypes } = await client.promotionRules.types()
{
  "data": [
    {
      "type": "category",
      "label": "Categories",
      "description": null,
      "preference_schema": [
        {
          "key": "match_policy",
          "type": "string",
          "default": "any"
        }
      ]
    },
    {
      "type": "country",
      "label": "Country",
      "description": null,
      "preference_schema": [
        {
          "key": "country_isos",
          "type": "array",
          "default": []
        },
        {
          "key": "country_id",
          "type": "integer",
          "default": null
        },
        {
          "key": "country_iso",
          "type": "string",
          "default": null
        }
      ]
    },
    {
      "type": "currency",
      "label": "Currency",
      "description": null,
      "preference_schema": [
        {
          "key": "currency",
          "type": "string",
          "default": null
        }
      ]
    },
    {
      "type": "customer_group",
      "label": "Customer Group(s)",
      "description": null,
      "preference_schema": [
        {
          "key": "customer_group_ids",
          "type": "array",
          "default": []
        }
      ]
    },
    {
      "type": "customer",
      "label": "Customers",
      "description": null,
      "preference_schema": []
    },
    {
      "type": "first_order",
      "label": "First order",
      "description": null,
      "preference_schema": []
    },
    {
      "type": "item_total",
      "label": "Item total",
      "description": null,
      "preference_schema": [
        {
          "key": "amount_min",
          "type": "decimal",
          "default": 100
        },
        {
          "key": "operator_min",
          "type": "string",
          "default": ">"
        },
        {
          "key": "amount_max",
          "type": "decimal",
          "default": null
        },
        {
          "key": "operator_max",
          "type": "string",
          "default": "<"
        }
      ]
    },
    {
      "type": "one_use_per_user",
      "label": "One Use Per User",
      "description": null,
      "preference_schema": []
    },
    {
      "type": "customer_logged_in",
      "label": "Only logged in customers",
      "description": null,
      "preference_schema": []
    },
    {
      "type": "option_value",
      "label": "Option Value(s)",
      "description": null,
      "preference_schema": [
        {
          "key": "match_policy",
          "type": "string",
          "default": "any"
        },
        {
          "key": "eligible_values",
          "type": "array",
          "default": []
        }
      ]
    },
    {
      "type": "product",
      "label": "Product(s)",
      "description": null,
      "preference_schema": [
        {
          "key": "match_policy",
          "type": "string",
          "default": "any"
        }
      ]
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://spreecommerce.org/docs/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

x-spree-api-key
string
header
required

Secret API key for admin access

Authorization
string
header
required

JWT token for admin user authentication

Headers

x-spree-api-key
string
required
Authorization
string
required

Response

200 - application/json

rule types found