Skip to content

Validate a status transition without performing it

POST
/api/v1/orders/{id}/validate-transition
curl --request POST \
--url https://api.dokanmazad.com/api/v1/orders/cmosor2zy000313ny24hgtfy0/validate-transition \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <X-API-Key>' \
--data '{ "targetStatus": "DepositConfirmed" }'
id
required
string

Order CUID

Example
cmosor2zy000313ny24hgtfy0
Media typeapplication/json
object
targetStatus
required

Target status to validate — checks rules without performing the transition

string
Examples
Exampledefault
{
"targetStatus": "DepositConfirmed"
}

Success

Media typeapplication/json
object
success
required
boolean
data
required
meta
object
page
integer
limit
integer
total
integer
totalPages
integer
data
required
object
valid
required

Whether the transition is valid for the current user role and order state

boolean
errors
required

Array of human-readable error messages when valid=false (empty when valid=true)

Array<string>
currentStatus
required

The current status of the order

string
targetStatus
required

The target status that was validated

string
allowedTransitions
required

All valid next statuses from the current state (for the calling role)

Array<string>
missingRequirements

Machine-readable list of unmet prerequisites when valid=false. Each item: { type, code, message }. Empty array when valid=true.

Array
Examples
Examplesuccess
{
"success": true,
"data": {
"valid": true,
"errors": [],
"currentStatus": "DepositSubmitted",
"targetStatus": "DepositConfirmed",
"allowedTransitions": [
"DepositConfirmed",
"Cancelled"
],
"missingRequirements": []
}
}

Unauthorized — missing or invalid API key

Media typeapplication/json
object
success
required
boolean
error
required
string
statusCode
required
integer
Example
{
"success": false
}

Forbidden — route not in this key’s allowedRoutes

Media typeapplication/json
object
success
required
boolean
error
required
string
statusCode
required
integer
Example
{
"success": false
}

Rate limit exceeded

Media typeapplication/json
object
success
required
boolean
error
required
string
statusCode
required
integer
Example
{
"success": false
}
Retry-After
integer

Seconds to wait before retrying