Skip to main content
POST
Create order type

Authorizations

Authorization
string
header
required

Use a valid Bearer token to authenticate.

Body

application/json
name
string
required

Name of the order type, unique in the organization. Max 100 characters. Example: Express Delivery

code
string
required

Short code, 1-10 uppercase letters or digits, unique in the organization. Cannot change once the order type has orders. Example: EXP

description
string
fields
object[]

List of order fields. The first field is the order number: it must be type text or number, and it is always required and unique within the order type. Each field: id (letters, digits, _, -), title, type, and optional description, required, show, unique, default, archived. type is one of text, number, option, date, dateTime, time, phoneNumber, geolocation, reference, lineItems, user, boolean. Type-specific keys: maxLength (text, phoneNumber), min/max (number, date, dateTime, time), options (option, list of unique strings), reference (reference), columns (lineItems).

statuses
object[]

List of order statuses. Each status: id, label, category, order (integer), and optional color, publicLabel, viewAccess ({ "roles": [roleId] }, empty means every role). category is one of new, inProgress, completed. Exactly one status must be new and at least one must be completed before the order type can be published.

configuration
object

Order type configuration: cancelStatusId (a status of category completed used by Cancel order; null when cancelling is not allowed) and uniqueBy (derived from the first field on save).

orderSteps
object[]

The order steps graph, at most 200 steps. Every step has id (lowercase letters, digits and -, max 40 characters), type, title (max 80 characters), position ({ x, y }) and next (port name to list of step ids; not used on finishOrder). Step type:

  • trigger: event is onOrderCreated or onTaskFinished. For onTaskFinished also taskTypeId (the task type, flowId, whose finished tasks create orders), onlyIf, quantity (mode perTask or perRow) and mapping.
  • createTask: taskTypeId (task type, flowId), assignee (mode unassigned, user or field), hub (mode order or fixed), quantity (mode perOrder or perRow), taskData, saveToOrder, retry (maxAttempts 1-10).
  • condition: rules (max 20 rules, max 20 conditions each; operators eq, neq, gt, gte, lt, lte, contains, isEmpty). Each rule is a port rule:.
  • updateOrder: set (mapping rows) and status (mode fixed or map).
  • finishOrder: statusId.
  • callWebhook: request (url, method POST or PUT, headers, timeoutSec 1-30, body with mode order or template) and saveResponse. Ports success and failed. Secret header values are never returned (value: null, hasValue: true). Mapping rows (max 50) are { target, source }; a source is { "value": ... } or { "ref": "$..." }.

Response

Created

status
boolean

Status of response.

message
string

Message of API response.

data
object

Detail of the created order type.