---
title: "Create Workflow"
method: POST
path: "/accounts/{account_id}/workflows"
tags: ["Workflows"]
---

# Create Workflow

`POST /accounts/{account_id}/workflows`

## Request

- Base URL: `https://sandbox.api.lemon.markets/v1`
- URL: `https://sandbox.api.lemon.markets/v1/accounts/{account_id}/workflows`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/lemon/apis/lemon-markets-brokerage-api/docs/accounts/:account_id/workflows/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `account_id` string, required

## Query parameters

- `unified_orders` boolean

## Headers

- `LMG-Data-Privacy-Access-Principal` string, required
- `LMG-Data-Privacy-Access-Justification` string, required

## Request body

- CreateCustomerWorkflowRequest: A request to create a workflow. The trigger and action types must be paired: a <code>schedule</code> trigger requires an <code>order.create_and_confirm</code> action, and a <code>cash_deposited</code> trigger requires an <code>invest_with_allocations</code> action. Any other combination is rejected with a 400.
  - `trigger` union, required: A workflow trigger. This structure represents the way that the workflow is started. The <code>type</code> field selects the trigger: <ul> <li><code>schedule</code>: starts the workflow on a recurring schedule.</li> <li><code>cash_deposited</code>: starts the workflow when cash is deposited into the customer account. It carries no further parameters: the arrival of the deposit is the trigger. Sending <code>cadence</code>, <code>start_after</code>, <code>day_of_month</code> or <code>day_of_week</code> with this trigger is rejected with a 400.</li> </ul>
    - ScheduleTriggerRequest
      - `type` 'schedule', required
      - `cadence` 'monthly' | 'weekly' | 'daily', required: A category describing the cadence for scheduled workflows: <ul> <li><code>daily</code>: Execute every Trading Day (Sandbox-only) <li><code>weekly</code>: Execute weekly on a set day. Use <code>day_of_week</code> to set a custom execution day; otherwise defaults to the first trading day of the week. <li><code>monthly</code>: Execute monthly on a set day. Use <code>day_of_month</code> to set a custom execution day; otherwise defaults to the first trading day of the month. </ul>
      - `start_after` string, date: Block workflow execution until the date specified here. This date specifies the last day that the trigger should not be activated. If you want to block a workflow for July 2025, you can pass 2025-07-31 and the trigger will not be activated before 2025-08-01.
      - `day_of_month` integer: The day of the month on which the workflow executes. Optional; only applicable to a <code>monthly</code> cadence. Valid range 1-31; if the chosen day exceeds the number of days in a month it is clamped to the last day of that month (e.g. 31 in February -> 28/29). If the resolved day falls on a weekend or trading holiday, execution rolls forward to the next trading day. When omitted, the workflow executes on the first trading day of the month.
      - `day_of_week` 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday': The weekday on which the workflow executes. Optional; only applicable to a <code>weekly</code> cadence. If the resolved day falls on a trading holiday, execution rolls forward to the next trading day. When omitted, the workflow executes on the first trading day of the week.
    - CashDepositedTriggerRequest
      - `type` 'cash_deposited', required
  - `action` ActionDataRequest, required: An object representing a workflow action. The nested object matching <code>type</code> is required: <code>order</code> for an <code>order.create_and_confirm</code> action, or <code>invest_with_allocations</code> for an <code>invest_with_allocations</code> action.
    - `type` 'order.create_and_confirm' | 'invest_with_allocations', required: A category representing a workflow action type: <ul> <li><code>order.create_and_confirm</code> <li><code>invest_with_allocations</code>: Invest deposited cash across a set of instruments by the configured percentages. </ul>
    - `order` OrderDataRequest: An object describing an order to be created as the result of a workflow action.
      - `type` 'batch', required: The order type for a scheduled workflow. Only <code>batch</code> is supported: orders created by workflows are collected across customers and executed as one composite order. (Market orders are not available for scheduled workflows.)
      - `side` 'buy' | 'sell', required: A category to represent the side of a customer's order: <ul> <li><code>buy</code>: Buy shares of an instrument and pay with cash. <li><code>sell</code>: Sell shares of an instrument and receive cash. </ul>
      - `instrument` string, required: An ISIN (International Securities Identification Number) according to ISO 6166. The ISIN specifies the instrument for the order.
      - `securities_account` string: A securities account identifier. Use this property to specify the securities account for order execution and settlement. If the customer has only one securities account, this property is optional. If the customer has more than one securities account, this property is required.
      - `amount` string, number, required: The amount of money to invest with each order.
      - `fee` string, number, required: The fee that will be charged by lemon.markets on your behalf.
      - `currency` string, required: An ISO 4217 three-letter currency code. Its value represents the currency for the `fee`, `fees.base_amount` and `amount` listed here. The only currently available currency is `"EUR"`.
    - `invest_with_allocations` InvestWithAllocationsDataRequest: An object describing how deposited cash is invested across a set of instruments. <strong>Note:</strong> This is the first iteration of this action. Invest workflows can be created, confirmed, cancelled and retrieved, but deposits do not yet trigger investments automatically; this will be enabled in a later release. The action does not yet provide the PRIIPs KIDs or ex-ante cost information of the allocated instruments, so the response has no <code>regulatory_disclosures</code>; a future iteration will add links to the relevant KID documents.
      - `securities_account` string: A securities account identifier. Use this property to specify the securities account the allocation applies to. If the customer has only one securities account, this property is optional. If the customer has more than one securities account, this property is required. The securities account must belong to a retirement product with an active product contract; otherwise the request is rejected with a 422.
      - `allocations` InvestmentAllocation[], required: The instruments and their percentage shares of each deposit. ISINs must be unique and the <code>allocation_pct</code> values must sum to exactly 100. Every ISIN must be an active instrument of the securities account's product contract; otherwise the request is rejected with a 422 listing the ISINs that are not available.
        - `isin` string, required: An ISIN (International Securities Identification Number) according to ISO 6166. The ISIN specifies the instrument that receives this share of each deposit.
        - `allocation_pct` string, number, required: The share of each deposit allocated to this instrument; specified in whole percentage points from "1.00" to "100.00" (<code>"60.00"</code> means 60%). The <code>allocation_pct</code> values of all allocations must sum to exactly "100.00".

## Response `201`

Successful Response

- CustomerWorkflowResponse
  - `id` string, required: A value identifiying the workflow.
  - `trigger` union, required
    - ScheduleTriggerResponse
      - `type` 'schedule', required
      - `cadence` 'monthly' | 'weekly' | 'daily', required: A category describing the cadence for scheduled workflows: <ul> <li><code>daily</code>: Execute every Trading Day (Sandbox-only) <li><code>weekly</code>: Execute weekly on a set day. Use <code>day_of_week</code> to set a custom execution day; otherwise defaults to the first trading day of the week. <li><code>monthly</code>: Execute monthly on a set day. Use <code>day_of_month</code> to set a custom execution day; otherwise defaults to the first trading day of the month. </ul>
      - `start_after` string, date: Block workflow execution until the date specified here. This date specifies the last day that the trigger should not be activated. If you want to block a workflow for July 2025, you can pass 2025-07-31 and the trigger will not be activated before 2025-08-01.
      - `next_run_date` string, date: The next scheduled execution date for this workflow (adjusted for non-trading days). Calculated when the workflow is confirmed; omitted for workflows in <code>created</code> status.
      - `day_of_month` integer: The day of the month on which the workflow executes. Optional; only applicable to a <code>monthly</code> cadence. Valid range 1-31; if the chosen day exceeds the number of days in a month it is clamped to the last day of that month (e.g. 31 in February -> 28/29). If the resolved day falls on a weekend or trading holiday, execution rolls forward to the next trading day. When omitted, the workflow executes on the first trading day of the month.
      - `day_of_week` 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday': The weekday on which the workflow executes. Optional; only applicable to a <code>weekly</code> cadence. If the resolved day falls on a trading holiday, execution rolls forward to the next trading day. When omitted, the workflow executes on the first trading day of the week.
    - CashDepositedTriggerResponse
      - `type` 'cash_deposited', required
  - `action` ActionDataResponse, required: An object representing a workflow action. The nested object matching <code>type</code> is present: <code>order</code> for an <code>order.create_and_confirm</code> action, or <code>invest_with_allocations</code> for an <code>invest_with_allocations</code> action.
    - `type` 'order.create_and_confirm' | 'invest_with_allocations', required: A category representing a workflow action type: <ul> <li><code>order.create_and_confirm</code> <li><code>invest_with_allocations</code>: Invest deposited cash across a set of instruments by the configured percentages. </ul>
    - `order` OrderDataResponse: An object describing an order to be created as the result of a workflow action.
      - `type` 'batch', required: The order type for a scheduled workflow. Only <code>batch</code> is supported: orders created by workflows are collected across customers and executed as one composite order. (Market orders are not available for scheduled workflows.)
      - `side` 'buy' | 'sell', required: A category to represent the side of a customer's order: <ul> <li><code>buy</code>: Buy shares of an instrument and pay with cash. <li><code>sell</code>: Sell shares of an instrument and receive cash. </ul>
      - `instrument` string, required: An ISIN (International Securities Identification Number) according to ISO 6166. The ISIN specifies the instrument for the order.
      - `securities_account` string: A securities account identifier. Use this property to specify the securities account for order execution and settlement. If the customer has only one securities account, this property is optional. If the customer has more than one securities account, this property is required.
      - `amount` string, number, required: The amount of money to invest with each order.
      - `fee` string, number, required: The fee that will be charged by lemon.markets on your behalf.
      - `currency` string, required: An ISO 4217 three-letter currency code. Its value represents the currency for the `fee`, `fees.base_amount` and `amount` listed here. The only currently available currency is `"EUR"`.
    - `invest_with_allocations` InvestWithAllocationsDataResponse: An object describing how deposited cash is invested across a set of instruments. <strong>Note:</strong> This is the first iteration of this action. Invest workflows can be created, confirmed, cancelled and retrieved, but deposits do not yet trigger investments automatically; this will be enabled in a later release. The action does not yet provide the PRIIPs KIDs or ex-ante cost information of the allocated instruments, so the response has no <code>regulatory_disclosures</code>; a future iteration will add links to the relevant KID documents.
      - `securities_account` string, required: The securities account identifier the allocation applies to.
      - `allocations` InvestmentAllocation[], required: The current instruments and their percentage shares of each deposit.
        - `isin` string, required: An ISIN (International Securities Identification Number) according to ISO 6166. The ISIN specifies the instrument that receives this share of each deposit.
        - `allocation_pct` string, number, required: The share of each deposit allocated to this instrument; specified in whole percentage points from "1.00" to "100.00" (<code>"60.00"</code> means 60%). The <code>allocation_pct</code> values of all allocations must sum to exactly "100.00".
  - `regulatory_disclosures` BrokerAppsApiEndpointsCustomerWorkflowsRegulatoryDisclosureResponse
    - `kid` string
    - `estimated_price` string, required
    - `estimated_quantity` string, required
    - `estimated_amount` string, required
    - `service_costs_total` string, required
    - `service_costs_total_pct` string, required
    - `entry_costs` string, required
    - `entry_costs_pct` string, required
    - `third_party_grants` string, required
    - `third_party_grants_pct` string, required
    - `acquisition_costs` string, required
    - `acquisition_costs_pct` string, required
    - `custody_costs` string, required
    - `custody_costs_pct` string, required
    - `product_costs` string, required
    - `product_costs_pct` string, required
    - `running_costs` string, required
    - `running_costs_pct` string, required
    - `exit_costs` string, required
    - `exit_costs_pct` string, required
    - `impact_first_year` string, required
    - `impact_first_year_pct` string, required
    - `impact_subsequent_year` string, required
    - `impact_subsequent_year_pct` string, required
    - `impact_final_year` string, required
    - `impact_final_year_pct` string, required
    - `recurring_impact_year_1` string, required
    - `recurring_impact_year_1_pct` string, required
    - `recurring_impact_year_2` string, required
    - `recurring_impact_year_2_pct` string, required
    - `recurring_impact_year_3` string, required
    - `recurring_impact_year_3_pct` string, required
    - `recurring_impact_year_4` string, required
    - `recurring_impact_year_4_pct` string, required
    - `recurring_impact_year_5` string, required
    - `recurring_impact_year_5_pct` string, required
    - `recurring_impact_total` string, required
    - `recurring_impact_total_pct` string, required
  - `sca` SCAResponse
    - `required` boolean, required
    - `challenge` string, required
  - `appropriateness_consent` AppropriatenessConsentResponse: An object representing the requirements for explicit confirmation of an appropriateness warning.
    - `required` boolean, required: Requirement indicator for the appropriateness warning. **NOTE:** If this value is `true`, the frontend must present a warning to the user as outlined in your onboarding documentation.
  - `history` StatusChangeCustomerWorkflowStatus[], required
    - `status` 'canceled' | 'confirmed' | 'created', required: A category representing a workflow status: <ul> <li><code>canceled</code> <li><code>confirmed</code> <li><code>created</code> </ul>
    - `timestamp` string, date-time, required: The timestamp of the event. It represents the point in time at which the workflow was updated.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `404`: Not Found
- `422`: Unprocessable Entity
- `5XX`: Server Error

## Changes

- **2026-11-03** `1f1df208c0e4`: 7 breaking, 5 warning, 8 info
  - removed the enum value `batch_order.create_and_confirm` of the request property `action/type`
  - the `trigger` request property type changed from `object` to no type
  - the response property `action/order` became optional for the status `201`
  - added `#/components/schemas/ScheduleTriggerResponse, #/components/schemas/CashDepositedTriggerResponse` to the `trigger` response property `oneOf` list for the response status `201`
  - …16 more

[Operation history](https://skmtc.dev/lemon/apis/lemon-markets-brokerage-api/changes/accounts/:account_id/workflows/post.md)

---

[API](https://skmtc.dev/lemon/apis/lemon-markets-brokerage-api.md) - [All operations](https://skmtc.dev/lemon/apis/lemon-markets-brokerage-api/llms.txt) - [OpenAPI document](https://skmtc.dev/lemon/apis/lemon-markets-brokerage-api/revisions/1f1df208c0e4?raw)
