> ## Documentation Index > Fetch the complete documentation index at: https://developers.torq.io/llms.txt > Use this file to discover all available pages before exploring further. # Create a rule > Creates a rule. It is evaluated first unless a priority is given. ## OpenAPI ````json POST /v1/triage/rules { "openapi": "3.0.1", "info": { "contact": { "email": "support@torq.io", "name": "torq.io", "url": "https://torq.io" }, "title": "Torq Public API[production]", "version": "1.0.1alpha-148prod" }, "servers": [ { "url": "https://api.torq.io/public", "description": "US Environment" }, { "url": "https://api.eu.torq.io/public", "description": "European Environment" } ], "security": [ { "bearerAuth": [] } ], "tags": [ { "name": "ActivityLogs" }, { "name": "AgentsHubService" }, { "name": "ApiKeys" }, { "name": "AuditLogs" }, { "name": "Auto Triage Alert History" }, { "name": "Auto Triage Alerts" }, { "name": "Auto Triage Guidance" }, { "name": "Auto Triage Rules" }, { "name": "Auto Triage Verdict Actions" }, { "name": "Cases" }, { "name": "Cases Attachments" }, { "name": "Cases Custom Fields" }, { "name": "Cases Events" }, { "name": "Cases Links" }, { "name": "Cases Notes" }, { "name": "Cases Runbooks" }, { "name": "Cases Task Templates" }, { "name": "Cases Tasks" }, { "name": "CasesService" }, { "name": "ClaimMappings" }, { "name": "Dashboards" }, { "name": "Executions" }, { "name": "IdpSsoService" }, { "name": "Integrations" }, { "name": "IP Access Rules" }, { "name": "Observables" }, { "name": "Roles" }, { "name": "Scheduled Reports" }, { "name": "Secrets" }, { "name": "Security Config" }, { "name": "ShareRequests" }, { "name": "StepRunners" }, { "name": "Users" }, { "name": "Workflows" }, { "name": "Workspaces" }, { "name": "WorkspaceVariables" } ], "externalDocs": { "description": "Torq Documentation", "url": "https://learn.torq.io" }, "x-original-swagger-version": "2.0", "paths": { "/v1/triage/rules": { "post": { "description": "Creates a rule. It is evaluated first unless a priority is given.", "operationId": "RuleService_CreateRule", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/torq.public.triage.v1.CreateRuleRequest" } } }, "required": true }, "responses": { "200": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/torq.public.triage.v1.CreateRuleResponse" } } }, "description": "A successful response." }, "401": { "content": { "application/json": { "schema": { "type": "object" } } }, "description": "Invalid bearer token. If you receive this message more than once try creating a new Client ID/Client Secret or generating a new bearer token." }, "403": { "content": { "application/json": { "schema": { "type": "object" } } }, "description": "You don't have permission to access this resource." } }, "summary": "Create a rule", "tags": [ "Auto Triage Rules" ], "x-codegen-request-body-name": "body" } } }, "components": { "schemas": { "torq.public.triage.v1.CreateRuleRequest": { "example": { "name": "CrowdStrike alerts from the corporate VPN are false positives", "enabled": false, "matcher": { "or": [ { "and": [ { "field": "alert.source.integration_type_id", "operator": "in", "values": [ "crowdstrike_streaming" ] }, { "collection": "alert.observables", "match": { "or": [ { "and": [ { "field": "type", "operator": "in", "values": [ "IP Address" ] }, { "field": "value", "operator": "in", "values": [ "10.8.0.1" ] } ] } ] } } ] } ] }, "outcome": { "type": "override_triage_result", "config": { "verdict": "False Positive" } } }, "properties": { "name": { "description": "The rule name, unique among the workspace's rules and guidance. Maximum 255 characters. This property is required.", "maxLength": 255, "minLength": 1, "type": "string" }, "description": { "description": "An optional description of the rule. Maximum 2,000 characters.", "maxLength": 2000, "type": "string" }, "enabled": { "description": "Whether the rule is active. A disabled rule is not evaluated. Defaults to true when omitted.", "nullable": true, "type": "boolean" }, "priority": { "description": "The rule's position in evaluation order, 1 for first. Defaults to 1. The rules from that\nposition on shift down one place. A position past the last rule places the rule last.", "format": "int32", "minimum": 1, "nullable": true, "type": "integer" }, "evaluation_point": { "description": "When in triage the rule is evaluated. The only evaluation point is \"after_verdict\", the\ndefault. It cannot be changed after the rule is created.", "enum": [ "after_verdict" ], "nullable": true, "type": "string" }, "matcher": { "$ref": "#/components/schemas/torq.public.triage.v1.RuleMatcher" }, "outcome": { "$ref": "#/components/schemas/torq.public.triage.v1.RuleOutcome" } }, "title": "Create rule request", "type": "object" }, "torq.public.triage.v1.CreateRuleResponse": { "properties": { "rule": { "$ref": "#/components/schemas/torq.public.triage.v1.Rule" } }, "title": "Create rule response", "type": "object" }, "torq.public.triage.v1.RuleMatcher": { "description": "The conditions an alert must meet: the rule matches when any group matches, and a group\nmatches when all its conditions hold. Fields and values are spelled as on the public alert,\nand the allowed ones are listed by Retrieve rule schemas. To scope a rule to a source or category,\nput that condition in every group. A matcher holds at most 200 conditions in all, those\ninside collection conditions included.", "example": { "or": [ { "and": [ { "field": "alert.source.integration_type_id", "operator": "in", "values": [ "crowdstrike_streaming" ] }, { "collection": "alert.observables", "match": { "or": [ { "and": [ { "field": "type", "operator": "in", "values": [ "IP Address" ] }, { "field": "value", "operator": "in", "values": [ "10.8.0.1" ] } ] } ] } } ] } ] }, "properties": { "or": { "description": "The groups, any of which matching makes the rule match. Minimum 1, maximum 64.", "items": { "$ref": "#/components/schemas/torq.public.triage.v1.RuleConditionGroup" }, "type": "array" } }, "type": "object" }, "torq.public.triage.v1.RuleOutcome": { "description": "What a rule does to an alert it matches: an outcome type, and a config whose shape the type\ndefines. Retrieve rule schemas lists the allowed types and the settings each one takes. Currently\nthe only type is \"override_triage_result\", which sets the alert's verdict, its severity, or both.", "properties": { "type": { "description": "The outcome type, such as \"override_triage_result\".", "type": "string" }, "config": { "description": "The outcome's settings, as a JSON object whose fields and values the type's config schema\ndefines. For \"override_triage_result\": {\"verdict\": \"False Positive\", \"severity\": \"Low\"}, with\nat least one of the two.", "properties": {}, "type": "object" } }, "type": "object" }, "torq.public.triage.v1.Rule": { "description": "A rule sets an alert's verdict, severity or both when the alert matches its conditions.", "properties": { "id": { "description": "The unique identifier of the rule.", "readOnly": true, "title": "ID", "type": "string" }, "name": { "description": "The rule name, unique among the workspace's rules and guidance.", "title": "Name", "type": "string" }, "description": { "description": "An optional description of the rule.", "title": "Description", "type": "string" }, "enabled": { "description": "Whether the rule is active. A disabled rule is not evaluated. Always returned, including when false.", "nullable": false, "title": "Enabled", "type": "boolean" }, "priority": { "description": "The rule's position in evaluation order within its evaluation point, 1 for first. Positions\nrun from 1 to the number of rules without gaps, counting enabled and disabled rules.", "format": "int32", "title": "Priority", "type": "integer" }, "evaluation_point": { "description": "When in triage the rule is evaluated: \"after_verdict\", once Auto Triage has reached its verdict.", "title": "Evaluation point", "type": "string" }, "matcher": { "$ref": "#/components/schemas/torq.public.triage.v1.RuleMatcher" }, "outcome": { "$ref": "#/components/schemas/torq.public.triage.v1.RuleOutcome" }, "alerts_matched_last_30_days": { "description": "The number of alerts created in the last 30 days that this rule matched. Rules are checked in\npriority order and checking stops at the first match, so an alert counts only for the first\nrule that matched it. Approximate: the count is refreshed periodically. Always returned,\nincluding when 0.", "format": "int32", "nullable": false, "readOnly": true, "title": "Alerts matched in the last 30 days", "type": "integer" }, "created_at": { "description": "The timestamp when the rule was created.", "format": "date-time", "readOnly": true, "title": "Create time", "type": "string" }, "created_by": { "$ref": "#/components/schemas/torq.actor.v1.Actor" }, "updated_at": { "description": "The timestamp when the rule was last updated.", "format": "date-time", "readOnly": true, "title": "Update time", "type": "string" }, "updated_by": { "$ref": "#/components/schemas/torq.actor.v1.Actor" } }, "type": "object" }, "torq.public.triage.v1.RuleConditionGroup": { "description": "A group of conditions that must all hold.", "properties": { "and": { "description": "The conditions, all of which must hold. At least one.", "items": { "$ref": "#/components/schemas/torq.public.triage.v1.RuleCondition" }, "type": "array" } }, "type": "object" }, "torq.actor.v1.Actor": { "description": "The entity that performed the action.", "properties": { "kind": { "description": "The actor kind. Identifies which `actor` case is populated. One of:\nUSER, WORKFLOW, INTEGRATION, SERVICE_API_KEY, SOCRATES, TRIAGE, AGENT, BUILDER.", "readOnly": true, "type": "string" }, "user": { "$ref": "#/components/schemas/torq.actor.v1.Actor.User" }, "workflow": { "$ref": "#/components/schemas/torq.actor.v1.Actor.Workflow" }, "integration": { "$ref": "#/components/schemas/torq.actor.v1.Actor.Integration" }, "service_api_key": { "$ref": "#/components/schemas/torq.actor.v1.Actor.ServiceApiKey" }, "socrates": { "$ref": "#/components/schemas/torq.actor.v1.Actor.Socrates" }, "triage": { "$ref": "#/components/schemas/torq.actor.v1.Actor.Triage" }, "agent": { "$ref": "#/components/schemas/torq.actor.v1.Actor.Agent" }, "builder": { "$ref": "#/components/schemas/torq.actor.v1.Actor.Builder" } }, "type": "object" }, "torq.public.triage.v1.RuleCondition": { "description": "One condition, of one of two kinds. A field condition sets field, operator and values to test a\nfield of the alert. A collection condition sets collection and match to test the items of one of\nthe alert's lists, such as its observables, and holds when an item matches.", "properties": { "field": { "description": "The alert field the condition tests, as a path such as \"alert.source.integration_type_id\".\nSet for a field condition.", "type": "string" }, "operator": { "description": "How the field is compared with the values. Set for a field condition.\n\n- \"in\", \"not_in\": the field is one of the values, or none of them.\n- \"contains_any\", \"contains_none\": the field contains at least one of the values as a\n substring, or none of them.\n- \"matches_regex\": the field matches the one value given, a regular expression in RE2\n syntax.\n\nWhich operators a field takes is listed in its \"x-operators\" list in the rule schemas:\n\n- A field with a fixed set of values, such as \"alert.verdict.triage_severity\" or an\n observable's \"type\", a list of such values, such as \"alert.categories\", and an identifier\n compared exactly, such as \"alert.source.integration_type_id\": \"in\", \"not_in\".\n- Free text, such as an observable's \"value\", and a list of free text: all five.\n- A list of objects, such as \"alert.observables\": none; test its items with a collection\n condition.\n\nOn a list, the condition holds when some item meets it, or, for \"not_in\" and\n\"contains_none\", when no item does. \"equals\" and \"not_equals\" are refused; use \"in\" and\n\"not_in\", which match the same alerts.", "type": "string" }, "values": { "description": "The values the field is compared with, as strings: one for \"matches_regex\", one or more for\nthe others. Each is a non-empty string; a field with a fixed set of values takes only those.\nAt most 1,000 values, each at most 4,096 characters, and a regular expression at most 1,024 characters.\nSet for a field condition.", "items": { "type": "string" }, "type": "array" }, "collection": { "description": "The alert list the condition looks through, as a path such as \"alert.observables\". Set for\na collection condition.", "type": "string" }, "match": { "$ref": "#/components/schemas/torq.public.triage.v1.RuleElementMatcher" } }, "type": "object" }, "torq.actor.v1.Actor.User": { "description": "User identity information.", "properties": { "email": { "description": "The actor's email address.", "type": "string" }, "full_name": { "description": "The user's full name.", "type": "string" } }, "type": "object" }, "torq.actor.v1.Actor.Workflow": { "description": "Workflow execution details.", "properties": { "id": { "description": "The workflow ID.", "type": "string" }, "execution_id": { "description": "The workflow execution ID.", "type": "string" }, "name": { "description": "The workflow name.", "type": "string" } }, "type": "object" }, "torq.actor.v1.Actor.Integration": { "description": "Integration configuration.", "properties": { "id": { "description": "The integration ID.", "type": "string" }, "type_id": { "description": "The integration type identifier.", "type": "string" } }, "type": "object" }, "torq.actor.v1.Actor.ServiceApiKey": { "description": "Service account API token information.", "properties": { "name": { "description": "The service account API token name.", "type": "string" }, "client_id": { "description": "The service account API token client ID.", "type": "string" } }, "type": "object" }, "torq.actor.v1.Actor.Socrates": { "description": "Original actor information.", "properties": { "original_actor": { "$ref": "#/components/schemas/torq.actor.v1.Actor" } }, "type": "object" }, "torq.actor.v1.Actor.Triage": { "description": "Triage system action.", "type": "object" }, "torq.actor.v1.Actor.Agent": { "description": "Agent execution details.", "properties": { "id": { "description": "The agent ID.", "type": "string" }, "execution_id": { "description": "The agent execution ID.", "type": "string" } }, "type": "object" }, "torq.actor.v1.Actor.Builder": { "description": "Workflow Builder acting on behalf of a user.", "properties": { "original_actor": { "$ref": "#/components/schemas/torq.actor.v1.Actor" } }, "type": "object" }, "torq.public.triage.v1.RuleElementMatcher": { "description": "The conditions an item of an alert's list must meet, in the same shape as the matcher: the\nitem matches when any group matches, and a group matches when all its conditions hold. For\nconditions that must all hold on the same item, such as an observable's type and value, use\none group.", "properties": { "or": { "description": "The groups, any of which matching makes the item match. At least one.", "items": { "$ref": "#/components/schemas/torq.public.triage.v1.RuleElementGroup" }, "type": "array" } }, "type": "object" }, "torq.public.triage.v1.RuleElementGroup": { "description": "A group of conditions on an item, all of which must hold.", "properties": { "and": { "description": "The conditions, all of which must hold. At least one.", "items": { "$ref": "#/components/schemas/torq.public.triage.v1.RuleElementCondition" }, "type": "array" } }, "type": "object" }, "torq.public.triage.v1.RuleElementCondition": { "description": "A condition on a field of an item, such as an observable's \"type\" or \"value\".", "properties": { "field": { "description": "The item field the condition tests, relative to the item, such as \"type\".", "type": "string" }, "operator": { "description": "How the field is compared with the values. The operators, and which a field takes by its\ntype, are as in a rule condition.", "type": "string" }, "values": { "description": "The values the field is compared with, as strings, as in a rule condition.", "items": { "type": "string" }, "type": "array" } }, "type": "object" } }, "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "64fb4b65-44d8-4304-881c-b1f8b6b3100a" } } } } ````