Estimate a rule's sessions per month and quota share from the last 7 days. Read-only; a condition stored sessions cannot answer counts as true and is listed in `not_evaluated`.
const url = 'https://api.siteqwality.com/rum/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/rules/preview';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/preview \ --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 ”Estimate
What a rule would record, from the last 7 days of sessions (POST .../rules/preview).
object
Sessions the application had in the window.
Of those, sessions the conditions and gates would match, before sampling.
The sample rate applied: the configured rate, or the current Auto rate.
Matching sessions scaled to a 30-day month, after sampling.
session_replay for Replay rules, rum_analyze for Analyze rules.
The account’s monthly quota for that product.
estimated_sessions_per_month / monthly_quota; null when there is no quota.
True when part of the rule could not be evaluated exactly from stored sessions; the estimate is then an upper bound.
Condition kinds and gates counted as always true.
Example generated
{ "window_days": 1, "sessions_in_window": 1, "matching_sessions_in_window": 1, "sample_rate": 1, "estimated_sessions_per_month": 1, "quota_product": "example", "monthly_quota": 1, "quota_share": 1, "approximate": true, "not_evaluated": [ "example" ]}Invalid rule
Missing or invalid authentication
Application not found
Internal server error