|
| 1 | +--- |
| 2 | +linkTitle: "Upload data" |
| 3 | +title: "Upload data to Viam" |
| 4 | +images: ["/services/icons/data-folder.svg"] |
| 5 | +weight: 60 |
| 6 | +layout: "docs" |
| 7 | +type: "docs" |
| 8 | +languages: ["python"] |
| 9 | +viamresources: ["data_manager"] |
| 10 | +aliases: |
| 11 | + - /data/upload/ |
| 12 | + - /services/data/upload/ |
| 13 | + - /how-tos/upload-data/ |
| 14 | + - /data-ai/ai/advanced/upload-external-data/ |
| 15 | + - /data-ai/ai/advanced/ |
| 16 | + - /data-ai/train/upload-external-data/ |
| 17 | +date: "2024-12-04" |
| 18 | +updated: "2025-09-11" |
| 19 | +description: "Upload data to Viam from your local computer or mobile device using the data client API, Viam CLI, or Viam mobile app." |
| 20 | +--- |
| 21 | + |
| 22 | +When you configure the data management service, Viam automatically uploads data from the default directory `~/.viam/capture` and any directory you configured. |
| 23 | +If you want to upload data from another directory or source, you can also: |
| 24 | + |
| 25 | +- [Sync a batch of data from another directory](#sync-a-batch-of-data-from-another-directory) |
| 26 | +- [Upload data with SDKs](#upload-data-with-sdks) |
| 27 | +- [Upload images with the Viam mobile app](#upload-images-with-the-viam-mobile-app) |
| 28 | + |
| 29 | +## Sync a batch of data from another directory |
| 30 | + |
| 31 | +Typically, you configure the data management service to [capture and sync data from your machine at regular intervals](/data-ai/capture-data/capture-sync/). |
| 32 | +However, you can also use the data management service to sync data from a folder. |
| 33 | +This can be a dataset you wish to upload once or data that is periodically written to a folder on your system. |
| 34 | + |
| 35 | +### Prerequisites |
| 36 | + |
| 37 | +{{% expand "A running machine connected to Viam" %}} |
| 38 | + |
| 39 | +{{% snippet "setup-both.md" %}} |
| 40 | + |
| 41 | +{{% /expand%}} |
| 42 | + |
| 43 | +### Instructions |
| 44 | + |
| 45 | +{{% alert title="Data will be removed from the device once uploaded to Viam" color="caution" %}} |
| 46 | + |
| 47 | +If you do not want the data deleted from your machine, copy the data to a new folder and sync that folder instead so that your local copy remains. |
| 48 | + |
| 49 | +{{% /alert %}} |
| 50 | + |
| 51 | +{{< table >}} |
| 52 | +{{% tablestep start=1 %}} |
| 53 | +**Add the data management service** |
| 54 | + |
| 55 | +On your machine's **CONFIGURE** tab, click the **+** icon next to your machine part in the left-hand menu and select **Component or service**. |
| 56 | + |
| 57 | +Select the `data management` service and click **Create**. |
| 58 | +On the data management panel, you can see the configuration options. |
| 59 | +You can leave the default data sync interval of `0.1` minutes to sync every 6 seconds. |
| 60 | + |
| 61 | +{{% /tablestep %}} |
| 62 | +{{% tablestep %}} |
| 63 | +**Configure sync from the additional folder** |
| 64 | + |
| 65 | +In the **Additional paths**, enter the full path to the directory with the data you want to upload, for example, `/Users/Artoo/my_cat_photos`. |
| 66 | +All of the data in the folder will be synced, so be sure that you want to upload all of the contents of the folder before saving your configuration. |
| 67 | + |
| 68 | +Toggle **Syncing** to on (green) if it isn't already on. |
| 69 | + |
| 70 | +Click **Save** in the top right corner of the page. |
| 71 | + |
| 72 | +{{<imgproc src="/services/data/data-sync-temp.png" resize="x1100" declaredimensions=true alt="Data service configured as described." class="shadow" >}} |
| 73 | + |
| 74 | +{{% /tablestep %}} |
| 75 | +{{% tablestep %}} |
| 76 | +**Confirm that your data uploaded** |
| 77 | + |
| 78 | +Navigate to your [**DATA** page](https://app.viam.com/data/view) and confirm that your data appears there. |
| 79 | +If you don't see your files yet, wait a few moments and refresh the page. |
| 80 | + |
| 81 | +{{% /tablestep %}} |
| 82 | +{{< /table >}} |
| 83 | + |
| 84 | +## Upload data with SDKs |
| 85 | + |
| 86 | +You can use the [Data Client API](/dev/reference/apis/data-client/) to upload files to the Viam Cloud. |
| 87 | + |
| 88 | +Unlike when using the data management service, using the [`FileUploadFromPath`](/dev/reference/apis/data-client/#fileuploadfrompath) method uploads the files even if they already exist in the cloud. |
| 89 | +In other words, it duplicates data if you run it multiple times. |
| 90 | + |
| 91 | +Also unlike data sync, this method _does not_ delete data from your device. |
| 92 | + |
| 93 | +### Instructions |
| 94 | + |
| 95 | +{{< table >}} |
| 96 | +{{% tablestep start=1 %}} |
| 97 | +**Get API key** |
| 98 | + |
| 99 | +Go to your organization's setting page and create an API key for a {{< glossary_tooltip term_id="part" text="machine part" >}}, {{< glossary_tooltip term_id="part" text="machine" >}}, {{< glossary_tooltip term_id="location" text="location" >}}, or {{< glossary_tooltip term_id="organization" text="organization" >}}. |
| 100 | + |
| 101 | +{{% /tablestep %}} |
| 102 | +{{% tablestep %}} |
| 103 | +**Upload a file from a path** |
| 104 | + |
| 105 | +Use the [`FileUploadFromPath`](/dev/reference/apis/data-client/#fileuploadfrompath) method to upload a file. |
| 106 | + |
| 107 | +You must provide a {{< glossary_tooltip term_id="part" text="machine part" >}} ID to associate data with. |
| 108 | + |
| 109 | +{{< tabs >}} |
| 110 | +{{< tab name="Python" >}} |
| 111 | + |
| 112 | +To upload just one file, make a call to [`file_upload_from_path`](/dev/reference/apis/data-client/#fileuploadfrompath): |
| 113 | + |
| 114 | +{{< read-code-snippet file="/static/include/examples-generated/upload-single-file.snippet.upload-single-file.py" lang="py" class="line-numbers linkable-line-numbers" data-line="31-38" >}} |
| 115 | + |
| 116 | +{{% /tab %}} |
| 117 | +{{< tab name="Go" >}} |
| 118 | + |
| 119 | +{{< read-code-snippet file="/static/include/examples-generated/upload-single-file.snippet.upload-single-file.go" lang="go" class="line-numbers linkable-line-numbers" data-line="33-40" >}} |
| 120 | + |
| 121 | +{{% /tab %}} |
| 122 | +{{< /tabs >}} |
| 123 | + |
| 124 | +{{% /tablestep %}} |
| 125 | +{{% tablestep %}} |
| 126 | +**Run your code** |
| 127 | + |
| 128 | +Save and run your code once. |
| 129 | +Running your code more than once will duplicate the data. |
| 130 | + |
| 131 | +{{% /tablestep %}} |
| 132 | +{{% tablestep %}} |
| 133 | +**Confirm that your data uploaded** |
| 134 | + |
| 135 | +Navigate to your [**DATA** page](https://app.viam.com/data/view) and confirm that your data appears there. |
| 136 | + |
| 137 | +{{% /tablestep %}} |
| 138 | +{{< /table >}} |
| 139 | + |
| 140 | +## Upload images with the Viam mobile app |
| 141 | + |
| 142 | +Upload images as machine data straight from your phone, skipping the normal data capture and cloud synchronization process, through the [Viam mobile app](/manage/troubleshoot/teleoperate/default-interface/#viam-mobile-app). |
| 143 | +This is useful if you want to capture images for training machine learning models on the go. |
| 144 | + |
| 145 | +### Prerequisites |
| 146 | + |
| 147 | +{{< expand "Download the Viam mobile app and sign into your Viam account" >}} |
| 148 | + |
| 149 | +Install the mobile app from the [App Store](https://apps.apple.com/vn/app/viam-robotics/id6451424162) or [Google Play](https://play.google.com/store/apps/details?id=com.viam.viammobile&hl=en&gl=US). |
| 150 | + |
| 151 | +<a href="https://apps.apple.com/vn/app/viam-robotics/id6451424162" target="_blank"> |
| 152 | + <img src="https://github.com/viamrobotics/docs/assets/90707162/a470b65d-1b97-412f-9f97-daf902f2f053" width="200px" alt="apple store icon" class="center-if-small" > |
| 153 | +</a> |
| 154 | + |
| 155 | +<a href="https://play.google.com/store/apps/details?id=com.viam.viammobile&hl=en&gl=US" target="_blank"> |
| 156 | + <img src="https://github.com/viamrobotics/docs/assets/90707162/6ebd6960-08c5-41d4-81f9-42293fbfdfd4" width="200px" alt="google play store icon" class="center-if-small" > |
| 157 | +</a> |
| 158 | + |
| 159 | +{{< /expand >}} |
| 160 | + |
| 161 | +### Instructions |
| 162 | + |
| 163 | +{{< table >}} |
| 164 | +{{% tablestep start=1 %}} |
| 165 | +**Navigate to your machine** |
| 166 | + |
| 167 | +In the Viam mobile app, select an organization by clicking on the menu icon in the top left corner. |
| 168 | + |
| 169 | +Tap the **Locations** tab and select a location, then select the machine you want your data to be associated with. |
| 170 | + |
| 171 | +{{% /tablestep %}} |
| 172 | +{{% tablestep %}} |
| 173 | +**Upload images** |
| 174 | + |
| 175 | +Tap the menu button marked "**...**" in the upper right corner. |
| 176 | +Tap **Upload Images**. |
| 177 | + |
| 178 | +Select each image you want to upload, then tap **Add**. |
| 179 | + |
| 180 | +The uploaded images metadata will contain the machine part you selected. |
| 181 | +However, the uploaded images will not be associated with a component or method. |
| 182 | + |
| 183 | +{{% /tablestep %}} |
| 184 | +{{< /table >}} |
| 185 | + |
| 186 | +## Next steps |
| 187 | + |
| 188 | +If you uploaded a dataset for machine learning, continue to [create a dataset](/data-ai/train/create-dataset/). |
0 commit comments