# get\_assets

`imerit_ango.sdk.SDK.`

## get\_assets(project\_id, page, limit, filters)

Retrieve assets from your project.

### Parameters

* **project\_id:** string
  * The unique identifier for the project. You can find the project ID in [the user interface](/sdk/sdk-documentation.md#project-ids) or retrieve it using the [`list_projects`](/sdk/sdk-documentation/project-level-sdk-functions/list_projects.md) function.
* **page:** integer, *default 1*
  * The page number used for paginated asset retrieval.
* **limit:** integer, *default 10*
  * The maximum number of assets returned per request.
* **filters**: dict, *default {}*
  * A dictionary of filter options. If omitted, all assets will be returned.
  * Here is a list of possible filters you may pass in the *filters* dict:

```python
{
    "_id": ["asset_id_1", "asset_id_2"],                  # Asset ID filter
    "externalId": ["external_id_1", "external_id_2"],     # External ID filter
    "isPreLabeled": bool,                                 # Prelabel filter
    "batches": ["batch_id_1", "batch_id_2"],              # Batch filter (only the assets belonging to all batches will be returned) This is an "AND" operation.
    "createdAt": {"gt": "ISO_TIME_STR"},                  # gt: Greater Than (after), ISO_TIME_STR example: "2002-12-09T00:00:00.000Z"
    "createdAt": {"lt": "ISO_TIME_STR"}                   # lt: Less Than (before), ISO_TIME_STR example: "2002-12-09T00:00:00.000Z"
}
```

Returns:

* **output:** dict
  * A dictionary containing the result of the operation.
  * Including a `status` field indicating whether the request was successful and a `data` field containing the response payload with updated resources produced by the operation.

## Example

Retrieve the first ten assets from the project:

{% tabs %}
{% tab title="python" %}

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

sdk_response = ango_sdk.get_assets(project_id=project_id)

data_url = sdk_response['data']['assets'][0]['data']
external_id = sdk_response['data']['assets'][0]['externalId']
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -X GET "https://imeritapi.ango.ai/v2/project/$PROJECT_ID/assets?page=1&limit=10" \
  -H "Content-Type: application/json" \
  -H "apikey: $ANGO_API_KEY"
```

{% endtab %}
{% endtabs %}

Retrieve all assets from the project:

{% tabs %}
{% tab title="python" %}

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

ango_sdk = SDK(api_key)

page = 1
num_assets = 1
asset_list = []
while len(asset_list) < num_assets:
    response = ango_sdk.get_assets(project_id=project_id, page=page, limit=50)
    assets = response.get('data', {}).get('assets', [])
    num_assets = response.get('data', {}).get('total', 0)

    asset_list.extend(assets)
    page += 1

print("The number of retrieved assets is: " + str(len(asset_list)))
```

{% endtab %}
{% endtabs %}

Retrieve a single asset via asset ID:

{% tabs %}
{% tab title="python" %}

```python
import os
from dotenv import load_dotenv
from imerit_ango.sdk import SDK

load_dotenv('variables.env')
api_key = os.getenv('API_KEY')
project_id = os.getenv('PROJECT_ID')

asset_id = 'YOUR_ASSET_ID'

ango_sdk = SDK(api_key)

sdk_response = ango_sdk.get_assets(project_id=project_id, filters={"_id": [asset_id]})

data_url = sdk_response['data']['assets'][0]['data']
external_id = sdk_response['data']['assets'][0]['externalId']
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -G \
  "https://imeritapi.ango.ai/v2/project/$PROJECT_ID/assets" \
  -H "Content-Type: application/json" \
  -H "apikey: $ANGO_API_KEY" \
  --data-urlencode 'page=1' \
  --data-urlencode 'limit=10' \
  --data-urlencode 'filters={"_id":["$ASSET_ID"]}'
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**See also**

[get\_task](/sdk/sdk-documentation/project-level-sdk-functions/get_task.md), [get\_tasks](/sdk/sdk-documentation/project-level-sdk-functions/get_tasks.md)
{% endhint %}


---

# 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.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/get_assets.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.
