Skip to main content
POST
/
v1
/
rules
/
{id}
/
reset-budget
Reset a rule budget
curl --request POST \
  --url https://api.scrip.dev/v1/rules/{id}/reset-budget \
  --header 'X-API-Key: <api-key>'
import requests

url = "https://api.scrip.dev/v1/rules/{id}/reset-budget"

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/rules/{id}/reset-budget', 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/rules/{id}/reset-budget",
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/rules/{id}/reset-budget"

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/rules/{id}/reset-budget")
.header("X-API-Key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.scrip.dev/v1/rules/{id}/reset-budget")

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
{
  "asset_id": "550e8400-e29b-41d4-a716-446655440000",
  "consumed": "4500.00",
  "cron_expression": "0 0 1 * *",
  "interval": "720h",
  "limit": "10000.00",
  "next_reset_at": "2026-03-01T00:00:00Z",
  "schedule_type": "CRON"
}
{
"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": "forbidden",
"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": "Insufficient permissions for this action"
}
{
"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"
}
Resets a rule’s budget for a specific asset. Pass the target asset_id as a query parameter. The consumed amount is set back to zero and the next_reset_at timestamp advances to the next scheduled reset period. For lifetime budgets (those without a schedule_type), the consumed amount resets but no future next_reset_at is scheduled. This is useful when you need to manually refill a budget mid-cycle or correct a budget that was consumed by erroneous events.
For usage patterns and examples, see the Writing Rules guide.

Authorizations

X-API-Key
string
header
required

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

Path Parameters

id
string<uuid>
required

Rule ID

Query Parameters

asset_id
string<uuid>
required

Asset ID to reset budget for

Response

Budget reset

asset_id
string<uuid>

Asset this budget constrains

Example:

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

consumed
string

Amount consumed so far in the current period

Example:

"4500.00"

cron_expression
string

Cron expression for CRON-based resets (e.g., first of every month)

Example:

"0 0 1 * *"

interval
string

Duration for INTERVAL-based resets

Example:

"720h"

limit
string

Maximum allowed spend for this budget period

Example:

"10000.00"

next_reset_at
string<date-time>

When the budget next resets (null for lifetime budgets)

Example:

"2026-03-01T00:00:00Z"

schedule_type
string

Reset schedule type: CRON or INTERVAL (null for lifetime budgets)

Example:

"CRON"