---
agentTools:
  projectIndex: https://payment-orchestrator.readme.io/llms.txt
---

# Execute a Workflow

Executes the workflow identified by the `workflowId` parameter.

The JSON body parameters for this endpoint correspond to the input fields of the particular Scope that the workflow was defined for. For example, if the fields `amount`, `currency` and `reference` are defined as input fields, a workflow using this scope can be executed again by passing

```json
{
  "amount": 100,
  "currency": "EUR",
  "reference": "A reference"
}
```

as body parameters. It may contain additional fields not present in that scope or that have been set as optional.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "version": "v1",
    "title": "Orchestration API",
    "description": "The Orchestration API is a service that executes one or more business rules at runtime according to predefined workflows.\n"
  },
  "servers": [
    {
      "url": "http://sandbox-planet-oapi-269696318.eu-central-1.elb.amazonaws.com:8081/api",
      "description": "Orchestration API - Staging"
    },
    {
      "url": "http://orchestration-api-alb-18064633.eu-west-3.elb.amazonaws.com:8081/api",
      "description": "Orchestration API - Sandbox"
    },
    {
      "url": "http://localhost:8080/api",
      "description": "Orchestration API - Dev"
    }
  ],
  "security": [
    {
      "api-key": []
    }
  ],
  "tags": [
    {
      "name": "WorkflowExecutions",
      "description": "Manage Workflow Executions"
    }
  ],
  "paths": {
    "/v1/workflows/{workflowId}/executions": {
      "post": {
        "tags": [
          "WorkflowExecutions"
        ],
        "operationId": "execute-workflow",
        "summary": "Execute a Workflow",
        "description": "Executes the workflow identified by the `workflowId` parameter.\n",
        "parameters": [
          {
            "name": "workflowId",
            "description": "The identifier of the workflow to execute.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The workflow was executed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowExecutionResponse"
                }
              }
            },
            "headers": {
              "Location": {
                "schema": {
                  "type": "string",
                  "format": "uri",
                  "description": "The location that can be accessed to retrieve the workflow execution."
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowExecutionRequest"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "responses": {
      "BadRequest": {
        "description": "The request is invalid. The specific reason is returned in the response body.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "The requester is not authorized to access the resource.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        },
        "headers": {
          "WWW_Authenticate": {
            "schema": {
              "type": "string"
            }
          }
        }
      },
      "Forbidden": {
        "description": "The requester is forbidden from accessing the resource.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "The request is valid but the server could not process it. The specific reason is returned in the response body.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      },
      "NotFound": {
        "description": "The requested resource was not found.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Problem"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "api-key": {
        "type": "apiKey",
        "name": "API-KEY",
        "in": "header",
        "description": "The API Key to authorize requests."
      }
    },
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "An explanation of the problem that occurred when processing a request [RFC7807].",
        "properties": {
          "type": {
            "type": "string",
            "format": "uri",
            "description": "A URI reference [RFC3986] that identifies the problem type.  This specification encourages that, when dereferenced, it provide human-readable documentation for the problem type (e.g., using HTML [W3C.REC-html5-20141028]).  When this member is not present, its value is assumed to be \"about:blank\".\n",
            "example": "/problems/validation-failed"
          },
          "title": {
            "type": "string",
            "description": "A short, human-readable summary of the problem type.  It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization (e.g., using proactive content negotiation; see [RFC7231], Section 3.4).",
            "example": "The validation for the request has produced errors."
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status code ([RFC7231], Section 6) generated by the origin server for this occurrence of the problem. Optional field.",
            "example": 400
          },
          "detail": {
            "type": "string",
            "description": "A human-readable explanation specific to this occurrence of the problem.",
            "example": "The validation of the request failed on field(s) 'A'."
          },
          "errors": {
            "type": "array",
            "nullable": true,
            "description": "A collection of all errors that occurred when processing the request.",
            "items": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "description": "Represents a single error within the application.",
        "properties": {
          "code": {
            "type": "string",
            "nullable": true,
            "description": "The unique error code.",
            "example": "V1234"
          },
          "message": {
            "type": "string",
            "description": "A human-readable message that states the error.",
            "example": "Field A value must be between 1 and 20."
          }
        }
      },
      "RuleType": {
        "type": "string",
        "enum": [
          "Conditional",
          "Assignment"
        ]
      },
      "Rule": {
        "type": "object",
        "description": "Represents a workflow rule.",
        "required": [
          "type",
          "name"
        ],
        "properties": {
          "type": {
            "$ref": "#/components/schemas/RuleType"
          },
          "name": {
            "type": "string",
            "description": "The rule name. Can be any string.",
            "example": "BeautifulRule"
          }
        },
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "Conditional": "#/components/schemas/ConditionalRule",
            "Assignment": "#/components/schemas/AssignmentRule"
          }
        }
      },
      "ConditionalRule": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Rule"
          },
          {
            "type": "object",
            "description": "Represents a workflow conditional rule.",
            "required": [
              "field",
              "operation",
              "value",
              "onTrueRuleName",
              "onFalseRuleName"
            ],
            "properties": {
              "field": {
                "type": "string",
                "description": "The name of the field to evaluate.",
                "example": "amount"
              },
              "operation": {
                "type": "string",
                "description": "The name of the operation to compare the field and the value.",
                "example": "gt"
              },
              "value": {
                "type": "object",
                "description": "The value to compare the incoming field value to.",
                "example": 200
              },
              "onTrueRuleName": {
                "type": "string",
                "description": "The name of the rule to go to in case the condition is verified.",
                "example": "Rule-A"
              },
              "onFalseRuleName": {
                "type": "string",
                "description": "The name of the rule to go to in case the condition is not verified.",
                "example": "Rule-B"
              }
            }
          }
        ]
      },
      "AssignmentRule": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Rule"
          },
          {
            "type": "object",
            "description": "Represents a workflow output assignment rule.",
            "required": [
              "outputFields"
            ],
            "properties": {
              "outputFields": {
                "type": "array",
                "description": "A list containing the output field assignments. They must conform to the required output fields defined in the scope that the workflow containing this rule targets, meaning that this list must contain all required output fields, but may add additional ones not contained in the related scope.",
                "items": {
                  "type": "object",
                  "title": "OutputFieldAssignment",
                  "required": [
                    "outputFieldPath",
                    "outputFieldValue"
                  ],
                  "properties": {
                    "outputFieldPath": {
                      "type": "string",
                      "description": "The output field path that may be configured in the workflow scope.",
                      "example": "receiver"
                    },
                    "outputFieldValue": {
                      "type": "object",
                      "description": "The output field value to assign.",
                      "example": 1
                    }
                  }
                }
              }
            }
          }
        ]
      },
      "WorkflowExecutionRequest": {
        "type": "object",
        "description": "The request schema for executing the workflow. It must contain all input fields and their respective values set as required as defined in the scope that the workflow identified by `workflowId` targets, and may contain additional fields not present in that scope or that have been set as optional.",
        "example": {
          "amount": 150,
          "reference": "abc123",
          "currency": "EUR",
          "paymentMethod": {
            "name": "Card",
            "info": {
              "brand": "MasterCard"
            }
          }
        },
        "additionalProperties": {
          "type": "object"
        }
      },
      "WorkflowExecutionResponse": {
        "required": [
          "id",
          "timestamp"
        ],
        "properties": {
          "id": {
            "$ref": "#/components/schemas/ExecutionId"
          },
          "timestamp": {
            "type": "string",
            "description": "The exact date and time when this execution happened.",
            "format": "date-time"
          },
          "appliedRules": {
            "type": "array",
            "nullable": true,
            "description": "A collection containing the graph of all traversed rules.",
            "items": {
              "$ref": "#/components/schemas/AppliedRule"
            }
          },
          "input": {
            "description": "The provided input/execution request data.",
            "additionalProperties": {
              "type": "object"
            }
          },
          "output": {
            "description": "The workflow execution result containing all assigned output fields and their respective values.",
            "additionalProperties": {
              "type": "object"
            }
          }
        }
      },
      "AppliedRule": {
        "type": "object",
        "description": "Represents an applied workflow rule, i.e., a rule that was visited.",
        "properties": {
          "rule": {
            "$ref": "#/components/schemas/Rule"
          },
          "outcomes": {
            "type": "array",
            "nullable": true,
            "description": "The rule outcome.",
            "items": {
              "$ref": "#/components/schemas/RuleOutcome"
            }
          }
        }
      },
      "RuleOutcome": {
        "type": "object",
        "description": "The applied rule outcome. It consists of dynamic fields and values depending on the type of rule executed.",
        "required": [
          "key",
          "value"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "ExecutionId": {
        "type": "string",
        "format": "uuid",
        "description": "The workflow execution identifier."
      }
    }
  },
  "x-readme": {
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 99,
      "1": 152,
      "2": 73,
      "3": 33,
      "4": 56,
      "5": 133,
      "6": 176,
      "7": 0,
      "8": 100,
      "9": 168,
      "10": 2,
      "11": 8
    }
  }
}
```