Skip to content

Restore an archived order type

POST
/order-types/{id}/restore
Code sample: Shell / cURL
curl --request POST \
--url https://example.com/api/v1/order-types/example/restore \
--header 'Authorization: Bearer <token>'

Brings an archived order type back after the last active one. Restoring an active type succeeds without change. Requires the settings.manage permission.

id
required

Resource identifier (CUID2).

string
>= 1 characters

Resource identifier (CUID2).

The restored order type.

Media typeapplication/json
object
data
required

A workspace order type: one behavior with its name, code and default report range. Six system types are provisioned.

object
archivedAt
required

When the type was archived; null while it is active.

Any of:
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
axes
required

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
billable
required
boolean | null
budgetUnit
required
Any of:

What the order budget is measured in. HOURS: hours of logged time. UNITS: things the type names, which needs a unit name and a consumption rule. NONE: no budget.

string
Allowed values: HOURS UNITS NONE
consumptionLabelId
required
string | null
consumptionRule
required
Any of:

When one unit is spent, for a UNITS budget. ROOT_TASK_CREATED: a root task of a linked project is created. ROOT_TASK_COMPLETED: it is completed. ROOT_TASK_WITH_LABEL: it is created carrying the label in consumptionLabelId.

string
Allowed values: ROOT_TASK_CREATED ROOT_TASK_COMPLETED ROOT_TASK_WITH_LABEL
defaultOveragePolicy
required
Any of:

The overage policy a new order of the type starts with: CARRY_OVER, RESET, ABSORB, or ASK to leave the choice to the form.

string
Allowed values: CARRY_OVER RESET ABSORB ASK
formEndDate
required
Any of:

Whether the New Order form asks for an end date: REQUIRED, OPTIONAL or HIDDEN.

string
Allowed values: REQUIRED OPTIONAL HIDDEN
invoiceAttach
required
Any of:

How an invoice feeds an open order of the type. EXTRA_BLOCK: it adds an extra block of budget. PERIOD_PAYMENT: it pays a renewal period, so only a RENEWAL type takes it. NONE: it cannot.

string
Allowed values: EXTRA_BLOCK PERIOD_PAYMENT NONE
invoiceRequirement
required
Any of:

Whether an order of the type names the invoice that sold it: REQUIRED, OPTIONAL or NEVER. Ignored while the Invoices module is off; a POSTPAID type cannot require one.

string
Allowed values: REQUIRED OPTIONAL NEVER
nameTemplate
required
string | null
overageKind
required
Any of:

What happens to hours over the budget. MANAGED: a person settles, carries or resets them. ABSORBED: the loss is only reported. NONE: the type has no overage.

string
Allowed values: MANAGED ABSORBED NONE
payment
required
Any of:

PREPAID: the client pays before the work, so an invoice sells the order. POSTPAID: the client is billed afterwards.

string
Allowed values: PREPAID POSTPAID
ratePricing
required
Any of:

How time is priced. SNAPSHOT: the order keeps the hourly rate it was opened with. LIVE: each time entry takes the client’s rate of its own date. NONE: time is not priced.

string
Allowed values: SNAPSHOT LIVE NONE
recurrence
required
Any of:

RENEWAL: the order renews each period on a renewal day with a new budget. MONTHLY_RESET: the budget restarts every calendar month. NONE: one budget, no renewal.

string
Allowed values: RENEWAL MONTHLY_RESET NONE
unitNamePlural
required
string | null
unitNameSingular
required
string | null
behavior
required

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.

string
Allowed values: SUBSCRIPTION HOUR_BLOCK SPRINT TIME_AND_MATERIALS TOKENS NON_BILLABLE
canOpenOrders
required

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.

boolean
code
required
string
createdAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/
description
required
string | null
effectiveAxes
required

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
billable
required
boolean | null
budgetUnit
required
Any of:

What the order budget is measured in. HOURS: hours of logged time. UNITS: things the type names, which needs a unit name and a consumption rule. NONE: no budget.

string
Allowed values: HOURS UNITS NONE
consumptionLabelId
required
string | null
consumptionRule
required
Any of:

When one unit is spent, for a UNITS budget. ROOT_TASK_CREATED: a root task of a linked project is created. ROOT_TASK_COMPLETED: it is completed. ROOT_TASK_WITH_LABEL: it is created carrying the label in consumptionLabelId.

string
Allowed values: ROOT_TASK_CREATED ROOT_TASK_COMPLETED ROOT_TASK_WITH_LABEL
defaultOveragePolicy
required
Any of:

The overage policy a new order of the type starts with: CARRY_OVER, RESET, ABSORB, or ASK to leave the choice to the form.

string
Allowed values: CARRY_OVER RESET ABSORB ASK
formEndDate
required
Any of:

Whether the New Order form asks for an end date: REQUIRED, OPTIONAL or HIDDEN.

string
Allowed values: REQUIRED OPTIONAL HIDDEN
invoiceAttach
required
Any of:

How an invoice feeds an open order of the type. EXTRA_BLOCK: it adds an extra block of budget. PERIOD_PAYMENT: it pays a renewal period, so only a RENEWAL type takes it. NONE: it cannot.

string
Allowed values: EXTRA_BLOCK PERIOD_PAYMENT NONE
invoiceRequirement
required
Any of:

Whether an order of the type names the invoice that sold it: REQUIRED, OPTIONAL or NEVER. Ignored while the Invoices module is off; a POSTPAID type cannot require one.

string
Allowed values: REQUIRED OPTIONAL NEVER
nameTemplate
required
string | null
overageKind
required
Any of:

What happens to hours over the budget. MANAGED: a person settles, carries or resets them. ABSORBED: the loss is only reported. NONE: the type has no overage.

string
Allowed values: MANAGED ABSORBED NONE
payment
required
Any of:

PREPAID: the client pays before the work, so an invoice sells the order. POSTPAID: the client is billed afterwards.

string
Allowed values: PREPAID POSTPAID
ratePricing
required
Any of:

How time is priced. SNAPSHOT: the order keeps the hourly rate it was opened with. LIVE: each time entry takes the client’s rate of its own date. NONE: time is not priced.

string
Allowed values: SNAPSHOT LIVE NONE
recurrence
required
Any of:

RENEWAL: the order renews each period on a renewal day with a new budget. MONTHLY_RESET: the budget restarts every calendar month. NONE: one budget, no renewal.

string
Allowed values: RENEWAL MONTHLY_RESET NONE
unitNamePlural
required
string | null
unitNameSingular
required
string | null
id
required
string
isSystem
required

System types (one per behavior) can be renamed and recoded but never archived, and keep their behavior.

boolean
name
required
string
position
required

Display order, ascending.

integer
>= -9007199254740991 <= 9007199254740991
reportRange
required

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.

string
Allowed values: ORDER_START CURRENT_PERIOD CURRENT_MONTH
revenueAccountId
required

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.

string | null
updatedAt
required
string format: date-time
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$/

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"
}
}

Unauthorized.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

Forbidden.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}

NOT_FOUND: no such order type in this workspace.

Media typeapplication/json

Error envelope whose reason names the order type rule that was broken.

object
error
required
object
code
required

Stable machine-readable error code.

string
lockedAxes

With AXES_IN_USE: the locked axes the request tried to change.

Array<string>
message
required

Human-readable error message.

string
reason
required

Stable code for the rule an order type request broke.

string
Allowed values: NOT_FOUND INVALID_NAME INVALID_CODE INVALID_DESCRIPTION INVALID_NAME_TEMPLATE DUPLICATE_NAME DUPLICATE_CODE SYSTEM_BEHAVIOR_LOCKED BEHAVIOR_IN_USE SYSTEM_TYPE_NOT_ARCHIVABLE INVALID_ORDERING REVENUE_ACCOUNT_FORBIDDEN REVENUE_ACCOUNT_NOT_FOUND REVENUE_ACCOUNT_ARCHIVED INVALID_AXES AXES_IN_USE CONSUMPTION_LABEL_NOT_FOUND
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED",
"reason": "NOT_FOUND"
}
}

DUPLICATE_NAME: an active type took the name meanwhile.

Media typeapplication/json

Error envelope whose reason names the order type rule that was broken.

object
error
required
object
code
required

Stable machine-readable error code.

string
lockedAxes

With AXES_IN_USE: the locked axes the request tried to change.

Array<string>
message
required

Human-readable error message.

string
reason
required

Stable code for the rule an order type request broke.

string
Allowed values: NOT_FOUND INVALID_NAME INVALID_CODE INVALID_DESCRIPTION INVALID_NAME_TEMPLATE DUPLICATE_NAME DUPLICATE_CODE SYSTEM_BEHAVIOR_LOCKED BEHAVIOR_IN_USE SYSTEM_TYPE_NOT_ARCHIVABLE INVALID_ORDERING REVENUE_ACCOUNT_FORBIDDEN REVENUE_ACCOUNT_NOT_FOUND REVENUE_ACCOUNT_ARCHIVED INVALID_AXES AXES_IN_USE CONSUMPTION_LABEL_NOT_FOUND
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED",
"reason": "NOT_FOUND"
}
}

Rate limit exceeded. Wait for Retry-After before retrying.

Media typeapplication/json

Standard error envelope.

object
error
required
object
code
required

Stable machine-readable error code.

string
message
required

Human-readable error message.

string
status
required

HTTP status code, mirrored in the body.

integer
>= -9007199254740991 <= 9007199254740991

Example

{
"error": {
"code": "UNAUTHORIZED"
}
}
RateLimit-Limit
string
/^\d+$/

Maximum requests in the current quota window.

RateLimit-Policy
string

Quota policy in requests and window seconds, for example 60;w=60.

RateLimit-Remaining
string
/^\d+$/

Requests left in this quota window (zero when blocked).

RateLimit-Reset
string
/^\d+$/

Seconds until the current quota window resets, when available from the rate-limit store.

Retry-After
string
/^\d+$/

Seconds until another request may be attempted.