Create a custom order type
curl --request POST \ --url https://example.com/api/v1/order-types \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "behavior": "SUBSCRIPTION", "billable": true, "budgetUnit": "HOURS", "code": "example", "consumptionLabelId": "example", "consumptionRule": "ROOT_TASK_CREATED", "defaultOveragePolicy": "CARRY_OVER", "description": "example", "formEndDate": "REQUIRED", "invoiceAttach": "EXTRA_BLOCK", "invoiceRequirement": "REQUIRED", "name": "example", "nameTemplate": "example", "overageKind": "MANAGED", "payment": "PREPAID", "ratePricing": "SNAPSHOT", "recurrence": "RENEWAL", "reportRange": "ORDER_START", "revenueAccountId": "example", "unitNamePlural": "example", "unitNameSingular": "example" }'Creates a custom order type after the last one. The code is uppercased and unique among all types, archived ones included; the name is unique among active types. Each axis is optional: null takes the preset of the type’s behavior, and the response’s effectiveAxes shows the value an order of the type actually runs on. A combination no order can run is refused with reason INVALID_AXES. Once an order uses the type, its budget, renewal, payment, pricing, billable and overage axes are locked (reason AXES_IN_USE). Requires the settings.manage permission. Setting or changing revenueAccountId also requires accounting.manage; a new account must be an active one of this workspace.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
What orders of this type do. Fixed once any order uses the type.
Whether time logged on orders of the type is charged to the client.
Code (2 to 12 letters or digits, with no spaces or dashes), unique; stored uppercase. Generated order codes carry it, like ACME-HOURS-6.
Display name, unique among active types.
Defaults to the behavior’s usual range.
Revenue account (see /revenue-accounts) for invoice lines of this type’s orders with no service; null for none. New invoice lines for an order of this type with no service start on this account; a custom type with none uses the account of the system type of the same behavior. Setting or changing it requires the invoices.manage permission, and a new account must be an active one of this workspace.
Responses
Section titled “Responses”The created order type.
object
A workspace order type: one behavior with its name, code and default report range. Six system types are provisioned.
object
The axes as stored, one per rule an order of the type runs on. Each axis is optional: null takes the preset of the type’s behavior, and the response’s effectiveAxes shows the value an order of the type actually runs on. A combination no order can run is refused with reason INVALID_AXES. Once an order uses the type, its budget, renewal, payment, pricing, billable and overage axes are locked (reason AXES_IN_USE).
object
What an order of the type does. SUBSCRIPTION (Subscription): Renews each period on its renewal day. HOUR_BLOCK (Hour block): Prepaid hours used up over time. Extra blocks and overage can move to a new order. SPRINT (Sprint): Fixed scope with prepaid hours. Overage is absorbed and never billed. TIME_AND_MATERIALS (Time & Materials): No budget. Billed afterwards from the time logged. TOKENS (Tokens): Prepaid tokens. Each root task linked to the order uses one. NON_BILLABLE (Non billable): Time that is not charged, against a monthly budget.
Whether POST /orders accepts this type as orderTypeId: it is active and its behavior can open orders. Only types whose behavior is HOUR_BLOCK, SPRINT, SUBSCRIPTION or NON_BILLABLE can open orders today; each type’s canOpenOrders says whether it can.
The axes an order of the type runs on: each stored axis, or the preset of the behavior where it is null. A few stay null by design, such as the unit name of an hours budget.
object
System types (one per behavior) can be renamed and recoded but never archived, and keep their behavior.
Display order, ascending.
The default window an order’s hours report opens on. ORDER_START: Runs from the order start to today, or to its end date once that has passed. CURRENT_PERIOD: The order’s current budget period. CURRENT_MONTH: The current calendar month.
Revenue account for invoice lines of this type’s orders with no service; null when the type has none. New invoice lines for an order of this type with no service start on this account; a custom type with none uses the account of the system type of the same behavior.
Example
{ "data": { "axes": { "budgetUnit": "HOURS", "consumptionRule": "ROOT_TASK_CREATED", "defaultOveragePolicy": "CARRY_OVER", "formEndDate": "REQUIRED", "invoiceAttach": "EXTRA_BLOCK", "invoiceRequirement": "REQUIRED", "overageKind": "MANAGED", "payment": "PREPAID", "ratePricing": "SNAPSHOT", "recurrence": "RENEWAL" }, "behavior": "SUBSCRIPTION", "effectiveAxes": { "budgetUnit": "HOURS", "consumptionRule": "ROOT_TASK_CREATED", "defaultOveragePolicy": "CARRY_OVER", "formEndDate": "REQUIRED", "invoiceAttach": "EXTRA_BLOCK", "invoiceRequirement": "REQUIRED", "overageKind": "MANAGED", "payment": "PREPAID", "ratePricing": "SNAPSHOT", "recurrence": "RENEWAL" }, "reportRange": "ORDER_START" }}Validation error: a malformed name, code or description, or an unknown behavior, report range or axis value. Parse failures include field paths and expectations.
Validation error with safe field paths and expected values; submitted values are never returned.
object
object
Stable machine-readable error code.
object
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Unauthorized.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Forbidden: the member lacks settings.manage, or the request sets or changes revenueAccountId without accounting.manage (reason REVENUE_ACCOUNT_FORBIDDEN).
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Error envelope whose reason names the order type rule that was broken.
object
object
Stable machine-readable error code.
With AXES_IN_USE: the locked axes the request tried to change.
Human-readable error message.
Stable code for the rule an order type request broke.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}DUPLICATE_CODE or DUPLICATE_NAME: the code or name is already taken.
Error envelope whose reason names the order type rule that was broken.
object
object
Stable machine-readable error code.
With AXES_IN_USE: the locked axes the request tried to change.
Human-readable error message.
Stable code for the rule an order type request broke.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED", "reason": "NOT_FOUND" }}REVENUE_ACCOUNT_NOT_FOUND when revenueAccountId names no account of this workspace, or REVENUE_ACCOUNT_ARCHIVED when it names an archived one, INVALID_AXES when the axes describe a type no order can run on (for example a unit budget without a unit name), or CONSUMPTION_LABEL_NOT_FOUND when consumptionLabelId names no task label of this workspace, or INVALID_NAME_TEMPLATE when nameTemplate uses an unknown placeholder, nests square brackets or is too long.
Error envelope whose reason names the order type rule that was broken.
object
object
Stable machine-readable error code.
With AXES_IN_USE: the locked axes the request tried to change.
Human-readable error message.
Stable code for the rule an order type request broke.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED", "reason": "NOT_FOUND" }}Rate limit exceeded. Wait for Retry-After before retrying.
Standard error envelope.
object
object
Stable machine-readable error code.
Human-readable error message.
HTTP status code, mirrored in the body.
Example
{ "error": { "code": "UNAUTHORIZED" }}Headers
Section titled “Headers”Maximum requests in the current quota window.
Quota policy in requests and window seconds, for example 60;w=60.
Requests left in this quota window (zero when blocked).
Seconds until the current quota window resets, when available from the rate-limit store.
Seconds until another request may be attempted.
Chelsea is operated by Arepa Labs LLC