# Scheduled Flows

## List Scheduled Flows

> Retrieves a paginated list of scheduled flow runs. Can be filtered by \`status\` and \`flow\_version\_id\`.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Scheduled Flows"}],"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":{"ScheduledFlowsListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ScheduledFlows"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"},"links":{"$ref":"#/components/schemas/PaginationLinks"}}},"ScheduledFlows":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"flow_version_id":{"type":"object"},"flow_version":{"type":"object"},"virtual_environment_version_id":{"type":"object"},"virtual_environment_version":{"type":"object"},"payload_metadata_id":{"type":"object"},"payload_metadata":{"type":"object"},"trigger":{"type":"string","enum":["API","Manual","Router","Webhook","Schedule","Shape","Retry","Event","Callback"]},"status":{"type":"object","enum":["Draft","Inactive","Deployed"]},"flow":{"type":"object"}}},"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/scheduled-flows":{"get":{"summary":"List Scheduled Flows","description":"Retrieves a paginated list of scheduled flow runs. Can be filtered by `status` and `flow_version_id`.","parameters":[{"name":"filter[status]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by status."},{"name":"filter[flow_version_id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by flow_version_id."},{"name":"include","in":"query","required":false,"schema":{"type":"string"},"description":"Comma-separated list of relationships to include. Available: flowVersion, payloadMetadata, flow, virtualEnvironmentVersion, virtualEnvironmentVersion.virtualEnvironment"},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"Sort field. Prefix with - for descending. Available: status, created_at, updated_at, flow_version_id"},{"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/ScheduledFlowsListResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Scheduled Flows"]}}}}
```

## Delete All

> Permanently deletes all scheduled flow runs for the company.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Scheduled Flows"}],"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/scheduled-flows":{"delete":{"summary":"Delete All","description":"Permanently deletes all scheduled flow runs for the company.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Scheduled Flows"],"parameters":[]}}}}
```

## Delete Scheduled Flow

> Permanently deletes all scheduled flow runs for a specific flow.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Scheduled Flows"}],"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/scheduled-flows/{flow}/delete":{"delete":{"summary":"Delete Scheduled Flow","description":"Permanently deletes all scheduled flow runs for a specific flow.","parameters":[{"name":"flow","in":"path","required":true,"schema":{"type":"string"},"description":"The flow identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Scheduled Flows"]}}}}
```

## Delete Scheduled Flow

> Permanently deletes a specific scheduled flow run.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Scheduled Flows"}],"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/scheduled-flows/{scheduled_flow}":{"delete":{"summary":"Delete Scheduled Flow","description":"Permanently deletes a specific scheduled flow run.","parameters":[{"name":"scheduled_flow","in":"path","required":true,"schema":{"type":"string"},"description":"The scheduled flow identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"}},"tags":["Scheduled Flows"]}}}}
```
