Skip to main content
PATCH
/
apps
/
{app_id}
/
workflows
/
{workflow_id}
/
runs
/
{run_id}
/
retention
Update Run Data Retention Configuration
curl --request PATCH \
  --url https://api.example.com/apps/{app_id}/workflows/{workflow_id}/runs/{run_id}/retention \
  --header 'Content-Type: application/json' \
  --data '
{
  "retention": 123
}
'
import requests

url = "https://api.example.com/apps/{app_id}/workflows/{workflow_id}/runs/{run_id}/retention"

payload = { "retention": 123 }
headers = {"Content-Type": "application/json"}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({retention: 123})
};

fetch('https://api.example.com/apps/{app_id}/workflows/{workflow_id}/runs/{run_id}/retention', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/apps/{app_id}/workflows/{workflow_id}/runs/{run_id}/retention",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'retention' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/apps/{app_id}/workflows/{workflow_id}/runs/{run_id}/retention"

payload := strings.NewReader("{\n \"retention\": 123\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://api.example.com/apps/{app_id}/workflows/{workflow_id}/runs/{run_id}/retention")
.header("Content-Type", "application/json")
.body("{\n \"retention\": 123\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/apps/{app_id}/workflows/{workflow_id}/runs/{run_id}/retention")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"retention\": 123\n}"

response = http.request(request)
puts response.read_body
{
  "id": "<string>",
  "input": {},
  "output": {},
  "status": "RUNNING",
  "origin": "WORKFLOW",
  "started_at": "2023-12-25",
  "ended_at": "2023-12-25",
  "app_id": "<string>",
  "workflow_app_id": "<string>",
  "workflow_id": "<string>",
  "workflow_version_draft": {
    "key": "<string>",
    "input": {},
    "input_default": {},
    "input_options": {
      "display": {
        "hidden": true
      }
    },
    "steps": [
      {
        "type": "note",
        "key": "<string>",
        "note": "<string>",
        "conditional": "<string>",
        "loop": "<string>",
        "throw_on_error": true,
        "input_connected": true,
        "destinations": [
          "<string>"
        ],
        "position": [
          123
        ],
        "size": [
          101
        ],
        "auto": {
          "provider": "<string>",
          "model": "<string>",
          "temperature": 1
        }
      }
    ]
  },
  "workflow_version": {
    "id": "<string>",
    "app_id": "<string>",
    "workflow_id": "<string>",
    "description": "<string>",
    "version": 123,
    "notes": "<string>",
    "created_at": "2023-12-25",
    "key": "<string>",
    "input": {},
    "input_default": {},
    "input_options": {
      "display": {
        "hidden": true
      }
    },
    "steps": [
      {
        "type": "note",
        "key": "<string>",
        "note": "<string>",
        "conditional": "<string>",
        "loop": "<string>",
        "throw_on_error": true,
        "input_connected": true,
        "destinations": [
          "<string>"
        ],
        "position": [
          123
        ],
        "size": [
          101
        ],
        "auto": {
          "provider": "<string>",
          "model": "<string>",
          "temperature": 1
        }
      }
    ],
    "rollback_version": 123,
    "created_by": {
      "id": "<string>",
      "name": "<string>"
    }
  },
  "created_at": "2023-12-25",
  "updated_at": "2023-12-25",
  "result": "<unknown>",
  "error": "<string>",
  "collection_id": "<string>",
  "record_id": "<string>",
  "version": 123,
  "usage": {
    "total": 123,
    "steps": {},
    "calls": [
      {
        "id": "<string>",
        "total": 123,
        "calls": [
          "<unknown>"
        ]
      }
    ]
  },
  "retention": {
    "max_age_in_seconds": 3600,
    "preserve_on_failure": true
  },
  "retention_due_at": "2023-12-25"
}

Path Parameters

app_id
string
required

The ID of the app

workflow_id
string
required

The ID of the workflow

run_id
string
required

The ID of the workflow run.

Query Parameters

verbose
enum<string>[]
Available options:
all

Body

Schema for updating run data retention configuration

retention

Data retention policy for the run

Response

200 - application/json
id
string
required

Unique identifier for the run

input
object | null
required

Input values used for the run

output
object
required

Output of the run

status
enum<string>
required

Status of the run

Available options:
PENDING,
RUNNING,
CANCELLED,
COMPLETED,
SKIPPED,
FAILED
Example:

"RUNNING"

origin
enum<string>
required

Origin of the run

Available options:
WORKFLOW,
TRIGGER,
RECORD,
TEST,
ENDPOINT,
WEBHOOK
Example:

"WORKFLOW"

started_at
string<date> | null
required

Timestamp of when the run started

ended_at
string<date> | null
required

Timestamp of when the run ended

app_id
string
required

ID of the associated app where the run was triggered from

workflow_app_id
string
required

ID of the associated app where the workflow belongs to

workflow_id
string
required

ID of the associated workflow

workflow_version_draft
object | null
required

Draft version of the workflow

workflow_version
object | null
required

Details of the workflow version used for the run

created_at
string<date> | null
required

Timestamp of when the run was created

updated_at
string<date> | null
required

Timestamp of when the run was last updated

result
any | null

Result of the run

error
string

Error message if the run failed

collection_id
string

ID of the associated collection

record_id
string

ID of the associated record

version
number

Version number of the workflow

usage
object

Credits usage of the run

retention
object | null

Configuration for how long run data is preserved in the system

Example:
{
"max_age_in_seconds": 3600,
"preserve_on_failure": true
}
retention_due_at
string<date> | null

Timestamp of when the run data retention policy will be applied