← All operations
POST/api/v1/admin/orders/{orderId}/actions

Commerce_AdminCommerceOrderAction

Authentication
required-admin
Cache policy
none
Success and errors
202, 400, 401, 403, 404, 409, 500, 503
Stability
v1 stable contract

OpenAPI operation

{
  "operationId": "Commerce_AdminCommerceOrderAction",
  "summary": "POST /api/v1/admin/orders/{orderId}/actions",
  "tags": [
    "Commerce"
  ],
  "parameters": [
    {
      "name": "orderId",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid",
        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
      }
    },
    {
      "name": "Idempotency-Key",
      "in": "header",
      "required": true,
      "schema": {
        "type": "string",
        "format": "uuid"
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "action": {
              "type": "string",
              "enum": [
                "GRANT",
                "CANCEL",
                "RECONCILE",
                "REFUND"
              ]
            },
            "expectedVersion": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "reason": {
              "type": "string",
              "minLength": 10,
              "maxLength": 4000
            },
            "dryRun": {
              "default": true,
              "type": "boolean"
            },
            "confirmation": {
              "type": "string",
              "maxLength": 300
            }
          },
          "required": [
            "action",
            "expectedVersion",
            "reason"
          ],
          "additionalProperties": false
        }
      }
    }
  },
  "security": [
    {
      "cookieAuth": []
    }
  ],
  "responses": {
    "202": {
      "description": "Success",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "data",
              "meta"
            ],
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "GRANT",
                      "CANCEL",
                      "RECONCILE",
                      "REFUND"
                    ]
                  },
                  "currentState": {
                    "type": "string",
                    "enum": [
                      "CREATED",
                      "PAYMENT_PENDING",
                      "PAYMENT_OBSERVED",
                      "PAID",
                      "FULFILLMENT_PENDING",
                      "ACTIVE",
                      "COMPLETED",
                      "EXPIRED",
                      "CANCELLED",
                      "REFUND_PENDING",
                      "REFUNDED",
                      "MANUAL_REVIEW"
                    ]
                  },
                  "proposedState": {
                    "type": "string",
                    "enum": [
                      "CREATED",
                      "PAYMENT_PENDING",
                      "PAYMENT_OBSERVED",
                      "PAID",
                      "FULFILLMENT_PENDING",
                      "ACTIVE",
                      "COMPLETED",
                      "EXPIRED",
                      "CANCELLED",
                      "REFUND_PENDING",
                      "REFUNDED",
                      "MANUAL_REVIEW"
                    ]
                  },
                  "currentVersion": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "confirmation": {
                    "type": "string"
                  },
                  "applied": {
                    "type": "boolean"
                  },
                  "order": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "orderNumber": {
                        "type": "string"
                      },
                      "state": {
                        "type": "string",
                        "enum": [
                          "CREATED",
                          "PAYMENT_PENDING",
                          "PAYMENT_OBSERVED",
                          "PAID",
                          "FULFILLMENT_PENDING",
                          "ACTIVE",
                          "COMPLETED",
                          "EXPIRED",
                          "CANCELLED",
                          "REFUND_PENDING",
                          "REFUNDED",
                          "MANUAL_REVIEW"
                        ]
                      },
                      "version": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "workspacePublicId": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "agentPublicId": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "productCode": {
                        "type": "string"
                      },
                      "productName": {
                        "type": "string"
                      },
                      "networkPublicId": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "network": {
                        "type": "string"
                      },
                      "assetId": {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      "symbol": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "decimals": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 255
                      },
                      "subtotalUnits": {
                        "type": "string",
                        "pattern": "^(?:0|[1-9][0-9]{0,77})$"
                      },
                      "discountUnits": {
                        "type": "string",
                        "pattern": "^(?:0|[1-9][0-9]{0,77})$"
                      },
                      "totalUnits": {
                        "type": "string",
                        "pattern": "^(?:0|[1-9][0-9]{0,77})$"
                      },
                      "holderBenefit": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "decisionId": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "uuid",
                                    "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "benefitPolicyVersion": {
                                "anyOf": [
                                  {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "tierPolicyVersion": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "tierCode": {
                                "type": "string"
                              },
                              "multiplierPpm": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 10000000
                              },
                              "discountBps": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9999
                              }
                            },
                            "required": [
                              "decisionId",
                              "benefitPolicyVersion",
                              "tierPolicyVersion",
                              "tierCode",
                              "multiplierPpm",
                              "discountBps"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "termsVersion": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "policyVersion": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "payments": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "rail": {
                              "type": "string",
                              "enum": [
                                "ONCHAIN",
                                "X402",
                                "HELIO",
                                "ADMIN"
                              ]
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "CREATED",
                                "PENDING",
                                "OBSERVED",
                                "CONFIRMED",
                                "FAILED",
                                "EXPIRED",
                                "REFUND_PENDING",
                                "REFUNDED",
                                "MANUAL_REVIEW"
                              ]
                            },
                            "units": {
                              "type": "string",
                              "pattern": "^(?:0|[1-9][0-9]{0,77})$"
                            },
                            "transactionIntentPublicId": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "uuid",
                                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "transactionHash": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "expiresAt": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\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))$"
                            }
                          },
                          "required": [
                            "id",
                            "rail",
                            "state",
                            "units",
                            "transactionIntentPublicId",
                            "transactionHash",
                            "expiresAt"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "entitlements": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "format": "uuid",
                              "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                            },
                            "code": {
                              "type": "string"
                            },
                            "state": {
                              "type": "string",
                              "enum": [
                                "ACTIVE",
                                "GRACE",
                                "EXPIRED",
                                "REVOKED"
                              ]
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "ORDER",
                                "SUBSCRIPTION",
                                "STAKE_TIER",
                                "ADMIN"
                              ]
                            },
                            "effectiveFrom": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\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))$"
                            },
                            "effectiveUntil": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\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))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "policyVersion": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "id",
                            "code",
                            "state",
                            "source",
                            "effectiveFrom",
                            "effectiveUntil",
                            "policyVersion"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "paidAt": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\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))$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "activatedAt": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\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))$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "expiresAt": {
                        "anyOf": [
                          {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\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))$"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "createdAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\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))$"
                      },
                      "updatedAt": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\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))$"
                      }
                    },
                    "required": [
                      "id",
                      "orderNumber",
                      "state",
                      "version",
                      "workspacePublicId",
                      "agentPublicId",
                      "productCode",
                      "productName",
                      "networkPublicId",
                      "network",
                      "assetId",
                      "symbol",
                      "decimals",
                      "subtotalUnits",
                      "discountUnits",
                      "totalUnits",
                      "holderBenefit",
                      "termsVersion",
                      "policyVersion",
                      "payments",
                      "entitlements",
                      "paidAt",
                      "activatedAt",
                      "expiresAt",
                      "createdAt",
                      "updatedAt"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "action",
                  "currentState",
                  "proposedState",
                  "currentVersion",
                  "confirmation",
                  "applied",
                  "order"
                ],
                "additionalProperties": false
              },
              "meta": {
                "type": "object",
                "additionalProperties": true,
                "required": [
                  "requestId",
                  "schemaVersion",
                  "buildVersion",
                  "generatedAt",
                  "freshness"
                ],
                "properties": {
                  "requestId": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "schemaVersion": {
                    "type": "string"
                  },
                  "buildVersion": {
                    "type": "string"
                  },
                  "generatedAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "freshness": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                      "projectedAt",
                      "sourceWatermark"
                    ],
                    "properties": {
                      "projectedAt": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "format": "date-time"
                      },
                      "sourceWatermark": {
                        "type": [
                          "string",
                          "null"
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "invalid request",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "401": {
      "description": "unauthenticated",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "403": {
      "description": "forbidden",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "404": {
      "description": "not found",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "409": {
      "description": "conflict",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "500": {
      "description": "internal error",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    },
    "503": {
      "description": "dependency unavailable",
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/ApiError"
          }
        }
      }
    }
  },
  "x-auth-mode": "required-admin",
  "x-cache-policy": "none",
  "x-required-scopes": [],
  "x-rate-cost": 1,
  "x-stability": "STABLE"
}