# upload\_files

`imerit_ango.sdk.SDK.`

## upload\_files(project\_id, file\_paths, storage\_id, batches, priority)

Upload local files to 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.
* **file\_paths:** List\[str]
  * A list containing absolute paths to files and, optionally, their contextData.
  * Example:

```json
[
    {
        "data": "/Users/lorenzo/Desktop/Gassino,_arrival_of_tramway_auto_x2.jpg",
        "metadata": {
            "width": 1500,
            "height": 1200
        },
        "contextData": {
            "key1": "value1"
        }
    }
]
```

* **storage\_id:** string, *Optional, default None*
  * This parameter has no function anymore and will be deprecated in the next version of the SDK.
* **batches**: List\[str], *Optional, default None*
  * You may assign the files you are uploading to one or more batches that exist in your project by providing their IDs here. You may create new batches with [create\_batch](#create_batch-project_id-batch_name) and you can get a list of batches with [get\_batches](#get_batches-project_id).
  * Example: `['0000000aa0a00a0000aaaa0a', '0000000aa0a00a0000aaaa0b']`
* **priority:** int, *Optional, default 0*
  * The new priority value to assign to the uploaded assets.
  * **Note:** The priority value must be between -1000 and 1000. Higher values indicate higher priority.

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.

{% hint style="warning" %}
The `upload_files` function is supported only for Ango projects. Local file uploads are disabled for PCT projects, please use the [`upload_files_cloud`](/sdk/sdk-documentation/project-level-sdk-functions/upload_files_cloud.md) function instead.
{% endhint %}

<details open>

<summary><strong>How to verify in Ango Hub?</strong></summary>

After successfully executing the `upload_files` function, you can validate the changes directly in Ango Hub.

Navigate to: **Projects → \[Your Project] → Asset**

* Ensure that all assets have been successfully imported and are visible in the project.

{% hint style="info" %}
Changes made via the SDK are reflected in Ango Hub in near real-time. If updates are not immediately visible, please refresh the page.
{% endhint %}

</details>

### Example

Importing two local files:

{% 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)

files = ["data/my_image_1.png", "data/my_image_2.png"]
ango_sdk.upload_files(project_id=project_id, file_paths=files)
```

{% endtab %}
{% endtabs %}

Importing a file with a custom external 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')

ango_sdk = SDK(api_key)

files = [{"data": "data/my_image_1.png", "externalId": "custom_external_id"}]
ango_sdk.upload_files(project_id=project_id, file_paths=files)
```

{% endtab %}
{% endtabs %}

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

[upload\_files\_cloud](/sdk/sdk-documentation/project-level-sdk-functions/upload_files_cloud.md), [upload\_files\_with\_asset\_builder](/sdk/sdk-documentation/project-level-sdk-functions/upload_files_with_asset_builder.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/upload_files.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.
