Printago API
POST /v1/routing-rules

Create a routing rule

Add a rule at the end of the store's list The rule is checked against the store's fields first; one that fails returns 400 with `errors` saying why. A store can have at most 100 rules. An enabled rule applies from the next time jobs are matched.

Requires: routingRules.manage

Request Body

The rule's name, `expr` and optional `whenExpr`

RoutingRuleCreateRequest
enabledoptional
boolean
Defaults to true.
exprrequired
object
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
notrequired
object
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]
kindoptional
"require"
Defaults to `require`, the only kind that can be created today.
namerequired
string
whenExproptionalnullable
object
May read the part, SKU, order and order item, never the printer.
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
notrequired
object
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]

Example Request

application/json
{
  "name": "string",
  "enabled": true,
  "kind": "require",
  "whenExpr": {
    "all": []
  },
  "expr": {
    "all": []
  }
}

Response Schema

RoutingRule
createdAtrequired
string
format: date-time
enabledrequired
boolean
exprrequired
object
What must hold for a job the rule applies to and the printer it runs on.
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
notrequired
object
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]
idrequired
string
pattern: ^[a-z0-9]{24}$
kindrequired
"require" | "prefer"
requireprefer
namerequired
string
positionrequired
number
Where the rule sits in the store's list, lowest first.
storeIdrequired
string
pattern: ^[a-z0-9]{24}$
updatedAtrequired
string
format: date-time
whenExprrequirednullable
object
Which jobs the rule applies to. Null applies it to every job.
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
notrequired
object
Variant 1AllExprTrue when every condition in the list is true.
allrequired
object[]
Variant 2AnyExprTrue when at least one condition in the list is true.
anyrequired
object[]
Variant 3NotExprTrue when the condition is false.
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]
Variant 4CmpExprOne field compared with a value or with another field.
cmprequired
enum
in<>contains!=>=<=betweenexists==containsAnycontainsAllisEmptymatches
leftrequired
object
A reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
rightoptional
object
Left out for the operators that take no value: `exists`, `isEmpty`.
Variant 1RefA reference to an attribute on one side of the pairing.
pathrequired
string
Catalog path, e.g. `userTags`, `source`, `custom.batchColor`.
refrequired
"order" | "sku" | "printer" | "part" | "orderItem"
orderskuprinterpartorderItem
Variant 2LiteralA constant literal operand.
constrequired
string | number | boolean | string | number[]

Example Response

201 OK — application/json
{
  "name": "string",
  "enabled": true,
  "kind": "require",
  "position": 1,
  "whenExpr": {
    "all": []
  },
  "expr": {
    "all": []
  },
  "id": "string",
  "storeId": "string",
  "createdAt": "2025-01-15T12:00:00.000Z",
  "updatedAt": "2025-01-15T12:00:00.000Z"
}