# Update Flows

## Create Update Flow

> Creates an update flow in JFrog Connect. When this request completes successfully, the update flow is visible in the web UI and can be deployed either from the web UI or by using the Deploy Update request in the Connect API.\
> \
> \*\*Important\*\*: The Body of this request must be sent in YAML format. Note that the example Body of this request might be shown in JSON format in your tool for sending API requests. Regardless, the Body you send with the request must be in YAML format.<br>

```json
{"openapi":"3.0.0","info":{"title":"Update Flows API","version":"1.0.0"},"servers":[{"url":"https://api.connect.jfrog.io"}],"paths":{"/api/v2/{project_key}/update-flows":{"post":{"summary":"Create Update Flow","operationId":"createUpdateFlow","description":"Creates an update flow in JFrog Connect. When this request completes successfully, the update flow is visible in the web UI and can be deployed either from the web UI or by using the Deploy Update request in the Connect API.\n\n**Important**: The Body of this request must be sent in YAML format. Note that the example Body of this request might be shown in JSON format in your tool for sending API requests. Regardless, the Body you send with the request must be in YAML format.\n","parameters":[{"name":"project_key","in":"path","required":true,"description":"The fleet key of the relevant fleet in the account. An account can have multiple fleets (formerly called projects). If you don't know the fleet key, you can find it in the Fleet Settings of the web UI.","schema":{"type":"string"}}],"requestBody":{"description":"YAML payload to create an update flow. Must be in YAML format.","required":true,"content":{"application/yaml":{"schema":{"$ref":"#/components/schemas/UpdateFlowBody"}}}},"responses":{"201":{"description":"Update flows created successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"update_flows":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"uuid":{"type":"string","format":"uuid"}}}}}}}}},"400":{"description":"Bad Request - Invalid YAML format or data.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}},"415":{"description":"Unsupported Media Type - Content-Type must be application/yaml.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"},"message":{"type":"string"}}}}}}}}}},"components":{"schemas":{"UpdateFlowBody":{"type":"object","properties":{"flows":{"type":"object","description":"Object containing the configurations of update flows to be created, including the individual steps. Available step types include: \n\n**Run Command**\n\n**Deploy Docker Image**\n\n**Download Artifact**\n","additionalProperties":{"type":"object","properties":{"reboot-after-restart":{"type":"boolean","description":"Commands the device to reboot after the software update is finished. Same as 'Reboot after Update' in the web UI.","default":false},"steps":{"type":"array","description":"The steps that make up the update flow.","items":{"oneOf":[{"type":"object","description":"**Deploy Docker Image**\n\nChoose this object when you want to use a Deploy Docker Image step.\n","properties":{"name":{"description":"A user-defined name for the update step.","type":"string"},"uses":{"type":"string","description":"The Connect step type to be used in the step. In this case it should be \"connect/docker\"","enum":["connect/docker"]},"with":{"type":"object","description":"Object containing the configuration parameters for the step.","properties":{"registry":{"description":"The registry where your Docker image resides.","type":"string"},"image-path":{"description":"This is the unique path and file name where the container image is located. For example: platform-URL/base-repo/docker-repo/docker-image","type":"string"},"image-tag":{"description":"A tag used in Artifactory. See Get Artifactory Parameters in the user documentation.","type":"string"},"run-options":{"description":"You can add run options here. This is the same as the Run Options feature in the web UI. If you want to add more run options, add them under additionalProperties below.","type":"object","properties":{"restart":{"type":"string"},"attach":{"type":"string"}},"additionalProperties":true},"command":{"description":"You can add a Docker command to run in the Docker image.","type":"string"},"delete-previous-image":{"description":"Deletes the previous Docker image when this is set to true.","type":"boolean","default":false},"on-failure":{"type":"object","description":"Instructions in case the update fails.","properties":{"trigger-revert":{"type":"string","description":"Determines when the revert action should be triggered if the update fails.\n- `this-step-failure`: Revert is triggered only if this specific step fails.\n- `any-step-failure`: Revert is triggered if any step in the update flow fails.\n","enum":["this-step-failure","any-step-failure"]},"revert-all-files":{"type":"boolean","description":"Delete images upon rollback"}}}},"required":["registry","image-path","image-tag"]}},"required":["name","uses","with"]},{"type":"object","description":"**Run Command**\n\nChoose this object when you want to use the Run Command step type. The command must be a single line. If you want to run multiple commands, they must be separated by a semicolon.\n","properties":{"name":{"type":"string","description":"A user-defined name for the update step."},"run":{"type":"string","description":"The shell command to run."}},"required":["name","run"]},{"type":"object","description":"**Download Artifact**\n\nChoose this object when you want to use a Download Artifact step.\n","properties":{"name":{"description":"A user-defined name for the update step.","type":"string"},"uses":{"type":"string","description":"The Connect step type to be used in the step. In this case it should be \"connect/download-artifact\".","enum":["connect/download-artifact"]},"with":{"type":"object","description":"Object containing the configuration parameters for the step.","properties":{"registry":{"description":"The registry where your artifacts reside.","type":"string"},"artifactory-path":{"description":"This is the unique path and file name where the artifact is located. For example: base-repo/file.txt","type":"string"},"device-path":{"description":"A path in the device to download the artifact to.","type":"string"},"on-failure":{"type":"object","description":"Instructions in case the update fails.","properties":{"trigger-revert":{"type":"string","description":"Determines when the revert action should be triggered if the update fails.\n- `this-step-failure`: Revert is triggered only if this specific step fails.\n- `any-step-failure`: Revert is triggered if any step in the update flow fails.\n","enum":["this-step-failure","any-step-failure"]},"revert-all-files":{"type":"boolean","description":"Delete files upon rollback"}}}},"required":["registry","artifactory-path","device-path"]}},"required":["name","uses","with"]}]}}},"required":["steps"]}},"on":{"type":"object","properties":{"workflow-dispatch":{"type":"object","properties":{"inputs":{"type":"object","description":"If you parameterized any of the configuration items in the workflow, list the parameters here as shown in the example body text. For example, if you used {{input-name}}, then 'input-name' must be listed here. You can list several parameters under inputs.","additionalProperties":{"type":"object"}}},"required":["inputs"]}},"required":["workflow-dispatch"]}},"required":["flows","on"]}}}}
```

## Get List of Update Flows

> Gets all update flows for a fleet. Each update flow returned includes the name, UUID, update parameters (if any), time created, and CVE severities of any security issues detected.

```json
{"openapi":"3.0.0","info":{"title":"Update Flows API","version":"1.0.0"},"servers":[{"url":"https://api.connect.jfrog.io"}],"paths":{"/api/v2/{project_key}/update-flows":{"get":{"summary":"Get List of Update Flows","description":"Gets all update flows for a fleet. Each update flow returned includes the name, UUID, update parameters (if any), time created, and CVE severities of any security issues detected.","operationId":"getAllUpdateFlows","tags":["Update Flows"],"parameters":[{"name":"project_key","in":"path","required":true,"description":"The fleet key of the relevant fleet in the account. An account can have multiple fleets (formerly called projects). If you don't know the fleet key, you can find it in the Fleet Settings of the web UI.","schema":{"type":"string"}},{"name":"limit","in":"query","description":"The maximum number of records to return.","schema":{"type":"integer","format":"int32","minimum":1,"maximum":1000,"default":100}},{"name":"after","in":"query","description":"The cursor to use for pagination. Returns the next set (i.e., next cursor) of records. This is applicable whenever the number of records to be returned is greater than the limit. For example, if the first cursor returned the limit of 100 records, this parameter is required to receive the next 100 records. The value of the input string can be found in the output of the current cursor.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully retrieved all update flows.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAllUpdateFlowsResponse"}}}},"401":{"description":"Unauthorized - API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"GetAllUpdateFlowsResponse":{"type":"object","properties":{"status":{"type":"string"},"update_flows":{"type":"array","items":{"$ref":"#/components/schemas/UpdateFlowItem"}}}},"UpdateFlowItem":{"type":"object","properties":{"name":{"type":"string","description":"Name of the update flow."},"uuid":{"type":"string","format":"uuid","description":"Unique identifier for the update flow."},"update_parameters":{"type":"array","items":{"type":"string"},"description":"List of update parameters associated with the update flow."},"created_time":{"type":"string","format":"date-time","description":"Timestamp of when the update flow was created."},"cve_severity":{"type":"string","description":"CVE severity information, if available."}}},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"error":{"type":"string"}}}}}}
```

## Get Update Flow YAML

> Returns the YAML definition of the update flow that you specify. The request returns a YAML only for update flows that were created by sending a YAML with the Create Update Flow API request. No data is returned for update flows created with the web UI.<br>

```json
{"openapi":"3.0.0","info":{"title":"Update Flows API","version":"1.0.0"},"servers":[{"url":"https://api.connect.jfrog.io"}],"paths":{"/api/v2/{project_key}/update-flows/{update_flow_uuid}":{"get":{"summary":"Get Update Flow YAML","description":"Returns the YAML definition of the update flow that you specify. The request returns a YAML only for update flows that were created by sending a YAML with the Create Update Flow API request. No data is returned for update flows created with the web UI.\n","parameters":[{"name":"project_key","in":"path","required":true,"description":"The fleet key of the relevant fleet in the account. An account can have multiple fleets (formerly called projects). If you don't know the fleet key, you can find it in the Fleet Settings of the web UI.","schema":{"type":"string"}},{"name":"update_flow_uuid","in":"path","required":true,"description":"The UUID identifying the update flow.","schema":{"type":"string"}}],"responses":{"200":{"description":"Update flow YAML retrieved successfully.","content":{"application/yaml":{"schema":{"$ref":"#/components/schemas/UpdateFlowBody"}}}},"401":{"description":"Unauthorized - API key is missing or invalid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden - Insufficient permissions.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"No Found - Update flow with uuid / yaml not found.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"UpdateFlowBody":{"type":"object","properties":{"flows":{"type":"object","description":"Object containing the configurations of update flows to be created, including the individual steps. Available step types include: \n\n**Run Command**\n\n**Deploy Docker Image**\n\n**Download Artifact**\n","additionalProperties":{"type":"object","properties":{"reboot-after-restart":{"type":"boolean","description":"Commands the device to reboot after the software update is finished. Same as 'Reboot after Update' in the web UI.","default":false},"steps":{"type":"array","description":"The steps that make up the update flow.","items":{"oneOf":[{"type":"object","description":"**Deploy Docker Image**\n\nChoose this object when you want to use a Deploy Docker Image step.\n","properties":{"name":{"description":"A user-defined name for the update step.","type":"string"},"uses":{"type":"string","description":"The Connect step type to be used in the step. In this case it should be \"connect/docker\"","enum":["connect/docker"]},"with":{"type":"object","description":"Object containing the configuration parameters for the step.","properties":{"registry":{"description":"The registry where your Docker image resides.","type":"string"},"image-path":{"description":"This is the unique path and file name where the container image is located. For example: platform-URL/base-repo/docker-repo/docker-image","type":"string"},"image-tag":{"description":"A tag used in Artifactory. See Get Artifactory Parameters in the user documentation.","type":"string"},"run-options":{"description":"You can add run options here. This is the same as the Run Options feature in the web UI. If you want to add more run options, add them under additionalProperties below.","type":"object","properties":{"restart":{"type":"string"},"attach":{"type":"string"}},"additionalProperties":true},"command":{"description":"You can add a Docker command to run in the Docker image.","type":"string"},"delete-previous-image":{"description":"Deletes the previous Docker image when this is set to true.","type":"boolean","default":false},"on-failure":{"type":"object","description":"Instructions in case the update fails.","properties":{"trigger-revert":{"type":"string","description":"Determines when the revert action should be triggered if the update fails.\n- `this-step-failure`: Revert is triggered only if this specific step fails.\n- `any-step-failure`: Revert is triggered if any step in the update flow fails.\n","enum":["this-step-failure","any-step-failure"]},"revert-all-files":{"type":"boolean","description":"Delete images upon rollback"}}}},"required":["registry","image-path","image-tag"]}},"required":["name","uses","with"]},{"type":"object","description":"**Run Command**\n\nChoose this object when you want to use the Run Command step type. The command must be a single line. If you want to run multiple commands, they must be separated by a semicolon.\n","properties":{"name":{"type":"string","description":"A user-defined name for the update step."},"run":{"type":"string","description":"The shell command to run."}},"required":["name","run"]},{"type":"object","description":"**Download Artifact**\n\nChoose this object when you want to use a Download Artifact step.\n","properties":{"name":{"description":"A user-defined name for the update step.","type":"string"},"uses":{"type":"string","description":"The Connect step type to be used in the step. In this case it should be \"connect/download-artifact\".","enum":["connect/download-artifact"]},"with":{"type":"object","description":"Object containing the configuration parameters for the step.","properties":{"registry":{"description":"The registry where your artifacts reside.","type":"string"},"artifactory-path":{"description":"This is the unique path and file name where the artifact is located. For example: base-repo/file.txt","type":"string"},"device-path":{"description":"A path in the device to download the artifact to.","type":"string"},"on-failure":{"type":"object","description":"Instructions in case the update fails.","properties":{"trigger-revert":{"type":"string","description":"Determines when the revert action should be triggered if the update fails.\n- `this-step-failure`: Revert is triggered only if this specific step fails.\n- `any-step-failure`: Revert is triggered if any step in the update flow fails.\n","enum":["this-step-failure","any-step-failure"]},"revert-all-files":{"type":"boolean","description":"Delete files upon rollback"}}}},"required":["registry","artifactory-path","device-path"]}},"required":["name","uses","with"]}]}}},"required":["steps"]}},"on":{"type":"object","properties":{"workflow-dispatch":{"type":"object","properties":{"inputs":{"type":"object","description":"If you parameterized any of the configuration items in the workflow, list the parameters here as shown in the example body text. For example, if you used {{input-name}}, then 'input-name' must be listed here. You can list several parameters under inputs.","additionalProperties":{"type":"object"}}},"required":["inputs"]}},"required":["workflow-dispatch"]}},"required":["flows","on"]},"ErrorResponse":{"type":"object","properties":{"status":{"type":"string"},"message":{"type":"string"},"error":{"type":"string"}}}}}}
```
