Create a recording rule (at most 50 per application). Replay rules default to a 3 s minimum duration and a required interaction; error conditions bypass both. Publishes the SDK config.
const url = 'https://api.siteqwality.com/rum/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rules';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","capture":"analyze","enabled":true,"sample_rate":1,"auto_sample":true,"conditions":[{"op":"contains","value":"example","kind":"url"}],"min_duration_ms":1,"require_interaction":true,"position":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.siteqwality.com/rum/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rules \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "capture": "analyze", "enabled": true, "sample_rate": 1, "auto_sample": true, "conditions": [ { "op": "contains", "value": "example", "kind": "url" } ], "min_duration_ms": 1, "require_interaction": true, "position": 1 }'Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”RUM application identifier
Request Body required
Section titled “Request Body required ”Body of POST /rum/{app_id}/rules and of a preview.
object
1 to 255 characters. Optional for a preview.
What a matching session records. Replay implies Analyze.
Default 1.
The page URL, checked on each view. regex values use the common subset of the
Rust and JavaScript syntaxes, at most 256 characters, with no nested quantifiers.
object
A custom event (addAction) with this name.
object
A non-ignored error, optionally narrowed by type, message fragment or handling.
object
A failed request of this class, optionally to a URL containing url_contains.
object
A frustration signal.
object
A final vital above gt (milliseconds for LCP and INP, unitless for CLS).
object
setUser was called with an id. A struct variant so unknown fields are refused.
object
A global attribute or user trait equals value.
object
The device class at init.
object
The release passed at init.
object
The environment passed at init.
object
Default 3000 for Replay rules, 0 for Analyze rules.
Default true for Replay rules, false for Analyze rules.
Default: after the last rule.
Responses
Section titled “ Responses ”Rule created
A recording rule.
object
What a matching session records. Replay implies Analyze.
The configured rate, 0.00001 to 1. For an Auto rule, the most Auto may set.
Auto: the rate follows the replay quota, recomputed hourly (Replay rules only).
The rate the SDK uses when the sampling tick has set one: the Auto rate, or a lowered rate for an error rule when errored sessions alone would exhaust the replay quota.
All must hold. Empty means every session.
The page URL, checked on each view. regex values use the common subset of the
Rust and JavaScript syntaxes, at most 256 characters, with no nested quantifiers.
object
A custom event (addAction) with this name.
object
A non-ignored error, optionally narrowed by type, message fragment or handling.
object
A failed request of this class, optionally to a URL containing url_contains.
object
A frustration signal.
object
A final vital above gt (milliseconds for LCP and INP, unitless for CLS).
object
setUser was called with an id. A struct variant so unknown fields are refused.
object
A global attribute or user trait equals value.
object
The device class at init.
object
The release passed at init.
object
The environment passed at init.
object
Sampled recordings upload only once the session is this old. Error conditions bypass it.
Sampled recordings upload only after a user interaction. Error conditions bypass it.
Example
{ "capture": "analyze", "conditions": [ { "op": "contains", "kind": "url" } ]}Invalid rule
Missing or invalid authentication
Application not found
The application already has 50 rules
Internal server error
The SDK config could not be published; nothing was changed