# 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](https://docs.imerit.net/sdk/sdk-documentation/..#project-ids) or retrieve it using the [`list_projects`](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/list_projects) 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']`&#x20;
* **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`](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/upload_files_cloud) function instead.
{% endhint %}

### 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](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/upload_files_cloud), [upload\_files\_with\_asset\_builder](https://docs.imerit.net/sdk/sdk-documentation/project-level-sdk-functions/upload_files_with_asset_builder)
{% endhint %}
