> 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/upload_files_cloud.md).

# upload\_files\_cloud

`imerit_ango.sdk.SDK.`

## upload\_files\_cloud(project\_id, assets, storage\_id, batches, priority)

Import files in cloud storage 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.
* **assets:** List\[dict]
  * A list of asset dictionaries in the \[{"data": \<URL>, "externalId": "\<external\_id>"}] format.
  * Assets uploaded with this method can also contain attachments, batches, metadata, and contextData.
  * To set an asset's ID instead of letting Ango Hub generate one, include `_id` as a unique, 24-character hexadecimal ObjectId. Invalid or repeated IDs cause the upload to fail.

<details>

<summary>Example</summary>

```json
public_file = [
    {
        "data": "https://angohub-public-assets.s3.eu-central-1.amazonaws.com/CzXTtJV.jpg",
        "externalId": "aws-public.png",
        "_id": "6a5b27011e3e4d5afdd576ff",
        "metadata": {
            "width": 1500,
            "height": 1800
        },
        "contextData": {
            "key1": "value1"
        },
        "batches": ["Batch 1", "Batch 2"]
        "attachments": [
            {'type': "IMAGE", 'value': "https://angohub-public-assets.s3.eu-central-1.amazonaws.com/CzXTtJV.jpg"},
            {'type': "TEXT", 'value': "An attachment."}]
    }
]
```

</details>

{% hint style="info" %}
For image and video attachments, you may provide links to assets in private buckets, provided that you've connected them to Ango Hub. More information on how to do so can be found on the [Attachments](/core-concepts/attachments.md#uploading-attachments-from-private-buckets) page.
{% endhint %}

For Markdown assets, you may directly include the Markdown file as plain text in the `data` field, like so:

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

markdown_text = """
<div style="margin:10px;display:flex;">
    <div style="width:50%">
        <div style="font-size:13px;font-weight:500;display:flex;">
            <div style="width:100px;color:gray">Hello World!</div>
        </div>
    </div>
</div>
"""

external_id = "100001.md"
batch_name = "Batch-1"

file_paths = []
file_paths.append({"data": markdown_text, "externalId": external_id, "batches": [batch_name]})

response = ango_sdk.upload_files_cloud(project_id=project_id, assets=file_paths)
```

{% hint style="info" %}
Batches you specify in the *assets* dictionary will override the batches you specify in the *batches* parameter of this function.
{% endhint %}

* **storage\_id:** string, *Optional, default None*
  * If importing files from a private bucket [previously integrated with Hub](/data/storages/importing-private-cloud-assets-gcp.md), this parameter is necessary. This is the ID of the bucket's integration, obtainable from [`get_storages`](/sdk/sdk-documentation/organization-level-sdk-functions/get_storages.md) function.
* **batches**: List\[str], *Optional, default None*
  * You may add the files being uploaded to one or multiple batches, by passing a list of batch IDs. You may obtain a list of batch IDs available in your project using [`get_batches`](/sdk/sdk-documentation/project-level-sdk-functions/get_batches.md) function, or create new ones using [`create_batch`](/sdk/sdk-documentation/project-level-sdk-functions/create_batch.md) function.
* **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="info" %}
The SDK does not set a separate maximum number of assets for one `upload_files_cloud` call. Project and organization quotas count assets. The JSON request body, including URLs, metadata, context data, and inline annotations, is limited to **50 MiB (52,428,800 bytes)** by the API.

Referenced files remain in cloud storage, so their contents do not count toward the JSON request size. The Browser Upload limit of 5 GB does not apply to those referenced files. Split large imports across smaller calls; the SDK does not split the list automatically. See [Import Limits](/data/importing-assets.md#import-limits) for project quotas, deployment-specific limits, and video file-size guidance.
{% endhint %}

<details open>

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

After successfully executing the `upload_files_cloud` 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 a file from a public bucket, and assigning it to a batch:

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

batch_id_list = ['<YOUR BATCH ID>']
public_file = [{"data": "https://storage.googleapis.com/a-public-bucket/file.png", 
                "externalId": "myExternalId.png"}]

ango_sdk.upload_files_cloud(
    project_id=project_id, 
    assets=public_file, 
    batches=batch_id_list
)
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -X POST "https://imeritapi.ango.ai/v2/project/$PROJECT_ID/cloud?batches=%5B%22<YOUR_BATCH_ID>%22%5D" \
  -H "Content-Type: application/json" \
  -H "apikey: $ANGO_API_KEY" \
  -d '{
    "assets": [
      {
        "data": "https://storage.googleapis.com/a-public-bucket/file.png",
        "externalId": "myExternalId.png"
      }
    ],
    "uploadLocal": null,
    "priority": 0
  }'
```

{% endtab %}
{% endtabs %}

Importing a file from a private bucket, and assigning it to multiple batches:

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

batch_id_list = ['<BATCH ID 1>', '<BATCH ID 2>']
storage_id = '<YOUR_STORAGE_ID>'

private_file = [{"data": "https://storage.googleapis.com/a-private-bucket/file.png",
                 "externalId": "myExternalId.png"}]

ango_sdk.upload_files_cloud(
    project_id=project_id,
    assets=private_file,
    batches=batch_id_list,
    storage_id=storage_id
)
```

{% endtab %}

{% tab title="curl" %}

```bash
curl -X POST "https://imeritapi.ango.ai/v2/project/$PROJECT_ID/cloud?batches=%5B%22<BATCH_ID_1>%22%2C%22<BATCH_ID_2>%22%5D" \
  -H "Content-Type: application/json" \
  -H "apikey: $ANGO_API_KEY" \
  -d '{
    "assets": [
      {
        "data": "https://storage.googleapis.com/a-private-bucket/file.png",
        "externalId": "myExternalId.png",
        "storage": "<YOUR_STORAGE_ID>"
      }
    ],
    "uploadLocal": null,
    "priority": 0
  }'
```

{% endtab %}
{% endtabs %}

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

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