Skip to main content
POST
Create a cost rule

Authorizations

Authorization
string
header
required

Authenticate using a bearer token. To create a token, navigate to /settings/api-tokens and click Create API Token.

Body

application/json
name
string
required

Rule name. Required on create. Must be unique per vendor among non-deleted rules.

Maximum string length: 255
vendor_id
integer

Supplier / factory ID. Required on create unless output_kind is EXTRA_COST (where the supplier is an optional document condition). Optional on update.

description
string | null
Maximum string length: 1000
document_types
enum<string>[]

Document types the rule applies to. Required on create (or provide singular document_type).

Minimum array length: 1
Available options:
PURCHASE_ORDER,
WORK_ORDER,
SHIPMENT
document_type
enum<string>

Singular alternative to document_types (back-compat).

Available options:
PURCHASE_ORDER,
WORK_ORDER,
SHIPMENT
tier_mode
enum<string>

Defaults to NON_GRADUATED.

Available options:
NON_GRADUATED,
GRADUATED
tier_quantity_basis
enum<string>

Defaults to LINE.

Available options:
LINE,
SCOPE_GROUP
priority
integer

Defaults to 100.

Required range: 1 <= x <= 1000
status
enum<string>

Defaults to ACTIVE on create.

Available options:
ACTIVE,
INACTIVE,
DRAFT
effective_from
string<date> | null
effective_to
string<date> | null

Must be on or after effective_from.

moq
number | null
Required range: x >= 0
order_multiple
number | null
Required range: x >= 0
is_active
boolean | null
output_kind
enum<string>

Defaults to UNIT_COST.

Available options:
UNIT_COST,
EXTRA_COST
extra_cost_item_name
string | null
Maximum string length: 255
cost_allocation_type
enum<string> | null
Available options:
UNIT_BASED_ALLOCATION,
VOLUME_BASED_ALLOCATION,
WEIGHT_BASED_ALLOCATION,
VALUE_BASED_ALLOCATION
cost_basis
enum<string> | null

Required when output_kind is EXTRA_COST.

Available options:
PERCENTAGE,
FIXED
cost_basis_amount
number | null

Required when output_kind is EXTRA_COST.

Required range: x >= 0
shipment_type
string | null
Maximum string length: 30
options
object
scopes
object[]

Product / category / tag / supplier-SKU scopes. Replaces existing scopes when provided.

conditions
object[]

Document-level applicability gates. Replaces existing conditions when provided.

tiers
object[]

Quantity tiers with their effects. Replaces existing tiers when provided.

Response

Cost rule created.

data
object

A cost rule — vendor-scoped tiered pricing or extra-cost rule applied to purchase orders, work orders, and shipments. Nested scopes, conditions, and tiers (with effects) are only present when the relation is loaded (always on GET /cost-rules/{id}).