Skip to main content
PUT
/
limits
/
rules
Upsert a batch of rules.
curl --request PUT \
  --url https://api.example.com/limits/rules \
  --header 'Content-Type: application/json' \
  --data '
[
  {
    "pattern": "<string>",
    "description": "<string>",
    "disabled": true,
    "limits": {
      "concurrency": 2
    },
    "precondition": {
      "type": "none"
    }
  }
]
'
import requests

url = "https://api.example.com/limits/rules"

payload = [
{
"pattern": "<string>",
"description": "<string>",
"disabled": True,
"limits": { "concurrency": 2 },
"precondition": { "type": "none" }
}
]
headers = {"Content-Type": "application/json"}

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

print(response.text)
const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify([
{
pattern: '<string>',
description: '<string>',
disabled: true,
limits: {concurrency: 2},
precondition: {type: 'none'}
}
])
};

fetch('https://api.example.com/limits/rules', 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/limits/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
[
'pattern' => '<string>',
'description' => '<string>',
'disabled' => true,
'limits' => [
'concurrency' => 2
],
'precondition' => [
'type' => 'none'
]
]
]),
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/limits/rules"

payload := strings.NewReader("[\n {\n \"pattern\": \"<string>\",\n \"description\": \"<string>\",\n \"disabled\": true,\n \"limits\": {\n \"concurrency\": 2\n },\n \"precondition\": {\n \"type\": \"none\"\n }\n }\n]")

req, _ := http.NewRequest("PUT", 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.put("https://api.example.com/limits/rules")
.header("Content-Type", "application/json")
.body("[\n {\n \"pattern\": \"<string>\",\n \"description\": \"<string>\",\n \"disabled\": true,\n \"limits\": {\n \"concurrency\": 2\n },\n \"precondition\": {\n \"type\": \"none\"\n }\n }\n]")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/limits/rules")

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

request = Net::HTTP::Put.new(url)
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"pattern\": \"<string>\",\n \"description\": \"<string>\",\n \"disabled\": true,\n \"limits\": {\n \"concurrency\": 2\n },\n \"precondition\": {\n \"type\": \"none\"\n }\n }\n]"

response = http.request(request)
puts response.read_body
[
  {
    "disabled": true,
    "last_modified_millis_since_epoch": 1,
    "limits": {
      "concurrency": 2
    },
    "pattern": "<string>",
    "version": 1,
    "description": "<string>"
  }
]
{
"message": "<string>",
"restate_code": "<string>"
}
{
"message": "<string>",
"restate_code": "<string>"
}
{
"message": "<string>",
"restate_code": "<string>"
}

Body

application/json
pattern
string
required

The pattern that selects which scope/limit-key combinations the rule applies to. Examples: "*", "scope1/*", "scope1/foo/bar".

description
string | null

Free-form description shown in the rule book; not consulted at runtime.

disabled
boolean

Soft-tombstone toggle. true parks the rule (the runtime treats it as absent) without removing it.

limits
object

Per-rule effective limits.

None on a field means "unlimited" (no rule constrains this dimension). Under the bilrost feature this type is also the wire shape persisted inside [crate::PersistedRule]; under serde it's the JSON wire shape for the admin REST model — adding a new limit kind here means allocating a fresh bilrost(tag(...)) next to the new field.

precondition
object

Optimistic-concurrency guard. { "type": "matches", "version": v } requires the rule's current version to be v; { "type": "does_not_exist" } requires the rule to be absent (strict insert); { "type": "none" } (or omitted) is unconditional.

Response

Rules upserted

disabled
boolean
required
last_modified_millis_since_epoch
integer<int64>
required

Millis since UNIX epoch.

Required range: x >= 0
limits
object
required

Per-rule effective limits.

None on a field means "unlimited" (no rule constrains this dimension). Under the bilrost feature this type is also the wire shape persisted inside [crate::PersistedRule]; under serde it's the JSON wire shape for the admin REST model — adding a new limit kind here means allocating a fresh bilrost(tag(...)) next to the new field.

pattern
string
required
version
integer<int32>
required

Per-rule version: bumped on runtime-relevant changes.

Required range: x >= 0
description
string | null