# instances

### Description

`instances` returns all the [instances](/guides/glossary/instance.md) of the type(s) specified. It should be used in combination with [`count`](/rule-language/operators/list-operators/count.md) or [`get_properties_from_instances`](/rule-language/operators/special-operators/get-properties-from-instances.md). Like other declarations, an optional where clause is also supported.

### Example: Ontology and Role

```
instances(Person, AccountHolder)
```

This will give you all instances that are of the type Person and have the [role](/guides/glossary/role.md) AccountHolder.<br>

### Example: Ontology and Where-Clause

```
instances(Person where self.first_name = 'Thorben')
```

This will give you all instances that are of the type Person that have the `first_name` Thorben.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.atfinity.io/rule-language/operators/special-operators/instances.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
