Update cron job
curl --request PATCH \
--url https://api.instacloud.com/projects/{projectId}/cron-jobs/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'if-match: <if-match>' \
--data '
{
"name": "<string>",
"expression": "<string>",
"enabled": true,
"target": {
"kind": "external",
"url": "<string>"
},
"request": {
"headers": {},
"body": "<string>",
"secretRefs": {}
},
"requestTimeoutMs": 150500,
"retry": {
"platformMaxRetries": 5,
"applicationMaxRetries": 5,
"retryableStatuses": [
349
],
"maxRunAgeMs": 1
}
}
'import requests
url = "https://api.instacloud.com/projects/{projectId}/cron-jobs/{id}"
payload = {
"name": "<string>",
"expression": "<string>",
"enabled": True,
"target": {
"kind": "external",
"url": "<string>"
},
"request": {
"headers": {},
"body": "<string>",
"secretRefs": {}
},
"requestTimeoutMs": 150500,
"retry": {
"platformMaxRetries": 5,
"applicationMaxRetries": 5,
"retryableStatuses": [349],
"maxRunAgeMs": 1
}
}
headers = {
"if-match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'if-match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
expression: '<string>',
enabled: true,
target: {kind: 'external', url: '<string>'},
request: {headers: {}, body: JSON.stringify('<string>'), secretRefs: {}},
requestTimeoutMs: 150500,
retry: {
platformMaxRetries: 5,
applicationMaxRetries: 5,
retryableStatuses: [349],
maxRunAgeMs: 1
}
})
};
fetch('https://api.instacloud.com/projects/{projectId}/cron-jobs/{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.instacloud.com/projects/{projectId}/cron-jobs/{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([
'name' => '<string>',
'expression' => '<string>',
'enabled' => true,
'target' => [
'kind' => 'external',
'url' => '<string>'
],
'request' => [
'headers' => [
],
'body' => '<string>',
'secretRefs' => [
]
],
'requestTimeoutMs' => 150500,
'retry' => [
'platformMaxRetries' => 5,
'applicationMaxRetries' => 5,
'retryableStatuses' => [
349
],
'maxRunAgeMs' => 1
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"if-match: <if-match>"
],
]);
$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.instacloud.com/projects/{projectId}/cron-jobs/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"expression\": \"<string>\",\n \"enabled\": true,\n \"target\": {\n \"kind\": \"external\",\n \"url\": \"<string>\"\n },\n \"request\": {\n \"headers\": {},\n \"body\": \"<string>\",\n \"secretRefs\": {}\n },\n \"requestTimeoutMs\": 150500,\n \"retry\": {\n \"platformMaxRetries\": 5,\n \"applicationMaxRetries\": 5,\n \"retryableStatuses\": [\n 349\n ],\n \"maxRunAgeMs\": 1\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("if-match", "<if-match>")
req.Header.Add("Authorization", "Bearer <token>")
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.instacloud.com/projects/{projectId}/cron-jobs/{id}")
.header("if-match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"expression\": \"<string>\",\n \"enabled\": true,\n \"target\": {\n \"kind\": \"external\",\n \"url\": \"<string>\"\n },\n \"request\": {\n \"headers\": {},\n \"body\": \"<string>\",\n \"secretRefs\": {}\n },\n \"requestTimeoutMs\": 150500,\n \"retry\": {\n \"platformMaxRetries\": 5,\n \"applicationMaxRetries\": 5,\n \"retryableStatuses\": [\n 349\n ],\n \"maxRunAgeMs\": 1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.instacloud.com/projects/{projectId}/cron-jobs/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["if-match"] = '<if-match>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"expression\": \"<string>\",\n \"enabled\": true,\n \"target\": {\n \"kind\": \"external\",\n \"url\": \"<string>\"\n },\n \"request\": {\n \"headers\": {},\n \"body\": \"<string>\",\n \"secretRefs\": {}\n },\n \"requestTimeoutMs\": 150500,\n \"retry\": {\n \"platformMaxRetries\": 5,\n \"applicationMaxRetries\": 5,\n \"retryableStatuses\": [\n 349\n ],\n \"maxRunAgeMs\": 1\n }\n}"
response = http.request(request)
puts response.read_body{
"job": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"branch_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"branch": "<string>",
"name": "<string>",
"expression": "<string>",
"timezone": "<string>",
"enabled": true,
"revision": 123,
"next_run_at": "2023-11-07T05:31:56Z",
"target": {
"kind": "external",
"url": "<string>"
},
"request": {
"method": "GET",
"headerNames": [
"<string>"
]
},
"request_timeout_ms": 123,
"retry_policy": {
"platformMaxRetries": 5,
"applicationMaxRetries": 5,
"retryableStatuses": [
349
],
"maxRunAgeMs": 1
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"status": "approval_required",
"approvalId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action": "<string>",
"actions": [
"<string>"
],
"message": "<string>",
"url": "<string>",
"nextActions": [
{
"op": "<string>",
"reason": "<string>",
"args": {},
"gated": true
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Cron
Update cron job
**Token scope:** `account` · `org` · `project` — read-only tokens refused (not a GET).
Update a cron job. Requires If-Match: <revision>. Gated — cron.write.
PATCH
/
projects
/
{projectId}
/
cron-jobs
/
{id}
Update cron job
curl --request PATCH \
--url https://api.instacloud.com/projects/{projectId}/cron-jobs/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'if-match: <if-match>' \
--data '
{
"name": "<string>",
"expression": "<string>",
"enabled": true,
"target": {
"kind": "external",
"url": "<string>"
},
"request": {
"headers": {},
"body": "<string>",
"secretRefs": {}
},
"requestTimeoutMs": 150500,
"retry": {
"platformMaxRetries": 5,
"applicationMaxRetries": 5,
"retryableStatuses": [
349
],
"maxRunAgeMs": 1
}
}
'import requests
url = "https://api.instacloud.com/projects/{projectId}/cron-jobs/{id}"
payload = {
"name": "<string>",
"expression": "<string>",
"enabled": True,
"target": {
"kind": "external",
"url": "<string>"
},
"request": {
"headers": {},
"body": "<string>",
"secretRefs": {}
},
"requestTimeoutMs": 150500,
"retry": {
"platformMaxRetries": 5,
"applicationMaxRetries": 5,
"retryableStatuses": [349],
"maxRunAgeMs": 1
}
}
headers = {
"if-match": "<if-match>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'if-match': '<if-match>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
expression: '<string>',
enabled: true,
target: {kind: 'external', url: '<string>'},
request: {headers: {}, body: JSON.stringify('<string>'), secretRefs: {}},
requestTimeoutMs: 150500,
retry: {
platformMaxRetries: 5,
applicationMaxRetries: 5,
retryableStatuses: [349],
maxRunAgeMs: 1
}
})
};
fetch('https://api.instacloud.com/projects/{projectId}/cron-jobs/{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.instacloud.com/projects/{projectId}/cron-jobs/{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([
'name' => '<string>',
'expression' => '<string>',
'enabled' => true,
'target' => [
'kind' => 'external',
'url' => '<string>'
],
'request' => [
'headers' => [
],
'body' => '<string>',
'secretRefs' => [
]
],
'requestTimeoutMs' => 150500,
'retry' => [
'platformMaxRetries' => 5,
'applicationMaxRetries' => 5,
'retryableStatuses' => [
349
],
'maxRunAgeMs' => 1
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"if-match: <if-match>"
],
]);
$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.instacloud.com/projects/{projectId}/cron-jobs/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"expression\": \"<string>\",\n \"enabled\": true,\n \"target\": {\n \"kind\": \"external\",\n \"url\": \"<string>\"\n },\n \"request\": {\n \"headers\": {},\n \"body\": \"<string>\",\n \"secretRefs\": {}\n },\n \"requestTimeoutMs\": 150500,\n \"retry\": {\n \"platformMaxRetries\": 5,\n \"applicationMaxRetries\": 5,\n \"retryableStatuses\": [\n 349\n ],\n \"maxRunAgeMs\": 1\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("if-match", "<if-match>")
req.Header.Add("Authorization", "Bearer <token>")
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.instacloud.com/projects/{projectId}/cron-jobs/{id}")
.header("if-match", "<if-match>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"expression\": \"<string>\",\n \"enabled\": true,\n \"target\": {\n \"kind\": \"external\",\n \"url\": \"<string>\"\n },\n \"request\": {\n \"headers\": {},\n \"body\": \"<string>\",\n \"secretRefs\": {}\n },\n \"requestTimeoutMs\": 150500,\n \"retry\": {\n \"platformMaxRetries\": 5,\n \"applicationMaxRetries\": 5,\n \"retryableStatuses\": [\n 349\n ],\n \"maxRunAgeMs\": 1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.instacloud.com/projects/{projectId}/cron-jobs/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["if-match"] = '<if-match>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"expression\": \"<string>\",\n \"enabled\": true,\n \"target\": {\n \"kind\": \"external\",\n \"url\": \"<string>\"\n },\n \"request\": {\n \"headers\": {},\n \"body\": \"<string>\",\n \"secretRefs\": {}\n },\n \"requestTimeoutMs\": 150500,\n \"retry\": {\n \"platformMaxRetries\": 5,\n \"applicationMaxRetries\": 5,\n \"retryableStatuses\": [\n 349\n ],\n \"maxRunAgeMs\": 1\n }\n}"
response = http.request(request)
puts response.read_body{
"job": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"project_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"branch_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"branch": "<string>",
"name": "<string>",
"expression": "<string>",
"timezone": "<string>",
"enabled": true,
"revision": 123,
"next_run_at": "2023-11-07T05:31:56Z",
"target": {
"kind": "external",
"url": "<string>"
},
"request": {
"method": "GET",
"headerNames": [
"<string>"
]
},
"request_timeout_ms": 123,
"retry_policy": {
"platformMaxRetries": 5,
"applicationMaxRetries": 5,
"retryableStatuses": [
349
],
"maxRunAgeMs": 1
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"status": "approval_required",
"approvalId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"action": "<string>",
"actions": [
"<string>"
],
"message": "<string>",
"url": "<string>",
"nextActions": [
{
"op": "<string>",
"reason": "<string>",
"args": {},
"gated": true
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Session access JWT or an API token (insta_<prefix>_<secret>).
Headers
the job’s current revision
Body
application/json
Required string length:
1 - 64Required string length:
1 - 256false pauses the job; in-flight runs are blocked at the send boundary
Where the job sends its request. An internal target names the SERVICE, never a URL: the worker resolves the live route at send time, so a redeploy or a region move cannot leave a job firing at a dead host.
- Option 1
- Option 2
Show child attributes
Show child attributes
Stored encrypted; its VALUES are never returned. Send the whole object to replace it — reads answer with request (method and header names only).
Show child attributes
Show child attributes
Required range:
1000 <= x <= 300000Show child attributes
Show child attributes
Response
Default Response
A cron schedule. Header values are write-only; request describes the stored request without them.
Show child attributes
Show child attributes