> For the complete documentation index, see [llms.txt](https://doc.wearepatchworks.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.wearepatchworks.com/product-documentation/api-reference/flow-actions/flow-routes-and-branches.md).

# Flow Routes & Branches

## List Flow Step Routes

> Retrieves a list of routes (legs) for a specific Route or Branch flow step. The \`flow\_step\` identifier can be obtained from \`GET /api/v1/flow-versions/{flow\_version}/steps\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Flow Routes & Branches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"FlowStepsListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FlowSteps"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"},"links":{"$ref":"#/components/schemas/PaginationLinks"}}},"FlowSteps":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"first_step_id":{"type":"string"},"filter_logic_operator":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"flow_version_id":{"type":"integer"},"name":{"type":"string"},"microservice":{"type":"object"},"config":{"type":"object"},"parent_id":{"type":"object"},"flow_version":{"type":"object"},"children":{"type":"object"},"endpoint":{"type":"object"},"connector":{"type":"array","items":{"type":"object"}},"data_pool":{"type":"array","items":{"type":"object"}},"filters":{"type":"array","items":{"type":"object"}},"parent_flow_step":{"type":"array","items":{"type":"object"}},"routes":{"type":"array","items":{"type":"object"}},"variables":{"type":"array","items":{"type":"object"}},"script_version":{"type":"array","items":{"type":"object"}},"cache":{"type":"array","items":{"type":"object"}},"payloads":{"type":"array","items":{"type":"object"}},"flow":{"type":"object"},"cross_references":{"type":"string"},"notes_count":{"type":"object"},"notification_group":{"type":"object"},"order":{"type":"string"}}},"PaginationMeta":{"type":"object","properties":{"current_page":{"type":"integer"},"from":{"type":"integer","nullable":true},"last_page":{"type":"integer"},"path":{"type":"string"},"per_page":{"type":"integer"},"to":{"type":"integer","nullable":true},"total":{"type":"integer"}}},"PaginationLinks":{"type":"object","properties":{"first":{"type":"string","format":"uri"},"last":{"type":"string","format":"uri"},"prev":{"type":"string","format":"uri","nullable":true},"next":{"type":"string","format":"uri","nullable":true}}}}},"paths":{"/api/v1/flow-steps/{flow_step}/routes":{"get":{"summary":"List Flow Step Routes","description":"Retrieves a list of routes (legs) for a specific Route or Branch flow step. The `flow_step` identifier can be obtained from `GET /api/v1/flow-versions/{flow_version}/steps`.","parameters":[{"name":"flow_step","in":"path","required":true,"schema":{"type":"string"},"description":"The flow step identifier."},{"name":"filter[step_id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by step_id."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: flowStep, filters, firstStep"},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination."},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100},"description":"Number of results per page."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowStepsListResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Flow Routes & Branches"]}}}}
```

## Create Flow Step Route

> Creates a new route (leg) on a Route or Branch flow step. Requires a \`name\`, and optionally accepts a \`first\_step\_id\` and \`filter\_logic\_operator\`. The \`flow\_step\` identifier can be obtained from \`GET /api/v1/flow-versions/{flow\_version}/steps\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Flow Routes & Branches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"FlowStepsResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FlowSteps"}}},"FlowSteps":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"first_step_id":{"type":"string"},"filter_logic_operator":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"flow_version_id":{"type":"integer"},"name":{"type":"string"},"microservice":{"type":"object"},"config":{"type":"object"},"parent_id":{"type":"object"},"flow_version":{"type":"object"},"children":{"type":"object"},"endpoint":{"type":"object"},"connector":{"type":"array","items":{"type":"object"}},"data_pool":{"type":"array","items":{"type":"object"}},"filters":{"type":"array","items":{"type":"object"}},"parent_flow_step":{"type":"array","items":{"type":"object"}},"routes":{"type":"array","items":{"type":"object"}},"variables":{"type":"array","items":{"type":"object"}},"script_version":{"type":"array","items":{"type":"object"}},"cache":{"type":"array","items":{"type":"object"}},"payloads":{"type":"array","items":{"type":"object"}},"flow":{"type":"object"},"cross_references":{"type":"string"},"notes_count":{"type":"object"},"notification_group":{"type":"object"},"order":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"FlowStepsStoreRoutesRequest":{"type":"object","properties":{"first_step_id":{"type":"string","nullable":true},"filter_logic_operator":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":255}},"required":["name"]}}},"paths":{"/api/v1/flow-steps/{flow_step}/routes":{"post":{"summary":"Create Flow Step Route","description":"Creates a new route (leg) on a Route or Branch flow step. Requires a `name`, and optionally accepts a `first_step_id` and `filter_logic_operator`. The `flow_step` identifier can be obtained from `GET /api/v1/flow-versions/{flow_version}/steps`.","parameters":[{"name":"flow_step","in":"path","required":true,"schema":{"type":"string"},"description":"The flow step identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowStepsResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowStepsStoreRoutesRequest"}}}},"tags":["Flow Routes & Branches"]}}}}
```

## Update Flow Step Route

> Updates an existing route (leg) on a Route or Branch flow step. Accepts \`name\`, \`first\_step\_id\`, and \`filter\_logic\_operator\`. The \`flow\_step\` identifier can be obtained from \`GET /api/v1/flow-versions/{flow\_version}/steps\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Flow Routes & Branches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"FlowStepsResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FlowSteps"}}},"FlowSteps":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"first_step_id":{"type":"string"},"filter_logic_operator":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"flow_version_id":{"type":"integer"},"name":{"type":"string"},"microservice":{"type":"object"},"config":{"type":"object"},"parent_id":{"type":"object"},"flow_version":{"type":"object"},"children":{"type":"object"},"endpoint":{"type":"object"},"connector":{"type":"array","items":{"type":"object"}},"data_pool":{"type":"array","items":{"type":"object"}},"filters":{"type":"array","items":{"type":"object"}},"parent_flow_step":{"type":"array","items":{"type":"object"}},"routes":{"type":"array","items":{"type":"object"}},"variables":{"type":"array","items":{"type":"object"}},"script_version":{"type":"array","items":{"type":"object"}},"cache":{"type":"array","items":{"type":"object"}},"payloads":{"type":"array","items":{"type":"object"}},"flow":{"type":"object"},"cross_references":{"type":"string"},"notes_count":{"type":"object"},"notification_group":{"type":"object"},"order":{"type":"string"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"FlowStepsUpdateRoutesRequest":{"type":"object","properties":{"first_step_id":{"type":"string","nullable":true},"filter_logic_operator":{"type":"string"},"name":{"type":"string","minLength":1,"maxLength":255}}}}},"paths":{"/api/v1/flow-steps/{flow_step}/routes/{route}":{"put":{"summary":"Update Flow Step Route","description":"Updates an existing route (leg) on a Route or Branch flow step. Accepts `name`, `first_step_id`, and `filter_logic_operator`. The `flow_step` identifier can be obtained from `GET /api/v1/flow-versions/{flow_version}/steps`.","parameters":[{"name":"flow_step","in":"path","required":true,"schema":{"type":"string"},"description":"The flow step identifier."},{"name":"route","in":"path","required":true,"schema":{"type":"string"},"description":"The route identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowStepsResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowStepsUpdateRoutesRequest"}}}},"tags":["Flow Routes & Branches"]}}}}
```

## Delete Flow Step Route

> Permanently deletes a specific route (leg) from a Route or Branch flow step. The \`flow\_step\` identifier can be obtained from \`GET /api/v1/flow-versions/{flow\_version}/steps\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Flow Routes & Branches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"MessageResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/api/v1/flow-steps/{flow_step}/routes/{route}":{"delete":{"summary":"Delete Flow Step Route","description":"Permanently deletes a specific route (leg) from a Route or Branch flow step. The `flow_step` identifier can be obtained from `GET /api/v1/flow-versions/{flow_version}/steps`.","parameters":[{"name":"flow_step","in":"path","required":true,"schema":{"type":"string"},"description":"The flow step identifier."},{"name":"route","in":"path","required":true,"schema":{"type":"string"},"description":"The route identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Flow Routes & Branches"]}}}}
```

## Order Flow Step Route

> Updates the display order of routes (legs) on a Route or Branch flow step. The \`flow\_step\` identifier can be obtained from \`GET /api/v1/flow-versions/{flow\_version}/steps\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Flow Routes & Branches"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}}}},"paths":{"/api/v1/flow-steps/{flowStep}/routes/order":{"post":{"summary":"Order Flow Step Route","description":"Updates the display order of routes (legs) on a Route or Branch flow step. The `flow_step` identifier can be obtained from `GET /api/v1/flow-versions/{flow_version}/steps`.","parameters":[{"name":"flowStep","in":"path","required":true,"schema":{"type":"string"},"description":"The flowStep identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}},"tags":["Flow Routes & Branches"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.wearepatchworks.com/product-documentation/api-reference/flow-actions/flow-routes-and-branches.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
