Skip to main content
PATCH
/
runs
/
crons
/
{cron_id}
Update Cron
curl --request PATCH \
  --url https://api.example.com/runs/crons/{cron_id} \
  --header 'Content-Type: application/json' \
  --data '
{
  "schedule": "<string>",
  "timezone": "<string>",
  "end_time": "2023-11-07T05:31:56Z",
  "input": [
    {}
  ],
  "metadata": {},
  "config": {
    "tags": [
      "<string>"
    ],
    "recursion_limit": 123,
    "configurable": {}
  },
  "context": {},
  "webhook": "<string>",
  "interrupt_before": "*",
  "interrupt_after": "*",
  "enabled": true,
  "stream_mode": [
    "values"
  ],
  "stream_subgraphs": false,
  "stream_resumable": false,
  "durability": "async"
}
'
import requests

url = "https://api.example.com/runs/crons/{cron_id}"

payload = {
    "schedule": "<string>",
    "timezone": "<string>",
    "end_time": "2023-11-07T05:31:56Z",
    "input": [{}],
    "metadata": {},
    "config": {
        "tags": ["<string>"],
        "recursion_limit": 123,
        "configurable": {}
    },
    "context": {},
    "webhook": "<string>",
    "interrupt_before": "*",
    "interrupt_after": "*",
    "enabled": True,
    "stream_mode": ["values"],
    "stream_subgraphs": False,
    "stream_resumable": False,
    "durability": "async"
}
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({
    schedule: '<string>',
    timezone: '<string>',
    end_time: '2023-11-07T05:31:56Z',
    input: [{}],
    metadata: {},
    config: {tags: ['<string>'], recursion_limit: 123, configurable: {}},
    context: {},
    webhook: '<string>',
    interrupt_before: '*',
    interrupt_after: '*',
    enabled: true,
    stream_mode: ['values'],
    stream_subgraphs: false,
    stream_resumable: false,
    durability: 'async'
  })
};

fetch('https://api.example.com/runs/crons/{cron_id}', 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/runs/crons/{cron_id}",
  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([
    'schedule' => '<string>',
    'timezone' => '<string>',
    'end_time' => '2023-11-07T05:31:56Z',
    'input' => [
        [
                
        ]
    ],
    'metadata' => [
        
    ],
    'config' => [
        'tags' => [
                '<string>'
        ],
        'recursion_limit' => 123,
        'configurable' => [
                
        ]
    ],
    'context' => [
        
    ],
    'webhook' => '<string>',
    'interrupt_before' => '*',
    'interrupt_after' => '*',
    'enabled' => true,
    'stream_mode' => [
        'values'
    ],
    'stream_subgraphs' => false,
    'stream_resumable' => false,
    'durability' => 'async'
  ]),
  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/runs/crons/{cron_id}"

	payload := strings.NewReader("{\n  \"schedule\": \"<string>\",\n  \"timezone\": \"<string>\",\n  \"end_time\": \"2023-11-07T05:31:56Z\",\n  \"input\": [\n    {}\n  ],\n  \"metadata\": {},\n  \"config\": {\n    \"tags\": [\n      \"<string>\"\n    ],\n    \"recursion_limit\": 123,\n    \"configurable\": {}\n  },\n  \"context\": {},\n  \"webhook\": \"<string>\",\n  \"interrupt_before\": \"*\",\n  \"interrupt_after\": \"*\",\n  \"enabled\": true,\n  \"stream_mode\": [\n    \"values\"\n  ],\n  \"stream_subgraphs\": false,\n  \"stream_resumable\": false,\n  \"durability\": \"async\"\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/runs/crons/{cron_id}")
  .header("Content-Type", "application/json")
  .body("{\n  \"schedule\": \"<string>\",\n  \"timezone\": \"<string>\",\n  \"end_time\": \"2023-11-07T05:31:56Z\",\n  \"input\": [\n    {}\n  ],\n  \"metadata\": {},\n  \"config\": {\n    \"tags\": [\n      \"<string>\"\n    ],\n    \"recursion_limit\": 123,\n    \"configurable\": {}\n  },\n  \"context\": {},\n  \"webhook\": \"<string>\",\n  \"interrupt_before\": \"*\",\n  \"interrupt_after\": \"*\",\n  \"enabled\": true,\n  \"stream_mode\": [\n    \"values\"\n  ],\n  \"stream_subgraphs\": false,\n  \"stream_resumable\": false,\n  \"durability\": \"async\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/runs/crons/{cron_id}")

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  \"schedule\": \"<string>\",\n  \"timezone\": \"<string>\",\n  \"end_time\": \"2023-11-07T05:31:56Z\",\n  \"input\": [\n    {}\n  ],\n  \"metadata\": {},\n  \"config\": {\n    \"tags\": [\n      \"<string>\"\n    ],\n    \"recursion_limit\": 123,\n    \"configurable\": {}\n  },\n  \"context\": {},\n  \"webhook\": \"<string>\",\n  \"interrupt_before\": \"*\",\n  \"interrupt_after\": \"*\",\n  \"enabled\": true,\n  \"stream_mode\": [\n    \"values\"\n  ],\n  \"stream_subgraphs\": false,\n  \"stream_resumable\": false,\n  \"durability\": \"async\"\n}"

response = http.request(request)
puts response.read_body
{
  "cron_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "end_time": "2023-11-07T05:31:56Z",
  "schedule": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "payload": {},
  "enabled": true,
  "assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "user_id": "<string>",
  "next_run_date": "2023-11-07T05:31:56Z",
  "metadata": {}
}
{
  "detail": "<string>"
}
{
  "detail": "<string>"
}

Path Parameters

cron_id
string<uuid>
required

Body

application/json

Payload for updating a cron job. All fields are optional.

schedule
string

The cron schedule to execute this job on.

timezone
string

IANA timezone for the cron schedule (e.g. 'America/New_York'). Defaults to null, which is treated as UTC.

end_time
string<date-time>

The end date to stop running the cron.

input
object
metadata
Metadata · object

Metadata to merge with existing cron job metadata.

config
Config · object

The configuration for the assistant.

context
Context · object

Static context added to the assistant.

webhook
string<uri-reference>

Webhook to call after LangGraph API call is done.

Required string length: 1 - 65536
interrupt_before

Nodes to interrupt immediately before they get executed.

Available options:
*
interrupt_after

Nodes to interrupt immediately after they get executed.

Available options:
*
on_run_completed
enum<string>

What to do with the thread after the run completes. 'delete' removes the thread after execution. 'keep' creates a new thread for each execution but does not clean them up.

Available options:
delete,
keep
enabled
boolean

Enable or disable the cron job.

stream_mode

The stream mode(s) to use.

Available options:
values,
messages,
messages-tuple,
tasks,
checkpoints,
updates,
events,
debug,
custom
stream_subgraphs
boolean
default:false

Whether to stream output from subgraphs.

stream_resumable
boolean
default:false

Whether to persist the stream chunks in order to resume the stream later.

durability
enum<string>
default:async

Durability level for the run. Must be one of sync, async, or exit. See durability modes for more details.

Available options:
sync,
async,
exit

Response

Success

Represents a scheduled task.

cron_id
string<uuid>
required

The ID of the cron.

thread_id
string<uuid>
required

The ID of the thread.

end_time
string<date-time>
required

The end date to stop running the cron.

schedule
string
required

The schedule to run, cron format.

created_at
string<date-time>
required

The time the cron was created.

updated_at
string<date-time>
required

The last time the cron was updated.

payload
Payload · object
required

The run payload to use for creating new run.

enabled
boolean
default:true
required

Whether the cron job should be enabled. Disabled crons are not executed.

assistant_id
string<uuid> | null

The ID of the assistant.

user_id
string | null

The ID of the user.

next_run_date
string<date-time> | null

The next run date of the cron.

metadata
Metadata · object

The cron metadata.