Create Cost Category
POST/api/cost-categories
Create a new cost category.
settings:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Authentication: Requires Bearer token.
Request body fields:
name(required, string, max:255) — unique category namedefault_nominal_code_id(optional, integer, nullable) — the nominal code a landed-cost bill line assigned to this category posts its debit to by default. Must exist innominal_codes. Leave null to fall back to the nominal code mapping settings at posting time.
cogs_nominal_code_id (integer, optional, nullable) — the account this category's share of cost of goods sold posts to. When a shipped unit's landed cost includes this category (e.g. customs duty or inbound freight), that portion is expensed to this account instead of the order's COGS account, and a restocked return reverses it from the same account. Null keeps the share in the order's COGS account. Orders whose product or sub-sales channel has its own COGS account post the whole cost there.
cogs_accounts (array, optional) — per-channel COGS accounts for this category. Each item has nominal_code_id (required) and exactly one of sales_channel_id or sub_sales_channel_id. For an order, the most specific account wins: its sub-sales channel, then its sales channel, then cogs_nominal_code_id. A sub-sales channel that has its own COGS account posts the whole cost there unless it is listed here. Get the channel ids from List Cost Category COGS Channels.
Request
Responses
- 201
- 401
- 403
- 422
- 429
Created
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.