Spree Admin SDK
import { createAdminClient } from '@spree/admin-sdk'
const client = createAdminClient({
baseUrl: 'https://your-store.com',
secretKey: 'sk_xxx',
})
// Each kind comes with the JSON Schema of its configuration.
const { data: ruleTypes } = await client.commissionRates.ruleTypes()spree api get /commission_rates/rule_types{
"data": [
{
"type": "seller_rule",
"name": "Seller",
"description": "Charges this rate only when the seller is one of the selected",
"schema": {
"type": "object",
"properties": {
"seller_ids": {
"type": "array",
"items": {
"type": "string",
"format": "prefixed-id",
"pattern": "^sel_[A-Za-z0-9]+$",
"x-spree-prefix": "sel"
},
"default": []
}
},
"additionalProperties": false
},
"association_fields": [
"seller_ids"
]
},
{
"type": "category_rule",
"name": "Category",
"description": "Charges this rate only for products in the selected categories, and anything filed beneath them",
"schema": {
"type": "object",
"properties": {
"category_ids": {
"type": "array",
"items": {
"type": "string",
"format": "prefixed-id",
"pattern": "^ctg_[A-Za-z0-9]+$",
"x-spree-prefix": "ctg"
},
"default": []
}
},
"additionalProperties": false
},
"association_fields": [
"category_ids"
]
},
{
"type": "product_rule",
"name": "Product",
"description": "Charges this rate only for the selected products",
"schema": {
"type": "object",
"properties": {},
"additionalProperties": false
},
"association_fields": [
"product_ids"
]
},
{
"type": "item_total_rule",
"name": "Sale value",
"description": "Charges this rate only on sales within a value range",
"schema": {
"type": "object",
"properties": {
"min_amount": {
"type": [
"string",
"null"
],
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$"
},
"max_amount": {
"type": [
"string",
"null"
],
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$"
}
},
"additionalProperties": false
},
"association_fields": []
}
]
}List the commission rule kinds
Every rule kind a rate can be narrowed by, with the schema describing the configuration it takes — so a client builds its editor from what this marketplace has rather than a list hardcoded to match core’s.
association_fields names any catalog-scale reference a kind keeps
outside its preferences, so an editor knows to render a picker for it.
Required scope: read_commissions (for API-key authentication).
GET
/
api
/
v3
/
admin
/
commission_rates
/
rule_types
Spree Admin SDK
import { createAdminClient } from '@spree/admin-sdk'
const client = createAdminClient({
baseUrl: 'https://your-store.com',
secretKey: 'sk_xxx',
})
// Each kind comes with the JSON Schema of its configuration.
const { data: ruleTypes } = await client.commissionRates.ruleTypes()spree api get /commission_rates/rule_types{
"data": [
{
"type": "seller_rule",
"name": "Seller",
"description": "Charges this rate only when the seller is one of the selected",
"schema": {
"type": "object",
"properties": {
"seller_ids": {
"type": "array",
"items": {
"type": "string",
"format": "prefixed-id",
"pattern": "^sel_[A-Za-z0-9]+$",
"x-spree-prefix": "sel"
},
"default": []
}
},
"additionalProperties": false
},
"association_fields": [
"seller_ids"
]
},
{
"type": "category_rule",
"name": "Category",
"description": "Charges this rate only for products in the selected categories, and anything filed beneath them",
"schema": {
"type": "object",
"properties": {
"category_ids": {
"type": "array",
"items": {
"type": "string",
"format": "prefixed-id",
"pattern": "^ctg_[A-Za-z0-9]+$",
"x-spree-prefix": "ctg"
},
"default": []
}
},
"additionalProperties": false
},
"association_fields": [
"category_ids"
]
},
{
"type": "product_rule",
"name": "Product",
"description": "Charges this rate only for the selected products",
"schema": {
"type": "object",
"properties": {},
"additionalProperties": false
},
"association_fields": [
"product_ids"
]
},
{
"type": "item_total_rule",
"name": "Sale value",
"description": "Charges this rate only on sales within a value range",
"schema": {
"type": "object",
"properties": {
"min_amount": {
"type": [
"string",
"null"
],
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$"
},
"max_amount": {
"type": [
"string",
"null"
],
"format": "money",
"pattern": "^-?\\d+(\\.\\d+)?$"
}
},
"additionalProperties": false
},
"association_fields": []
}
]
}Authorizations
Secret API key for admin access
JWT token for admin user authentication
Response
200 - application/json
subject types found
Show child attributes
Show child attributes
Was this page helpful?
⌘I

