> For the complete documentation index, see [llms.txt](https://docs.imerit.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/get_assets.md).

# 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](https://docs.imerit.net/sdk/sdk-documentation.md#project-ids) or retrieve it using the [`list_projects`](https://docs.imerit.net/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, up to 100.
* **filters**: dict, *default {}*
  * A dictionary of filter options. If omitted, the results include all assets in the project across pages.
  * Common filters include the following fields. For custom fields, see [Filter by Context Data](#filter-by-context-data).

```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.

## Filter by Context Data

When you [upload an asset](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/upload_files_cloud.md), you can store identifiers from another system in `contextData`. Store each type as an array of strings if an asset can have multiple values of that type.

```json
{
  "contextData": {
    "sid": ["S123", "S456"],
    "uuid": ["9d92eb44-0650-4c1a-82f5-744c89ccc764"],
    "event-id": ["E123", "E456"]
  }
}
```

In Ango Hub 5.17 or later, pass a dotted field name such as `contextData.sid` and use `$eq` with a one-element array. The filter finds every asset whose array contains the exact value. In this example, `S123` matches the asset above, while `S1234` does not. Use `contextData.uuid` or `contextData.event-id` to look up the other identifiers.

```python
filters = {"contextData.sid": {"$eq": ["S123"]}}
limit = 100
page = 1
asset_ids = set()

while True:
    response = ango_sdk.get_assets(project_id, page=page, limit=limit, filters=filters)
    assets = response["data"]["assets"]
    asset_ids.update(asset["_id"] for asset in assets)
    if len(assets) < limit:
        break
    page += 1

asset_ids = sorted(asset_ids)
```

If you are finding assets to delete, check the filter against a known match in your deployment first. Collect all pages before reviewing the IDs and calling [`delete_assets`](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/delete_assets.md). For manual review, enter the results in the [Asset ID filter](https://docs.imerit.net/core-concepts/assets.md#find-assets-by-id).

This filter runs on the server. If you need indexed lookups for frequent requests, keep a lookup table in your own system that maps each identifier type and value to the Hub project and asset IDs. Populate it when you import assets and backfill it once for existing assets.

## 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](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/get_task.md), [get\_tasks](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/get_tasks.md)
{% endhint %}


---

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