> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/xdr-api/yara-rules-and-scans/models.md).

# Models

## The ErrorResponse object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"ErrorResponse":{"type":"object","description":"Standard error response returned when a request fails.","properties":{"reply":{"type":"object","description":"Error details container.","properties":{"err_code":{"type":"integer","description":"Numeric error code identifying the type of error."},"err_msg":{"type":"string","description":"Human-readable error message describing what went wrong."},"err_extra":{"type":"string","description":"Additional context about the error, if available."}}}}}}}}
```

## The YaraInsertRulesRequest object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraInsertRulesRequest":{"type":"object","description":"Request to add YARA custom detection rules.","required":["request_data"],"properties":{"request_data":{"type":"object","description":"The request payload envelope.","required":["rules"],"properties":{"rules":{"type":"array","description":"The YARA rules to add. Provide at least 1 rule and no more than 1000 rules.","minItems":1,"maxItems":1000,"items":{"type":"object","required":["rule_content"],"properties":{"rule_content":{"type":"string","minLength":1,"description":"The raw text content of a YARA rule. The rule must compile successfully to be stored."}}}}}}}}}}}
```

## The YaraInsertRulesResponse object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraInsertRulesResponse":{"type":"object","description":"The outcome of an add rules request.","properties":{"reply":{"type":"object","properties":{"added_rules":{"type":"array","description":"The names of the rules that were added successfully.","items":{"type":"string"}},"dropped_rules":{"type":"array","description":"The names of the rules that were dropped because they failed to compile. These rules were not saved.","items":{"type":"string"}}}}}}}}}
```

## The YaraGetRulesRequest object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraGetRulesRequest":{"type":"object","description":"Request to retrieve YARA custom detection rules.","required":["request_data"],"properties":{"request_data":{"type":"object","description":"The filtering, sorting, and pagination options.","properties":{"filters":{"type":"array","description":"The filter criteria to apply. All filters are combined with a logical AND. For the\nsupported fields and operators, see Additional References.\n","items":{"$ref":"#/components/schemas/YaraRuleFilter"}},"sort":{"$ref":"#/components/schemas/YaraRuleSort"},"search_from":{"type":"integer","minimum":0,"default":0,"description":"The zero-based index of the first result to return."},"search_to":{"type":"integer","minimum":1,"default":100,"description":"The index of the last result to return. `search_to` must be greater than `search_from`,\nand the resulting page size cannot exceed 100.\n"}}}}},"YaraRuleFilter":{"type":"object","description":"A single filter criterion.","required":["field","operator","value"],"properties":{"field":{"type":"string","description":"The field to filter by.","enum":["id","name","origin","description","author","created_by","first_seen"]},"operator":{"type":"string","description":"The comparison operator to apply. The operators available depend on the field. For the full\nmapping, see Additional References.\n","enum":["eq","neq","contains","not_contains","gte","lte"]},"value":{"description":"The value to compare the field against. Use a string for text fields and a Unix epoch\ntimestamp in milliseconds for `first_seen`.\n","oneOf":[{"type":"string"},{"type":"integer"}]}}},"YaraRuleSort":{"type":"object","description":"The sorting preference for the results.","required":["field","keyword"],"properties":{"field":{"type":"string","description":"The field to sort by. Only `name`, `origin`, `author`, `created_by`, and `first_seen` are sortable.","enum":["name","origin","author","created_by","first_seen"]},"keyword":{"type":"string","description":"The sort direction.","enum":["asc","desc"]}}}}}}
```

## The YaraRuleFilter object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraRuleFilter":{"type":"object","description":"A single filter criterion.","required":["field","operator","value"],"properties":{"field":{"type":"string","description":"The field to filter by.","enum":["id","name","origin","description","author","created_by","first_seen"]},"operator":{"type":"string","description":"The comparison operator to apply. The operators available depend on the field. For the full\nmapping, see Additional References.\n","enum":["eq","neq","contains","not_contains","gte","lte"]},"value":{"description":"The value to compare the field against. Use a string for text fields and a Unix epoch\ntimestamp in milliseconds for `first_seen`.\n","oneOf":[{"type":"string"},{"type":"integer"}]}}}}}}
```

## The YaraRuleSort object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraRuleSort":{"type":"object","description":"The sorting preference for the results.","required":["field","keyword"],"properties":{"field":{"type":"string","description":"The field to sort by. Only `name`, `origin`, `author`, `created_by`, and `first_seen` are sortable.","enum":["name","origin","author","created_by","first_seen"]},"keyword":{"type":"string","description":"The sort direction.","enum":["asc","desc"]}}}}}}
```

## The YaraGetRulesResponse object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraGetRulesResponse":{"type":"object","description":"The YARA rules that match the query.","properties":{"reply":{"type":"object","properties":{"data":{"type":"array","description":"The rules matching the query, after pagination is applied.","items":{"$ref":"#/components/schemas/YaraRule"}},"filter_count":{"type":"integer","minimum":0,"description":"The number of rules matching the filters, before pagination is applied."},"total_count":{"type":"integer","minimum":0,"description":"The total number of rules stored in the tenant."}}}}},"YaraRule":{"type":"object","description":"A YARA custom detection rule.","properties":{"id":{"type":"string","description":"The unique identifier of the rule. Use this value to start a scan or delete the rule."},"name":{"type":"string","description":"The name of the rule, taken from the rule definition."},"origin":{"type":"string","description":"The source the rule came from. `public_api` indicates the rule was added through this API,\nand `user_upload` indicates it was uploaded through the Cortex XDR console. When filtering on this\nfield, use these values, for example `origin` `eq` `public_api`.\n","enum":["public_api","user_upload"]},"first_seen":{"type":"integer","format":"int64","nullable":true,"description":"The time the rule was created, as a Unix epoch timestamp in milliseconds."},"description":{"type":"string","nullable":true,"description":"The description of the rule, taken from the `description` metadata field in the rule definition."},"author":{"type":"string","nullable":true,"description":"The author of the rule, taken from the `author` metadata field in the rule definition."},"created_by":{"type":"string","description":"The display name of the user who created the rule."},"rule_content":{"type":"string","description":"The raw text content of the YARA rule."}}}}}}
```

## The YaraRule object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraRule":{"type":"object","description":"A YARA custom detection rule.","properties":{"id":{"type":"string","description":"The unique identifier of the rule. Use this value to start a scan or delete the rule."},"name":{"type":"string","description":"The name of the rule, taken from the rule definition."},"origin":{"type":"string","description":"The source the rule came from. `public_api` indicates the rule was added through this API,\nand `user_upload` indicates it was uploaded through the Cortex XDR console. When filtering on this\nfield, use these values, for example `origin` `eq` `public_api`.\n","enum":["public_api","user_upload"]},"first_seen":{"type":"integer","format":"int64","nullable":true,"description":"The time the rule was created, as a Unix epoch timestamp in milliseconds."},"description":{"type":"string","nullable":true,"description":"The description of the rule, taken from the `description` metadata field in the rule definition."},"author":{"type":"string","nullable":true,"description":"The author of the rule, taken from the `author` metadata field in the rule definition."},"created_by":{"type":"string","description":"The display name of the user who created the rule."},"rule_content":{"type":"string","description":"The raw text content of the YARA rule."}}}}}}
```

## The YaraDeleteRulesRequest object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraDeleteRulesRequest":{"type":"object","description":"Request to delete YARA custom detection rules.","required":["request_data"],"properties":{"request_data":{"type":"object","description":"The request payload envelope.","required":["rule_ids"],"properties":{"rule_ids":{"type":"array","description":"The IDs of the rules to delete. Provide at least 1 ID and no more than 1000 IDs.\nDuplicate values are rejected.\n","minItems":1,"maxItems":1000,"uniqueItems":true,"items":{"type":"string"}}}}}}}}}
```

## The YaraDeleteRulesResponse object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraDeleteRulesResponse":{"type":"object","description":"The outcome of a delete rules request.","properties":{"reply":{"type":"object","properties":{"status":{"type":"string","description":"The overall outcome of the request. `SUCCESS` means every rule was deleted, `PARTIAL`\nmeans some rule IDs were not found, and `FAILED` means none were found.\n","enum":["SUCCESS","PARTIAL","FAILED"]},"deleted_count":{"type":"integer","minimum":0,"description":"The number of rules that were deleted."},"failed_deletions":{"type":"array","description":"The rule IDs that could not be deleted because they were not found.","items":{"type":"string"}}}}}}}}}
```

## The YaraStartScanRequest object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraStartScanRequest":{"type":"object","description":"Request to start an on-demand YARA scan.","required":["request_data"],"properties":{"request_data":{"type":"object","description":"The scan definition.","required":["scan_name","rule_ids","endpoint_ids"],"properties":{"scan_name":{"type":"string","minLength":1,"maxLength":100,"description":"A name for the scan, used to identify it in the Cortex XDR console."},"rule_ids":{"type":"array","description":"The IDs of the YARA rules to scan with. Provide at least 1 ID and no more than 500 IDs.\nDuplicate values are rejected.\n","minItems":1,"maxItems":500,"uniqueItems":true,"items":{"type":"string"}},"endpoint_ids":{"type":"array","description":"The IDs of the endpoints to scan. Provide at least 1 ID and no more than 2000 IDs.\n","minItems":1,"maxItems":2000,"items":{"type":"string"}},"scope_type":{"type":"string","nullable":true,"description":"Whether `scope_content` lists paths to scan or paths to skip. Required when\n`scope_content` is provided. When omitted, the scan covers the full file system.\n","enum":["include","exclude"]},"scope_content":{"type":"array","description":"The file or folder paths to include in or exclude from the scan, up to 50 paths.\nRequired when `scope_type` is provided. Paths must use Windows format with backslashes.\n","maxItems":50,"items":{"type":"string"}}}}}}}}}
```

## The YaraStartScanResponse object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraStartScanResponse":{"type":"object","description":"The identifier of the scan that was created.","properties":{"reply":{"type":"object","properties":{"action_id":{"type":"integer","description":"The ID of the scan action. Use this value to track or abort the scan."}}}}}}}}
```

## The YaraAbortScanRequest object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraAbortScanRequest":{"type":"object","description":"Request to abort a running YARA scan.","required":["request_data"],"properties":{"request_data":{"type":"object","description":"The request payload envelope.","required":["action_id"],"properties":{"action_id":{"type":"integer","minimum":1,"description":"The ID of the scan action to abort, as returned by the Start a YARA scan endpoint."}}}}}}}}
```

## The YaraAbortScanResponse object

```json
{"openapi":"3.0.3","info":{"title":"Cortex XDR YARA Rules and Scans API","version":"1.0.0"},"components":{"schemas":{"YaraAbortScanResponse":{"type":"object","description":"The identifier of the abort action that was created.","properties":{"reply":{"type":"object","properties":{"action_id":{"type":"integer","description":"The ID of the abort action. This differs from the ID of the scan being aborted."}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://cortex-docs.paloaltonetworks.com/xdr-api/yara-rules-and-scans/models.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
