Skip to main content
POST
/
v1
/
programs
/
{programId}
/
automations
/
{automationId}
/
refresh-subscriptions
Refresh subscriptions
curl --request POST \
  --url https://api.scrip.dev/v1/programs/{programId}/automations/{automationId}/refresh-subscriptions \
  --header 'X-API-Key: <api-key>'
import requests

url = "https://api.scrip.dev/v1/programs/{programId}/automations/{automationId}/refresh-subscriptions"

headers = {"X-API-Key": "<api-key>"}

response = requests.post(url, headers=headers)

print(response.text)
const options = {method: 'POST', headers: {'X-API-Key': '<api-key>'}};

fetch('https://api.scrip.dev/v1/programs/{programId}/automations/{automationId}/refresh-subscriptions', 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.scrip.dev/v1/programs/{programId}/automations/{automationId}/refresh-subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);

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

curl_close($curl);

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

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

func main() {

url := "https://api.scrip.dev/v1/programs/{programId}/automations/{automationId}/refresh-subscriptions"

req, _ := http.NewRequest("POST", url, nil)

req.Header.Add("X-API-Key", "<api-key>")

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

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

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.scrip.dev/v1/programs/{programId}/automations/{automationId}/refresh-subscriptions")
.header("X-API-Key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.scrip.dev/v1/programs/{programId}/automations/{automationId}/refresh-subscriptions")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "automation_id": "990e8400-e29b-41d4-a716-446655440000",
  "message": "Evaluation queued"
}
{
"code": "bad_request",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Invalid request parameters"
}
{
"code": "unauthorized",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Missing or invalid credentials"
}
{
"code": "not_found",
"details": {
"expected": "uuid",
"field": "asset_id",
"fields": [
{
"expected": "<unknown>",
"field": "amount",
"message": "This field is required",
"reason": "required",
"received": "-10.00"
}
],
"reason": "invalid",
"received": "not-a-uuid"
},
"message": "Resource not found"
}
{
"code": "internal_error",
"message": "An internal error occurred"
}
Queues a re-evaluation of a participant_state automation’s filter criteria against the current participant set. New participants that now match the filter are subscribed and will receive future triggers. Participants that no longer match have their subscriptions cancelled. Scrip runs this evaluation periodically on its own, but you can call this endpoint to queue a re-evaluation sooner, for example after a bulk import or a rule change that affects participant state. The endpoint returns 202 and the evaluation runs asynchronously. The automation must be active. Paused or archived automations return a 400 error.
This endpoint only supports participant_state automations. Calling it on a cron, one_time, or immediate automation returns a 400 error. To manually fire those automation types, use the trigger endpoint instead.
For usage patterns and examples, see the Automations guide.

Authorizations

X-API-Key
string
header
required

API key passed in the X-API-Key header.

Path Parameters

programId
string<uuid>
required

Program ID

automationId
string<uuid>
required

Automation ID

Response

Evaluation queued

automation_id
string<uuid>

The automation whose subscriptions will be re-evaluated

Example:

"990e8400-e29b-41d4-a716-446655440000"

message
string

Confirmation that the re-evaluation was queued

Example:

"Evaluation queued"