CLI reference

This page documents every command, subcommand, flag, and alias in the Viam CLI. For installation, authentication, and task-oriented guides, see the Viam CLI overview.

All commands use this format:

viam [global options] command [command options] [arguments...]

You can pass global options after the viam CLI keyword with any command.

Global optionDescription
--config, -cLoad configuration from FILE.
--debug, --vvvEnable debug logging. Default: false.
--disable-profiles, --disable-profileDisable usage of profiles, falling back to default behavior. Default: false.
--help, -hShow help. Default: false.
--profileSpecify a particular profile for the current command.
--quiet, -qSuppress warnings. Default: false.

data

The data command allows you to manage machine data. With it, you can export data in a variety of formats, delete data, add or remove tags from all data that matches a given filter, or configure a database user to enable querying synced data directly in the cloud.

viam data export binary filter --destination=<output path> [...named args]
viam data export binary ids --destination=<output path> [...named args]
viam data export tabular --destination=<destination> --part-id=<part-id> --resource-name=<resource-name> --resource-subtype=<resource-subtype> --method=<method> [other options]
viam data delete binary --org-ids=<org-ids> --start=<timestamp> --end=<timestamp> [...named args]
viam data delete tabular --org-id=<org-id> --delete-older-than-days=<N>
viam data database configure --org-id=<org-id> --password=<db-user-password>
viam data database hostname --org-id=<org-id>
viam data tag ids add --tags=<tags> --binary-data-ids=<binary_ids>
viam data tag ids remove --tags=<tags> --binary-data-ids=<binary_ids>
viam data tag filter add --tags=<tags> [...named args from filter]
viam data tag filter remove --tags=<tags> [...named args from filter]
viam data index create --collection-type=<type> --index-path=<file> [--org-id=<org-id>] [--pipeline-name=<name>]
viam data index delete --collection-type=<type> --index-name=<name> [--org-id=<org-id>] [--pipeline-name=<name>]
viam data index list --collection-type=<type> [--org-id=<org-id>]

data export tabular

Export tabular or sensor data to a specified location in the .ndjson output format. You can copy this from the UI with a filter. See Copy export command.

# export tabular data to /home/robot/data for specified part id with resource name my_movement_sensor, subtype movement_sensor and method Readings
viam data export tabular --part-id=e1234f0c-912c-1234-a123-5ac1234612345 --resource-name=my_movement_sensor --resource-subtype=rdk:component:movement_sensor --method=Readings --destination=/home/robot/data
ArgumentDescriptionRequired?
--destinationOutput directory for downloaded data.Required
--part-idFilter by specified part ID.Required
--resource-nameResource name. Sometimes called “component name”.Required
--resource-subtypeResource API namespace triplet.Required
--methodFilter by specified method.Required
--startISO-8601 timestamp indicating the start of the interval.Optional
--endISO-8601 timestamp indicating the end of the interval.Optional
--additional-paramsAdditional parameters to pass to the tabular data export query. Accepts a JSON string of key-value pairs.Optional

data export binary filter

Export binary or image data matching a filter to a specified location. Binary data will be downloaded in the original output it was specified as. You can copy this from the UI with a filter. See Copy export command.

# export binary data from the specified org with mime types image/jpeg and image/png to /home/robot/data
viam data export binary filter --mime-types=image/jpeg,image/png --org-ids=12345678-eb33-123a-88ec-12a345b123a1 --destination=/home/robot/data
ArgumentDescriptionRequired?
--destinationOutput directory for downloaded data.Required
--bbox-labelsString labels corresponding to bounding boxes within images.Optional
--component-nameFilter by specified component name.Optional
--component-typeFilter by specified component type.Optional
--location-idsFilter by specified location ID (accepts comma-separated list). See Using the ids argument for instructions on retrieving these values.Optional
--machine-idFilter by specified machine ID.Optional
--machine-nameFilter by specified machine name.Optional
--methodFilter by specified method.Optional
--mime-typesFilter by specified MIME type (accepts comma-separated list).Optional
--org-idsFilter by specified organizations ID (accepts comma-separated list). See Using the ids argument for instructions on retrieving these values.Optional
--parallelNumber of download requests to make in parallel. Default: 100.Optional
--part-idFilter by specified part ID.Optional
--part-nameFilter by specified part name.Optional
--startISO-8601 timestamp indicating the start of the interval.Optional
--endISO-8601 timestamp indicating the end of the interval.Optional
--tagsFilter by specified tag (accepts comma-separated list).Optional
--timeoutNumber of seconds to wait for file downloads. Default: 30.Optional

data export binary ids

Export binary or image data by binary data ID to a specified location.

viam data export binary ids --destination=<output path> --binary-data-ids=<binary-data-ids>
ArgumentDescriptionRequired?
--destinationOutput directory for downloaded data.Required
--binary-data-idsBinary data IDs to download. Accepts a single ID or a comma-separated list.Required
--timeoutNumber of seconds to wait for file downloads. Default: 30.Optional

data delete binary

Delete binary data from the Viam Cloud.

# delete binary data of mime type image/jpeg in an organization between a specified timestamp
viam data delete binary --org-ids=123 --mime-types=image/jpeg --start 2024-08-20T14:10:34-04:00 --end 2024-08-20T14:16:34-04:00
ArgumentDescriptionRequired?
--org-idsFilter by specified organizations ID (accepts comma-separated list).Required
--startISO-8601 timestamp indicating the start of the interval.Required
--endISO-8601 timestamp indicating the end of the interval.Required
--bbox-labelsString labels corresponding to bounding boxes within images.Optional
--component-nameFilter by specified component name.Optional
--component-typeFilter by specified component type.Optional
--location-idsFilter by specified location ID (accepts comma-separated list).Optional
--machine-idFilter by specified machine ID.Optional
--machine-nameFilter by specified machine name.Optional
--methodFilter by specified method.Optional
--mime-typesFilter by specified MIME type (accepts comma-separated list).Optional
--part-idFilter by specified part ID.Optional
--part-nameFilter by specified part name.Optional
--tagsFilter by specified tag. Accepts tagged for all tagged data, untagged for all untagged data, or a comma-separated list of tags.Optional

Viam currently only supports deleting approximately 500 files at a time. To delete more data iterate over the data with a shell script:

# deleting one hour of image data
for i in {00..59}; do
  viam data delete binary --org-ids=<org-id> --mime-types=image/jpeg,image/png --start=2024-05-13T11:00:00.000Z --end=2024-05-13T11:${i}:00.000Z
done

data delete tabular

Delete tabular data from the Viam Cloud.

viam data delete tabular --org-id=<org-id> --delete-older-than-days=<N>
ArgumentDescriptionRequired?
--org-idThe organization ID.Required
--delete-older-than-daysNumber of days, 0 means all data will be deleted.Required

data database configure

Create a new database user for the Viam organization’s MongoDB Atlas Data Federation instance, or change the password of an existing user. See Configure data query.

# configure a database user for the Viam organization's MongoDB Atlas Data
# Federation instance, in order to query tabular data
viam data database configure --org-id=abc --password=my_password123
ArgumentDescriptionRequired?
--org-idThe organization ID. Uses default org if set.Optional
--passwordPassword for the database user being configured.Required

data database hostname

Get the MongoDB Atlas Data Federation instance hostname and connection URI. See Configure data query.

# get the hostname to access a MongoDB Atlas Data Federation instance
viam data database hostname --org-id=abc
ArgumentDescriptionRequired?
--org-idThe organization ID. Uses default org if set.Optional

data tag ids add

Add tags to all data that matches the given binary data IDs.

# add tags to all data that matches the given ids in the current organization
viam data tag ids add --tags=new_tag_1,new_tag_2,new_tag_3 --binary-data-ids=123,456

See Using the ids argument for details on retrieving the IDs.

ArgumentDescriptionRequired?
--binary-data-idsBinary data IDs to add tags to.Required
--tagsTags to add (accepts comma-separated list).Required

data tag ids remove

Remove tags from all data that matches the given binary data IDs.

# remove tags from all data that matches the given ids in the current organization
viam data tag ids remove --tags=new_tag_1,new_tag_2,new_tag_3 --binary-data-ids=123,456
ArgumentDescriptionRequired?
--binary-data-idsBinary data IDs to remove tags from.Required
--tagsTags to remove (accepts comma-separated list).Required

data tag filter add

Add tags to all data that matches a given filter. See Using the filter argument.

# add tags to all data that matches a given filter
viam data tag filter add --tags=new_tag_1,new_tag_2 --location-ids=012 --machine-name=cool-machine --org-ids=84842  --mime-types=image/jpeg,image/png
ArgumentDescriptionRequired?
--tagsTags to add (accepts comma-separated list).Required
--filter-tagsFilter tags. Options: 'tagged', 'untagged', or a comma-separated list of tags for all data matching any of the tags.Optional
--bbox-labelsString labels corresponding to bounding boxes within images.Optional
--component-nameFilter by specified component name.Optional
--component-typeFilter by specified component type.Optional
--location-idsFilter by specified location ID (accepts comma-separated list).Optional
--machine-idFilter by specified machine ID.Optional
--machine-nameFilter by specified machine name.Optional
--methodFilter by specified method.Optional
--mime-typesFilter by specified MIME type (accepts comma-separated list).Optional
--org-idsFilter by specified organizations ID (accepts comma-separated list).Optional
--part-idFilter by specified part ID.Optional
--part-nameFilter by specified part name.Optional
--startISO-8601 timestamp indicating the start of the interval.Optional
--endISO-8601 timestamp indicating the end of the interval.Optional

data tag filter remove

Remove tags from all data that matches a given filter. See Using the filter argument.

# remove tags from all data that matches a given filter
viam data tag filter remove --tags=new_tag_1 --location-ids=012 --machine-name=cool-machine --org-ids=84842  --mime-types=image/jpeg,image/png
ArgumentDescriptionRequired?
--tagsTags to remove (accepts comma-separated list).Required
--filter-tagsFilter tags. Options: 'tagged', 'untagged', or a comma-separated list of tags for all data matching any of the tags.Optional
--bbox-labelsString labels corresponding to bounding boxes within images.Optional
--component-nameFilter by specified component name.Optional
--component-typeFilter by specified component type.Optional
--location-idsFilter by specified location ID (accepts comma-separated list).Optional
--machine-idFilter by specified machine ID.Optional
--machine-nameFilter by specified machine name.Optional
--methodFilter by specified method.Optional
--mime-typesFilter by specified MIME type (accepts comma-separated list).Optional
--org-idsFilter by specified organizations ID (accepts comma-separated list).Optional
--part-idFilter by specified part ID.Optional
--part-nameFilter by specified part name.Optional
--startISO-8601 timestamp indicating the start of the interval.Optional
--endISO-8601 timestamp indicating the end of the interval.Optional

data index create

Create a custom index on a data collection.

viam data index create --collection-type=<type> --index-path=<file> [--org-id=<org-id>] [--pipeline-name=<name>]
ArgumentDescriptionRequired?
--collection-typeData collection type for index operations. Options: hot-storage, pipeline-sink.Required
--index-pathPath to a JSON file defining the index using MongoDB index specification format.Required
--org-idThe organization ID. Uses default org if set.Optional
--pipeline-nameName of the data pipeline (required when --collection-type is pipeline-sink).Conditional

data index delete

Delete a custom index from a data collection.

viam data index delete --collection-type=<type> --index-name=<name> [--org-id=<org-id>] [--pipeline-name=<name>]
ArgumentDescriptionRequired?
--collection-typeData collection type for index operations. Options: hot-storage, pipeline-sink.Required
--index-nameName of the index to delete.Required
--org-idThe organization ID. Uses default org if set.Optional
--pipeline-nameName of the data pipeline (required when --collection-type is pipeline-sink).Conditional

data index list

List all custom indexes for a data collection.

viam data index list --collection-type=<type> [--org-id=<org-id>]
ArgumentDescriptionRequired?
--collection-typeData collection type for index operations. Options: hot-storage, pipeline-sink.Required
--org-idThe organization ID. Uses default org if set.Optional

datapipelines

The datapipelines command provides access to data pipelines for processing machine data with MQL queries. Data pipelines help you optimize query performance for frequently accessed complex data transformations.

viam datapipelines create --org-id=<org-id> --name=<name> --schedule=<schedule> --mql=<mql-query> --data-source-type=<type> --enable-backfill=False
viam datapipelines rename --id=<pipeline-id> --name=<new-name>
viam datapipelines list --org-id=<org-id>
viam datapipelines describe --id=<pipeline-id>
viam datapipelines enable --id=<pipeline-id>
viam datapipelines disable --id=<pipeline-id>
viam datapipelines delete --id=<pipeline-id>

datapipelines create

Create a new data pipeline.

# create a new data pipeline with standard data source type (default)
viam datapipelines create --org-id=123 --name="Daily Sensor Summary" --schedule="0 9 * * *" --data-source-type=standard --mql='[{"$match": {"component_name": "sensor-1"}}]' --enable-backfill=False

# create a data pipeline with hot storage data source type for faster access
viam datapipelines create --org-id=123 --name="Real-time Analytics" --schedule="*/5 * * * *" --data-source-type=hotstorage --mql='[{"$match": {"component_name": "camera-1"}}]' --enable-backfill=False
ArgumentDescriptionRequired?
--nameName of the data pipeline.Required
--scheduleCron schedule that expresses when the pipeline should run, for example 0 9 * * * for daily at 9 AM.Required
--enable-backfillEnable the data pipeline to run over organization’s historical data. Default: false.Required
--org-idID of the organization that owns the data pipeline. Uses default org if set.Optional
--mqlMQL (MongoDB Query Language) query as a JSON string for data processing. You must specify either --mql or --mql-path when creating a pipeline.Optional
--mql-pathPath to a JSON file containing the MQL query for the data pipeline. You must specify either --mql or --mql-path when creating a pipeline.Optional
--data-source-typeData source type for the pipeline. Options: standard (default), hotstorage.Optional

datapipelines rename

Rename a data pipeline.

viam datapipelines rename --id=<pipeline-id> --name=<new-name>
ArgumentDescriptionRequired?
--idID of the data pipeline.Required
--nameNew name for the data pipeline.Required

datapipelines list

List all data pipelines in an organization.

viam datapipelines list --org-id=123
ArgumentDescriptionRequired?
--org-idID of the organization that owns the data pipelines. Uses default org if set.Optional

datapipelines describe

Get detailed information about a specific data pipeline.

viam datapipelines describe --id=abc123
ArgumentDescriptionRequired?
--idID of the data pipeline.Required

datapipelines enable

Resume executing a disabled data pipeline.

viam datapipelines enable --id=abc123
ArgumentDescriptionRequired?
--idID of the data pipeline.Required

datapipelines disable

Stop executing a data pipeline without deleting it.

viam datapipelines disable --id=abc123
ArgumentDescriptionRequired?
--idID of the data pipeline.Required

datapipelines delete

Delete a data pipeline.

viam datapipelines delete --id=abc123
ArgumentDescriptionRequired?
--idID of the data pipeline.Required

dataset

The dataset command allows you to manage machine data in datasets. With it, you can add or remove images from a dataset, export data from a dataset, or filter a dataset by tags.

viam dataset create --org-id=<org-id> --name=<name>
viam dataset rename --dataset-id=<dataset-id> --name=<name>
viam dataset list --org-id=<org-id>
viam dataset list --dataset-ids=<dataset-ids>
viam dataset delete --dataset-id=<dataset-id>
viam dataset export --destination=<output-directory> --dataset-id=<dataset-id>
viam dataset merge --name=<new-dataset-name> --dataset-ids=<dataset-id-1>,<dataset-id-2> [--org-id=<org-id>]
viam dataset data add filter --dataset-id=<dataset-id> [...named args]
viam dataset data remove filter --dataset-id=<dataset-id> [...named args]
viam dataset data add ids --dataset-id=<dataset-id>  --binary-data-ids=<binary-data-ids>
viam dataset data remove ids --dataset-id=<dataset-id> --binary-data-ids=<binary-data-ids>

dataset create

Create a new dataset.

viam dataset create --org-id=123 --name=MyDataset
ArgumentDescriptionRequired?
--org-idOrganization ID of the organization the dataset belongs to.Required
--nameThe name of the dataset to create.Required

dataset rename

Rename an existing dataset.

viam dataset rename --dataset-id=123 --name=MyCoolDataset
ArgumentDescriptionRequired?
--dataset-idDataset to rename. To retrieve the ID, navigate to your dataset’s page, click … in the left-hand menu, and click Copy dataset ID.Required
--nameThe new name for the dataset.Required

dataset list

List dataset information from specified IDs or for an org ID.

# show dataset information for all datasets within a specified org
viam dataset list --org-id=123

# show dataset information for the specified dataset IDs
viam dataset list --dataset-ids=123,456
ArgumentDescriptionRequired?
--org-idOrganization ID of the organization the dataset belongs to.Optional
--dataset-idsDataset IDs of datasets to be listed (comma-separated list). To retrieve these IDs, navigate to your dataset’s page, click … in the left-hand menu, and click Copy dataset ID.Optional

dataset delete

Delete a dataset.

viam dataset delete --dataset-id=123
ArgumentDescriptionRequired?
--dataset-idDataset to delete.Required

dataset export

Download all the data from a dataset to a specified output directory in two folders called “data” and “metadata”.

viam dataset export --destination=./dataset/example --dataset-id=abc
ArgumentDescriptionRequired?
--dataset-idDataset to export.Required
--destinationOutput directory for downloaded data.Required
--only-jsonlInclude only the JSON Lines files for local testing. No binary data is downloaded.Optional
--force-linux-pathForce the use of Linux-style paths in the dataset.jsonl file.Optional
--parallelNumber of download requests to make in parallel. Default: 100.Optional
--timeoutNumber of seconds to wait for large file downloads. Default: 30.Optional

dataset merge

Merge multiple datasets into a new dataset.

viam dataset merge --name=CombinedDataset --dataset-ids=123,456 --org-id=789
ArgumentDescriptionRequired?
--nameThe name of the new merged dataset.Required
--dataset-idsDataset IDs of datasets to merge (comma-separated list).Required
--org-idOrganization ID of the organization the dataset belongs to.Required

dataset data add ids

Add new images to an existing dataset by binary data ID. See Using the ids argument for details on retrieving the IDs.

viam dataset data add ids --dataset-id=abc --binary-data-ids=aaa,bbb
ArgumentDescriptionRequired?
--dataset-idDataset to add images to. To retrieve the ID, navigate to your dataset’s page, click … in the left-hand menu, and click Copy dataset ID.Required
--binary-data-idsThe binary data IDs of the images to add.Required

dataset data add filter

Add to an existing dataset images that match a specified filter.

viam dataset data add filter --dataset-id=abc --location-ids=123 --org-ids=456 --start=2023-01-01T05:00:00.000Z --end=2023-10-01T04:00:00.000Z --tags=example
ArgumentDescriptionRequired?
--dataset-idDataset to add images to.Required
--org-idOrganization ID of the organization the dataset belongs to.Optional
--org-idsOrganization IDs of the organizations to filter data on.Optional
--startISO-8601 timestamp indicating the start of the interval.Optional
--endISO-8601 timestamp indicating the end of the interval.Optional
--tagsFilter by specified tag (accepts comma-separated list).Optional
--bbox-labelsFilter data on bounding box labels. Accepts comma-separated list.Optional
--component-nameFilter data on component name.Optional
--component-typeFilter data on component type.Optional
--location-idsFilter data on location IDs. Accepts comma-separated list.Optional
--machine-idFilter data on machine ID.Optional
--machine-nameFilter data on machine name.Optional
--methodFilter data on capture method.Optional
--mime-typesFilter data on MIME types. Accepts comma-separated list.Optional
--part-idFilter data on part ID.Optional
--part-nameFilter data on part name.Optional

dataset data remove ids

Remove images from an existing dataset by binary data ID. See Using the ids argument for details on retrieving the IDs.

viam dataset data remove ids --dataset-id=abc --binary-data-ids=aaa,bbb
ArgumentDescriptionRequired?
--dataset-idDataset to remove images from.Required
--binary-data-idsThe binary data IDs of the images to remove.Required

dataset data remove filter

Remove from an existing dataset images that match a specified filter.

viam dataset data remove filter --dataset-id=abc --location-ids=123 --org-ids=456 --start=2023-01-01T05:00:00.000Z --end=2023-10-01T04:00:00.000Z --tags=example
ArgumentDescriptionRequired?
--dataset-idDataset to remove images from.Required
--org-idsOrganization IDs of the organizations to filter data on.Optional
--startISO-8601 timestamp indicating the start of the interval.Optional
--endISO-8601 timestamp indicating the end of the interval.Optional
--tagsFilter by specified tag (accepts comma-separated list).Optional
--bbox-labelsFilter data on bounding box labels. Accepts comma-separated list.Optional
--component-nameFilter data on component name.Optional
--component-typeFilter data on component type.Optional
--location-idsFilter data on location IDs. Accepts comma-separated list.Optional
--machine-idFilter data on machine ID.Optional
--machine-nameFilter data on machine name.Optional
--methodFilter data on capture method.Optional
--mime-typesFilter data on MIME types. Accepts comma-separated list.Optional
--part-idFilter data on part ID.Optional
--part-nameFilter data on part name.Optional

Using the ids argument

When you use the viam dataset data add and viam dataset data remove commands, you specify images to add or remove using their binary data IDs as a comma-separated list. For example, the following command adds three images specified by their binary data IDs to the specified dataset:

viam dataset data add ids --binary-data-ids=abc,123 --dataset-id=abc

The following command tags two images specified by their binary data IDs with three tags:

viam data tag ids add --tags=new_tag_1,new_tag_2,new_tag_3 --binary-data-ids=123,456

To find your organization’s ID, run viam organization list or navigate to your organization’s Settings page in the Viam app. Find Organization ID and click the copy icon.

To find the dataset ID of a given dataset, go to the DATASETS subtab of the DATA tab and select a dataset. Click in the left-hand menu and click Copy dataset ID.

To find a location ID, run viam locations list or visit your fleet’s page and copy the Location ID.

To find the binary data ID of a given image, navigate to the DATA tab and select your image. The Binary Data ID is shown under the DETAILS subtab that appears on the right.

You cannot use filter arguments such as --start or --end with the ids argument.

Using the filter argument

When you use the viam dataset data add, viam dataset data remove or viam data tag commands, you can optionally filter by common search criteria to add or remove a specific subset of images based on a search filter. For example, the following command adds all images captured between January 1 and October 1, 2023, that have the example tag applied, to the specified dataset:

viam dataset data add filter --dataset-id=abc --org-ids=123 --start=2023-01-01T05:00:00.000Z --end=2023-10-01T04:00:00.000Z --tags=example

The following command adds "new_tag_1" and "new_tag_2" to all images of type "image/jpeg" or "image/png" captured by the machine named "cool-machine" in organization 8484 and location 012:

viam data tag filter add --tags=new_tag_1,new_tag_2 --location-ids=012 --machine-name=cool-machine --org-ids=84842  --mime-types=image/jpeg,image/png

To find the dataset ID of a given dataset, go to the DATASETS subtab under the DATA tab and select a dataset. Click in the left-hand menu and click Copy dataset ID.

To find a location ID, run viam locations list or visit your fleet’s page and copy from Location ID.

Copy export command

You can also have the filter parameters generated for you using the Filters pane of the DATA tab. Navigate to the DATA tab, make your selections from the search parameters under the Filters pane (such as robot name, start and end time, or tags), and click the Copy export command button. A viam data export command string will be copied to your clipboard that includes the search parameters you selected. Removing the viam data export string, you can use the same filter parameters (such as --start, --end, etc) with your viam data database add filter, viam data database remove filter, or viam data tag filter commands, except you must exclude the data type binary and tabular subcommands and --destination flags, which are specific to viam data export.

You cannot use the --binary-data-ids argument when using filter.

See Create a dataset for more information.

defaults

The defaults command sets or clears default argument values so you do not have to pass the same --org-id or --location-id flag on every command. Once set, the value is read from your CLI config and used as the default for any command that accepts that argument.

viam defaults set-org --org-id=<org-id>
viam defaults clear-org
viam defaults set-location --location-id=<location-id>
viam defaults clear-location

defaults set-org

Set the default organization argument.

ArgumentDescriptionRequired?
--org-idThe organization ID to set as the default.Required

defaults clear-org

Clear the default organization argument.

defaults set-location

Set the default location argument.

ArgumentDescriptionRequired?
--location-idThe location ID to set as the default.Required

defaults clear-location

Clear the default location argument.

infer

The infer command enables you to run cloud inference on data. Cloud inference runs in the cloud, instead of on a local machine.

viam infer --binary-data-id <binary-data-id> --model-name <model-name> --model-org-id <org-id-that-owns-model> --model-version "2025-04-14T16-38-25" --org-id <org-id-that-executes-inference>
Inference Response:
Output Tensors:
  Tensor Name: num_detections
    Shape: [1]
    Values: [1.0000]
  Tensor Name: classes
    Shape: [32 1]
    Values: [...]
  Tensor Name: boxes
    Shape: [32 1 4]
    Values: [...]
  Tensor Name: confidence
    Shape: [32 1]
    Values: [...]
Annotations:
Bounding Box Format: [x_min, y_min, x_max, y_max]
  No annotations.
ArgumentDescriptionRequired?
--binary-data-idThe binary data ID of the image you want to run inference on.Required
--model-nameThe name of the model that you want to run in the cloud.Required
--model-versionThe version of the model that you want to run in the cloud. To find the latest version string for a model, visit the registry page for that model. You can find the latest version string in the Version history section, for instance “2024-02-16T12-55-32”. Pass this value as a string, using double quotes.Required
--org-idThe organization ID of the organization that will run the inference.Required
--model-org-idThe organization ID of the organization that owns the model.Required

locations

The locations command allows you to manage the locations that you have access to. With it, you can list available locations, filter locations by organization, or create a new location API key.

viam locations list [--organization=<organization>]
viam locations api-key create [--location-id=<location-id>] [--name=<name>] [--org-id=<org-id>]

locations list

List all locations (name and id) that the authenticated session has access to, grouped by organization.

viam locations list [--organization=<organization>]
ArgumentDescriptionRequired?
--organizationRestrict results to this organization. Default: the org set by viam defaults set-org if it exists, else the first one alphabetically.Optional

locations api-key create

Create an API key for a specific location.

viam locations api-key create --location-id=<location-id>
ArgumentDescriptionRequired?
--location-idThe location to create an API key for. Default: the default location set with viam defaults set-location.Optional
--nameThe name of the API key. Default: your login info with the current time.Optional
--org-idThe organization ID to attach the key to. Default: attempts to attach the key to the org of the location if only one org is attached to the location.Optional

login

The login command authorizes your device for CLI usage. By default, viam login opens a browser to authenticate using a personal access token. Pass --no-browser to authenticate in a headless environment without opening a browser. Use viam login api-key to authenticate using an API key, or viam login print-access-token to print the access token used by the current session. See Authenticate.

viam login [--no-browser]
viam login api-key --key-id=<api-key-uuid> --key=<api-key-secret-value>
viam login print-access-token
ArgumentDescriptionRequired?
--no-browserAuthenticate in a headless environment by preventing the opening of the default browser during login. Default: false.Optional

login api-key

Authenticate to Viam using an organization, location, or machine part API key.

viam login api-key --key-id=<api-key-uuid> --key=<api-key-secret-value>
ArgumentDescriptionRequired?
--key-idThe key id (UUID) of the API key.Required
--keyThe key value of the API key.Required

login print-access-token

Print the access token used to authenticate the current CLI session.

viam login print-access-token

logout

The logout command ends an authenticated CLI session.

viam logout

machines (aliases robots, robot, machine)

The machines command allows you to manage your machine fleet. This includes:

  • Creating, updating, and deleting machines
  • Listing all machines that you have access to, filtered by organization and location.
  • Creating API keys to grant access to a specific machine
  • Retrieving machine and machine part status
  • Retrieving machine and machine part logs
  • Controlling a machine by issuing component and service commands
  • Accessing your machine with a secure shell (when this feature is enabled)
  • Copy files from and to machines
  • Enter an interactive terminal on your machines
viam machines create --name=<machine name> --location=<location id>
viam machines update --machine=<machine id> [--new-name=<new name>] [--new-location=<new location id>]
viam machines delete --machine=<machine id>
viam machines list
viam machines status --machine=<machine id>
viam machines logs --machine=<machine id> [...named args]
viam machines api-key create --machine-id=<machine id> --org-id=<org id> --name=<key name>
viam machines part list --machine=<machine id>
viam machines part logs --part=<part id> [...named args]
viam machines part status --part=<part id>
viam machines part run --part=<part id> --method=<method> [--data=<data>] [--stream=<interval>]
viam machines part shell --machine=<machine id> --part=<part id>
viam machines part restart --machine=<machine id> --part=<part id>
viam machines part history --part=<part id>
viam machines part cp --part=<part id> <file name> machine:/path/to/file
viam machines part add-job --part=<part id> [--config=<json or path>]
viam machines part update-job --part=<part id> --name=<job name> --config=<json or path>
viam machines part delete-job --part=<part id> --name=<job name>
viam machines part add-trigger --part=<part id> [--config=<json or path>]
viam machines part delete-trigger --part=<part id> --name=<trigger name>

To use part shell and part cp, add the ViamShellDanger fragment, which contains the latest version of the shell service.

machines create

Create a new machine in a specified location.

viam machines create --name="My Machine" --location=12345
ArgumentDescriptionRequired?
--nameName for the machine.Required
--locationID of the location that the machine belongs to.Required

machines update

Move a machine from one location to another and/or rename the machine.

viam machines update --machine=123 --new-name="New Name"
viam machines update --machine=123 --new-location=67890
ArgumentDescriptionRequired?
--machineMachine ID or name for which the command is being issued. If machine name is used instead of ID, --organization and --location are required.Required
--new-nameNew name for the machine when renaming.Optional
--new-locationID of the location to move the machine to.Optional
--organizationID of the organization that the machine belongs to.Optional
--locationID of the current location of the machine.Optional

machines delete

Delete a machine. Passing location and organization is optional but speeds up the process.

viam machines delete --machine=123
ArgumentDescriptionRequired?
--machineMachine ID or name.Required
--locationID of the location that the machine belongs to.Optional
--organizationID of the organization that the machine belongs to.Optional

machines list

List all machines that the authenticated session has access to in a specified organization or location. Defaults to first organization and location alphabetically.

# list all machines in an organization, in all locations
viam machines list --all --organization=12345
ArgumentDescriptionRequired?
--allList all machines in the organization. Overrides --location flag. Default: false.Optional
--locationID of the location to list machines in.Optional
--organizationID of the organization to list machines in.Optional

machines status

Retrieve machine status for a specified machine.

# get machine status
viam machines status --machine=123
ArgumentDescriptionRequired?
--machineMachine ID or name.Required
--locationID of the location that the machine belongs to.Optional
--organizationID of the organization that the machine belongs to.Optional

machines logs

Retrieve logs for a specified machine.

# stream logs from a machine
viam machines logs --machine=123
ArgumentDescriptionRequired?
--machineMachine ID or name.Required
--errorsBoolean, return only errors. Default: false.Optional
--levelsFilter logs by levels (debug, info, warn, error). Accepts multiple inputs in comma-separated list.Optional
--keywordFilter logs by keyword.Optional
--startFilter logs to include only those after the start time. Time format example: 2025-01-13T21:30:00Z (ISO-8601 timestamp in RFC3339).Optional
--endFilter logs to include only those before the end time. Time format example: 2025-01-13T21:35:00Z (ISO-8601 timestamp in RFC3339).Optional
--countThe number of logs to fetch.Optional
--formatThe file format for the output file. Options: text or json.Optional
--outputThe path to the output file to store logs in.Optional
--locationID of the location that the machine belongs to.Optional
--organizationID of the organization that the machine belongs to.Optional

machines api-key create

Create an API key for a specific machine.

# create an API key for a machine
viam machines api-key create --machine-id=123 --name=MyKey
ArgumentDescriptionRequired?
--machine-idThe ID of the machine to create an API key for.Required
--nameThe optional name of the API key. If omitted, a name will be auto-generated.Optional

machines part list

List machine parts.

# list machine parts
viam machines part list --machine=123
ArgumentDescriptionRequired?
--machineMachine ID or name.Required
--locationID of the location that the machine belongs to.Optional
--organizationID of the organization that the machine belongs to.Optional

machines part status

Retrieve machine status for a specified machine part.

viam machines part status --machine=<machine id>
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--locationID of the location that the machine belongs to.Optional
--organizationID of the organization that the machine belongs to.Optional

machines part run

Run a component or service command, optionally at a specified interval. For commands that return data in their response, you can use this to stream data. See Using the --stream and --data arguments.

# stream classifications from a machine part every 500 milliseconds from the Viam Vision Service with classifier "stuff_detector"
viam machines part run --part=myrover-main --stream=500ms \
--method=viam.service.vision.v1.VisionService.GetClassificationsFromCamera \
--data='{"name": "vision", "camera_name": "cam", "classifier_name": "stuff_classifier", "n":1}'
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--methodMethod name (for example, DoCommand) or full service method (for example, viam.component.camera.v1.CameraService.DoCommand).Required
--data, -dCommand data for the command being requested to run. See Using the --stream and --data arguments.Optional
--component, -cComponent name. Automatically sets name in --data and resolves short method names.Optional
--stream, -sIf specified, the interval at which to stream the specified data, for example, 100ms or 1s. Default: 0s.Optional
--organizationOrganization ID or name.Optional
--locationLocation ID or name.Optional
--machineMachine ID or name.Optional

machines part logs

Get logs for the specified machine part.

# stream logs from a machine part
viam machines part logs --part=myrover-main --tail=true
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--tailTail (stream) logs. Default: false.Optional
--errorsReturn only errors. Default: false.Optional
--levelsFilter logs by levels (debug, info, warn, error). Accepts multiple inputs in comma-separated list.Optional
--keywordFilter logs by keyword.Optional
--startFilter logs to include only those after the start time.Optional
--endFilter logs to include only those before the end time.Optional
--countThe number of logs to fetch.Optional
--formatThe file format for the output file. Options: text or json.Optional
--outputThe path to the output file to store logs in.Optional

machines part shell

Access a machine part securely using a secure shell to execute commands. To use this feature you must add the ViamShellDanger fragment. The ViamShellDanger fragment contains the latest version of the shell service, which you must add to your machine before copying files or using the shell.

viam machines part shell --machine=<machine id> --part=<part id>
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required

machines part restart

Restart a machine part.

# restart a part of a specified machine
viam machines part restart --part=123
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required

machines part history

Display the configuration history for a machine part.

viam machines part history --part=<part id>
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--organizationOrganization name.Optional
--locationLocation name.Optional
--machineMachine ID or name.Optional
--filter-by-emailShow only history entries saved by this email address.Optional

machines part cp

Copy files to and from a machine part. To use this feature you must add the ViamShellDanger fragment, which contains the shell service, to your machine. Once added you can use cp in a similar way to the Linux scp command to copy files to and from machines.

# Copy a single file to a machine:
viam machines part cp --part=123 my_file machine:/home/user/

# Recursively copy a directory to a machine:
viam machines part cp --part=123 -r my_dir machine:/home/user/

# Copy multiple files to a machine with recursion and keep original permissions and metadata for the files:
viam machines part cp --part=123 -r -p my_dir my_file machine:/home/user/some/existing/dir/

# Copy a single file from a machine to a local destination:
viam machines part cp --part=123 machine:my_file ~/Downloads/

# Recursively copy a directory from a machine to a local destination:
viam machines part cp --part=123 -r machine:my_dir ~/Downloads/

# Copy multiple files from the machine to a local destination with recursion and keep original permissions and metadata for the files:
viam machines part cp --part=123 -r -p machine:my_dir machine:my_file ~/some/existing/dir/
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--recursive, -rRecursively copy files. Default: false.Optional
--preserve, -pPreserve modification times and file mode bits from the source files. Default: false.Optional

machines part tunnel

Tunnel connections to a specified port on a machine part. You must explicitly enumerate ports to which you are allowed to tunnel in your machine’s JSON config. See Tunnel to a machine part.

# tunnel connections to the specified port on a machine part
viam machines part tunnel --part=123 --destination-port=1111 --local-port 2222
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--destination-portThe port on a machine part to tunnel to.Required
--local-portThe local port from which to tunnel.Required

machines part get-ftdc

Download FTDC data from a machine part. Requires the shell service.

# Download FTDC data from a part to a local directory:
viam machines part get-ftdc --part=123 ~/some/existing/dir/
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required

machines part create

Create a new part on a machine.

viam machines part create --machine=<machine id> --part-name=<new part name>
ArgumentDescriptionRequired?
--machineMachine ID or name.Required
--part-nameName for the new part.Required

machines part delete

Delete a part.

viam machines part delete --part=<part id>
ArgumentDescriptionRequired?
--partPart ID to delete.Required

machines part add-resource

Add a component or service to a part’s configuration by specifying an API and model triplet.

viam machines part add-resource --part=<part id> --name=<resource name> --model-name=<namespace:type:model>
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--nameName for the resource.Required
--model-nameModel triplet (namespace:type:model) for the resource to add.Required

machines part remove-resource

Remove a resource from a part’s configuration.

viam machines part remove-resource --part=<part id> --name=<resource name>
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--nameName of the resource to remove.Required

machines part fragments add

Attach a configuration fragment to a part.

viam machines part fragments add --part=<part id> [--fragment=<fragment name or id>]
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--fragmentFragment name or ID to add. If omitted, the CLI prompts interactively.Optional

machines part fragments remove

Detach a configuration fragment from a part.

viam machines part fragments remove --part=<part id> [--fragment=<fragment name or id>]
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--fragmentFragment name or ID to remove. If omitted, the CLI prompts interactively.Optional

machines part motion print-config

Print the motion planning configuration for the part.

viam machines part motion print-config --part=<part id>
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required

machines part motion print-status

Print current motion state for the part.

viam machines part motion print-status --part=<part id>
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required

machines part motion get-pose

Get the pose of a component in a reference frame.

viam machines part motion get-pose --part=<part id> --component=<component name>
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--componentComponent name for the motion command.Required

machines part motion set-pose

Command a component to move to a specific pose.

viam machines part motion set-pose --part=<part id> --component=<component name>
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--componentComponent name for the motion command.Required

machines part add-job

Add a scheduled job that runs a method on a resource at a given interval. Run without --config to launch an interactive builder, or pass --config with inline JSON or a path to a JSON file.

A job config object accepts the following fields:

  • name (required): unique name for this job.
  • schedule (required): one of continuous, a Go duration (for example, 5s, 1h30m, 500ms), or a cron expression (for example, 0 0 * * *, or */5 * * * * * with seconds).
  • resource (required): name of the component or service to run the method on.
  • method (required): gRPC method name. For example, DoCommand or GetReadings.
  • command (optional): JSON object passed as the argument to DoCommand.
  • log_configuration (optional): for example, {"level":"debug"}. Level must be one of debug, info, warn, or error.
# launch the interactive job builder
viam machines part add-job --part=<part id>

# add a job from inline JSON
viam machines part add-job --part=<part id> \
    --config '{"name":"my-job","schedule":"1h","resource":"my-sensor","method":"GetReadings"}'

# add a job from a JSON file
viam machines part add-job --part=<part id> --config ./job.json
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--configJSON job config or path to JSON file. Omit to use the interactive form.Optional
--organizationOrganization name.Optional
--locationLocation name.Optional
--machineMachine ID or name.Optional

machines part update-job

Update an existing job’s configuration by name. The --config flag accepts a single JSON object (inline or a path to a JSON file) with the fields to change. Only the fields provided will be updated; all other fields remain unchanged. The job name cannot be changed.

# change the schedule
viam machines part update-job --part=<part id> --name=my-job --config '{"schedule":"30m"}'

# change multiple fields
viam machines part update-job --part=<part id> --name=my-job \
    --config '{"schedule":"0 0 * * *","method":"DoCommand","command":{"action":"reset"}}'
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--nameName of the job to update.Required
--configJSON job config or path to JSON file with fields to update.Required
--organizationOrganization name.Optional
--locationLocation name.Optional
--machineMachine ID or name.Optional

machines part delete-job

Delete an existing scheduled job by name.

viam machines part delete-job --part=<part id> --name=my-job
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--nameName of the job to delete.Required
--organizationOrganization name.Optional
--locationLocation name.Optional
--machineMachine ID or name.Optional

machines part add-trigger

Add a trigger to a machine part. Run without --config to use an interactive form, or provide --config with inline JSON or a path to a JSON file.

Trigger configs support the following event types:

  • part_online: liveness check.
  • part_data_ingested: fires when data of the specified types is ingested.
  • conditional_data_ingested: fires when data ingested by a specific data capture method matches a condition.
  • conditional_logs_ingested: fires when logs at the specified levels are ingested.

Each trigger requires notifications, an array of objects with type (email or webhook), value, and seconds_between_notifications.

# launch the interactive trigger builder
viam machines part add-trigger --part=<part id>

# add a trigger from inline JSON
viam machines part add-trigger --part=<part id> \
    --config '{"name":"my-online-trigger","event":{"type":"part_online"},"notifications":[{"type":"email","value":"user@example.com","seconds_between_notifications":60}]}'

# add a trigger from a JSON file
viam machines part add-trigger --part=<part id> --config ./trigger.json
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--configJSON trigger config or path to JSON file. Omit to use the interactive form.Optional
--organizationOrganization name.Optional
--locationLocation name.Optional
--machineMachine ID or name.Optional

machines part delete-trigger

Delete a trigger from a machine part by name.

viam machines part delete-trigger --part=<part id> --name=<trigger name>
ArgumentDescriptionRequired?
--partPart ID for which the command is being issued.Required
--nameName of the trigger to delete.Required
--organizationOrganization name.Optional
--locationLocation name.Optional
--machineMachine ID or name.Optional

Using the --stream and --data arguments

Issuing the machines part run command allows you to run component and service (resource) commands for a selected machine part.

You specify the resource method with --method. Use either the short name (for example, DoCommand or GetReadings) together with --component=<name>, or the full protobuf package and method path (for example, viam.service.vision.v1.VisionService.GetClassificationsFromCamera).

The --data parameter accepts method arguments as a JSON object. For example:

viam machines part run --part=<part-id> \
    --method=viam.service.vision.v1.VisionService.GetClassificationsFromCamera \
    --data='{"name": "vision", "camera_name": "cam", "classifier_name": "my_classifier", "n":1}'

You can find the protobuf path for any Viam package and method in the Viam API package by navigating to the component or service directory and then clicking on the resource file. The protobuf path is the package name.

The --stream argument streams data back at the specified interval, for example 100ms or 1s.

metadata

The metadata command allows you to read organization, location, machine, and machine part metadata.

viam metadata read --part-id=<part-id>

metadata read

Read organization, location, machine, and machine part metadata.

ArgumentDescriptionRequired?
--location-idThe ID of the location to read metadata from.Optional
--machine-idThe ID of the machine to read metadata from.Optional
--org-idThe ID of the org to read metadata from.Optional
--part-idThe ID of the part to read metadata from.Optional

module

The module command allows to you to work with modules. This includes:

  • Generating stub files for a new module
  • Creating metadata for a modular resource
  • Uploading a new module to the registry
  • Uploading a new version of your module to the registry
  • Updating an existing module in the Viam Registry
  • Updating a module’s metadata file based on models it provides
  • Building your module for different architectures using cloud runners
  • Building a module locally and running it on a target device. Rebuilding & restarting if already running.
  • Downloading a module package from the registry

See Update and manage modules you created for more information.

If you update and release your module as part of a continuous integration (CI) workflow, you can also automatically upload new versions of your module on release using a GitHub Action.

viam module generate
viam module create --name=<module-name> [--org-id=<org-id> | --public-namespace=<namespace>]
viam module update [--module=<path to meta.json>]
viam module update-models [--binary=<binary>] [...named args]
viam module build start --version=<version> [...named args]
viam module build local --module=<path to meta.json> [arguments...]
viam module build list [command options] [arguments...]
viam module build logs --build-id=<build-id> [...named args]
viam module reload [...named args]
viam module upload --version=<version> --platform=<platform> [--org-id=<org-id> | --public-namespace=<namespace>] [--module=<path to meta.json>] <module-path> --tags=<tags>
viam module download [command options]
viam module local-app-testing --app-url http://localhost:3000

module generate

Generate a new module with stub files and a meta.json file. Recommended when starting a new module.

# auto-generate stub files for a new modular resource by following prompts
viam module generate

The viam module generate command can generate code for the following resource types:

Components:

  • Arm component
  • Audio input component
  • Base component
  • Board component
  • Camera component
  • Encoder component
  • Gantry component
  • Generic component
  • Gripper component
  • Input component
  • Motor component
  • Movement sensor component
  • Pose tracker component
  • Power sensor component
  • Sensor component
  • Servo component

Services:

  • Generic service
  • MLModel service
  • Motion service
  • Navigation service
  • SLAM service
  • Vision service
ArgumentDescriptionRequired?
--nameName to use for the module. For example, a module that contains sensor implementations might be named sensors. We recommend not using this option and instead following the prompts.Optional
--languageLanguage to use for the module. Options: python, go. We recommend not using this option and instead following the prompts.Optional
--visibilityModule visibility. Options: private, public, public_unlisted. We recommend not using this option and instead following the prompts.Optional
--public-namespaceNamespace or organization ID of the module. Must be either a valid organization ID, or a namespace that exists within a user organization. We recommend not using this option and instead following the prompts.Optional
--resource-subtypeThe API to implement with the modular resource. For example, motor. We recommend not using this option and instead following the prompts after running the command.Optional
--model-nameName for the particular resource subtype implementation. For example, a sensor model that detects moisture might be named moisture. We recommend not using this option and instead following the prompts.Optional
--registerRegister the module with Viam to associate it with your organization. Default: false.Optional

module create

Generate a meta.json file and register the metadata with the Viam registry. Recommended when you already have working module code.

# generate metadata for and register a module named 'my-module' using your organization's public namespace:
viam module create --name=my-module --public-namespace=my-namespace

# generate metadata for and register a module named "my-module" using your organization's organization ID:
viam module create --name=my-module --org-id=abc
ArgumentDescriptionRequired?
--nameThe name of the module. For example: hello-world.Required
--org-idThe organization ID to associate the module to. See Using the --org-id and --public-namespace arguments.Required
--public-namespaceThe namespace to associate the module to. See Using the --org-id and --public-namespace arguments.Required
--local-onlyCreate a meta.json file for local use, but don’t create the module on the backend. Default: false.Optional

module update

Update your module’s metadata and documentation in the Viam registry. Updates are based on changes to meta.json, the module README.md, and the model readme namespace_module_model.md. Viam automatically runs update when you upload your module, as well as when you trigger a cloud build with Viam’s default build action.

# update an existing module
viam module update --module=./meta.json
ArgumentDescriptionRequired?
--moduleThe path to the meta.json file for the module, if not in the current directory.Optional

module update-models

Update the module’s metadata file with the models it provides.

# update a module's metadata file based on models it provides
viam module update-models --binary=./packaged-module.tar.gz --module=./meta.json
ArgumentDescriptionRequired?
--binaryThe module executable to run (binary or script). Must work on the OS or processor of the device. If omitted, the CLI uses the entrypoint defined in meta.json.Optional
--moduleThe path to the meta.json file for the module, if not in the current directory.Optional

module upload

Validate and upload a new or existing custom module on your local filesystem to the Viam Registry. See Upload validation for more information.

Pass the path to the file, directory, or compressed archive (with .tar.gz or .tgz extension) that contains your custom module code as a positional argument.

# upload a new or updated custom module to the Viam Registry:
viam module upload --version=1.0.0 --platform=darwin/arm64 packaged-module.tar.gz --tags=distro:ubuntu,os_version:20.04,codename:focal,cuda:true,cuda_version:11,jetpack:5
ArgumentDescriptionRequired?
--versionThe version of your module to set for this upload. See Using the --version argument.Required
--platformThe architecture of your module binary. See Using the --platform argument.Required
--org-idThe organization ID to associate the module to. See Using the --org-id and --public-namespace arguments.Required
--public-namespaceThe namespace to associate the module to. See Using the --org-id and --public-namespace arguments.Required
--moduleThe path to the meta.json file for the module, if not in the current directory. Default: ./meta.json.Optional
--nameName of the module. Used if you don’t have a meta.json.Optional
--uploadThe path to the upload.Optional
--tagsComma-separated list of platform tags that determine to which platforms this binary can be deployed. Examples: distro:debian,distro:ubuntu, os_version:22.04,os_codename:jammy. For a machine to use an uploaded binary, all tags must be satisfied as well as the --platform field.
  • distro: Distribution. You can find this in /etc/os-release. "debian" or "ubuntu".
  • os_version: Operating System version. On Linux, you can find this in /etc/os-release. Example for linux: 22.04. On Mac, run sw_vers --productVersion and use the major version only. Example for mac: 14.
  • codename: The operating system codename. Find this in /etc/os-release. For example: "bullseye", "bookworm", or "jammy".
  • cuda: Whether using CUDA compiler. Run nvcc --version. For example: "true".
  • cuda_version: The CUDA compiler version. Run nvcc --version. For example: "11" or "12".
  • jetpack: Version of the NVIDIA JetPack SDK. Run apt-cache show nvidia-jetpack. For example: "5".
  • pi: Version of the Raspberry Pi: "4" or "5".
  • pifull: Compute module or model number, for example cm5p or 5B.
Optional
--forceSkip local validation of the packaged module, which may result in an unusable module if the contents of the packaged module are not correct.Optional

module reload

Build a module in the cloud and configure the target machine to download it directly. Rebuild and restart if the module is already running.

# build a module and run it on target machine
viam module reload --part-id e1234f0c-912c-1234-a123-5ac1234612345
ArgumentDescriptionRequired?
--part-idPart ID of the machine part. Get from the Live/Offline dropdown in the web app. Default: the part ID present in the cloud credentials at /etc/viam.json.Optional
--cloud-configThe location of the viam.json file which contains the machine ID to lookup the part-id. Alternative to --part-id. Default: /etc/viam.json.Optional
--moduleThe path to the meta.json file for the module, if not in the current directory. Default: meta.json.Optional
--model-nameIf passed, creates a resource in the part config with the given model triple. Use with --resource-name. Default: Creates no new resource.Optional
--resource-nameIf passed, creates a new resource with the given resource name. Use with --model-name. Default: resource type with a unique numerical suffix.Optional
--pathThe path to the root of the module’s git repo to build. Default: ..Optional
--workdirUse this to indicate that your meta.json is in a subdirectory of your repo. --module flag should be relative to this. Default: ..Optional

module reload-local

Build a module locally and run it on a target machine. Rebuild and restart if it is already running. The module is loaded to ~/.viam/packages-local/namespace_module-name_from_reload-module.tar.gz on the target machine.

# build and configure a module running on your local machine without shipping a tarball.
viam module reload-local --local
ArgumentDescriptionRequired?
--idThe module ID (namespace:module-name or org-id:module-name).Optional
--part-idPart ID of the machine part. Required if running on a remote device.Optional
--cloud-configThe location of the viam.json file which contains the machine ID to lookup the part-id. Alternative to --part-id. Default: /etc/viam.json.Optional
--moduleThe path to the meta.json file for the module, if not in the current directory.Optional
--model-nameIf passed, creates a resource in the part config with the given model triple. Use with --resource-name. Default: Creates no new resource.Optional
--resource-nameIf passed, creates a new resource with the given resource name. Use with --model-name. Default: Creates no new resource.Optional
--localUse if the target machine is localhost, to run the entrypoint directly rather than transferring a bundle. Default: false.Optional
--workdirUse this to indicate that your meta.json is in a subdirectory of your repo. --module flag should be relative to this. Default: ..Optional
--no-buildSkip build step. Default: false.Optional
--no-progressHide progress of the file transfer. Default: false.Optional
--homeSpecify home directory for a remote machine where $HOME is not the default /root.Optional
--nameThe name of the module. For example: hello-world.Optional

module restart

Restart a running module.

# restart a running module
viam module restart --id viam:python-example-module
ArgumentDescriptionRequired?
--idID of the module to restart, for example viam:wifi-sensor. Pass at most one of --name, --id.Optional
--nameName of the module to restart. Pass at most one of --name, --id.Optional
--part-idPart ID of the machine part. Required if running on a remote device. Default: the part ID present in /etc/viam.json.Optional
--cloud-configThe location of the viam.json file which contains the machine ID to lookup the part-id. Alternative to --part-id. Default: /etc/viam.json.Optional
--moduleThe path to the meta.json file. Used for module ID. Can be overridden with --id or --name. Default: meta.json.Optional

module build start

Start a module build in a cloud runner using the build step in your meta.json file. See Using the build subcommand.

# initiate a cloud build for a public GitHub repo
viam module build start --version "0.1.2"

# initiate a cloud build for a private GitHub repo
viam module build start --version "0.1.2" --token ghp_1234567890abcdefghijklmnopqrstuvwxyzABCD
ArgumentDescriptionRequired?
--versionThe version of your module to set for this build. See Using the --version argument.Required
--moduleThe path to the meta.json file for the module, if not in the current directory.Optional
--platformsList of platforms to cloud build for. Default: build.arch in meta.json.Optional
--refGit reference to clone when building your module. This can be a branch name or a commit hash. Default: main.Optional
--tokenGitHub token with repository Contents read access, and Actions read and write access. Required for private repos, not necessary for public repos.Optional
--workdirUse this to indicate that your meta.json is in a subdirectory of your repo. --module flag should be relative to this. Default: ..Optional

module build local

Start a module build locally using the build step in your meta.json file. See Using the build subcommand.

# initiate a build locally without running a cloud build job
viam module build local
ArgumentDescriptionRequired?
--moduleThe path to the meta.json file for the module, if not in the current directory.Optional

module build list

List the status of your cloud module builds. See Using the build subcommand.

# list all in-progress builds and their build status
viam module build list
ArgumentDescriptionRequired?
--modulePath to meta.json. Default: ./meta.json.Optional
--idRestrict output to just return builds that match this build ID.Optional
--countNumber of cloud builds to list. Defaults to displaying all builds.Optional

module build logs

Show the logs from a specific cloud module build. See Using the build subcommand.

# initiate a build and return the build logs as soon as completed
viam module build logs --wait --build-id=$(viam module build start --version "0.1.2")
ArgumentDescriptionRequired?
--build-idThe build ID to show logs for, as returned from build start.Required
--platformRestricts the logs returned by the command to only those build jobs that match the specified platform. See Using the --platform argument. Default: all platforms.Optional
--waitWait for the build to finish before outputting any logs. Default: false.Optional
--group-logsWrite ::group:: commands so GitHub Actions logs collapse. Default: false.Optional

module download

Download a module package from the registry.

# download a module package from the registry to the current directory
viam module download --id=acme:my-module

# download a module package from the registry to a specific directory
viam module download --id=acme:my-module --destination=/path/to/download/directory

# download a specific version of a module package for a specific platform
viam module download --id=acme:my-module --version=1.0.0 --platform=linux/amd64
ArgumentDescriptionRequired?
--idThe module ID (namespace:module-name or org-id:module-name).Optional
--versionThe version of the module to download. Defaults to latest.Optional
--platformThe architecture of the module binary to download. See Using the --platform argument.Optional
--destinationOutput directory for downloaded package. Default: ..Optional

module local-app-testing

Test your viam application locally. This will stand up a local proxy at http://localhost:8012 to simulate the Viam application server.

# proxy your local Viam application and open a browser window and navigate to `http://localhost:8012/
viam module local-app-testing --app-url http://localhost:3000
ArgumentDescriptionRequired?
--app-urlThe url where local app is running, including port number. For example http://localhost:5000.Required
--machine-idThe machine ID of the machine you want to test with. You can get your machine ID on the Fleet page.Optional

Using the --org-id and --public-namespace arguments

All of the module commands accept either the --org-id or --public-namespace argument.

  • Use the --public-namespace argument to supply the namespace of your organization. This will upload your module to the Viam Registry and share it with other users.
  • Use the --org-id to provide your organization ID instead, This will upload your module privately within your organization.

You may use either argument for the viam module create command, but must use --public-namespace for the update and upload commands when uploading as a public module ("visibility": "public") to the Viam Registry.

Using the --platform argument

The --platform argument accepts one of the following architectures:

ArchitectureDescriptionCommon use case
anyAny supported OS running any supported architecture.Suitable for most Python modules that do not require OS-level support (such as platform-specific dependencies).
any/amd64Any supported OS running the amd64 architecture.Suitable for most Docker-based modules on amd64.
any/arm64Any supported OS running the arm64 (aarch64) architecture.Suitable for most Docker-based modules on arm64.
linux/anyLinux machines running any architecture.Suitable for Python modules that also require Linux OS-level support (such as platform-specific dependencies).
darwin/anymacOS machines running any architecture.Suitable for Python modules that also require macOS OS-level support (such as platform-specific dependencies).
linux/amd64Linux machines running the Intel x86_64 architecture.Suitable for most C++ or Go modules on Linux amd64.
linux/arm64Linux machines running the arm64 (aarch64) architecture, such as the Raspberry Pi.Suitable for most C++ or Go modules on Linux arm64.
linux/arm32v7Linux machines running the arm32v7 architecture.Suitable for most C++ or Go modules on Linux arm32v7.
linux/arm32v6Linux machines running the arm32v6 architecture.Suitable for most C++ or Go modules on arm32v6.
darwin/amd64macOS machines running the Intel x86_64 architecture.Suitable for most C++ or Go modules on macOS amd64.
darwin/arm64macOS machines running the arm64 architecture, such as Apple Silicon.Suitable for most C++ or Go modules on macOS arm64.
windows/amd64Windows machines running the Intel x86_64 architecture.Suitable for most C++ or Go modules on Windows amd64.

For information on which of these platforms are supported for cloud build, see Supported platforms for automatic updates.

You can use the uname -m command on your computer or board to determine its system architecture.

The viam module upload command only supports one platform argument at a time. If you would like to upload your module with support for multiple platforms, you must run a separate viam module upload command for each platform. Use the same version number when running multiple upload commands of the same module code if only the platform support differs.

If you specify a platform that includes any (such as any, any/amd64, or linux/any), a machine that deploys your module will select the most restrictive architecture from the ones you have provided for your module. For example, if you upload your module with support for any/amd64 and then also upload with support for linux/amd64, a machine running the linux/amd64 architecture deploys the linux/amd64 distribution, while a machine running the darwin/amd64 architecture deploys the any/amd64 distribution.

The Viam Registry page for your module displays the platforms your module supports for each version you have uploaded.

If you are using the build logs command, the --platform argument instead restricts the logs returned by the command to only those build jobs that match the specified platform.

Using the --version argument

The --version argument accepts a valid semver 2.0 version (example: 1.0.0). You set an initial version for your custom module with your first viam module upload command for that module, and can later increment the version with subsequent viam module upload commands.

Once your module is uploaded, users can select which version of your module to use on their machine from your module’s page on the Viam Registry. Users can choose to pin to a specific patch version, permit upgrades within major release families or only within minor releases, or permit continuous updates.

When you update a module configuration and then upload it, the entrypoint for that module defined in the meta.json file is associated with the specific --version for that upload. Therefore, you are able to change the entrypoint file from version to version, if desired.

Upload validation

When you upload a module, the command performs basic validation of your module to check for common errors. The following criteria are checked for every upload:

  • The module must exist on the filesystem at the path provided to the upload command.
  • The entry point file specified in the meta.json file must exist on the filesystem at the path specified.
  • The entry point file must be executable.
  • If the module is provided to the upload command as a compressed archive, the archive must have the .tar.gz or .tgz extension.

See Create a module and Update and manage modules you created for a detailed walkthrough of the viam module commands.

Using the build subcommand

You can use the module build start or module build local commands to build your custom module according to the build steps in your meta.json file:

  • Use build start to build or compile your module on a cloud build host that might offer more platform support than you have access to locally.
  • Use build local to quickly test that your module builds or compiles as expected on your local hardware.

To configure your module’s build steps, add a build object to your meta.json file like the following:

"build": {
  "setup": "./setup.sh",                  // optional - command to install your build dependencies
  "build": "./build.sh",                  // command that will build your module
  "path" : "dist/archive.tar.gz",         // optional - path to your built module
                                          // (passed to the 'viam module upload' command)
  "arch" : ["linux/amd64", "linux/arm64"] // architecture(s) to build for
}
Click to view example setup.sh
#!/bin/bash
set -e
UNAME=$(uname -s)

if [ "$UNAME" = "Linux" ]
then
    echo "Installing venv on Linux"
    sudo apt-get install -y python3-venv
fi
if [ "$UNAME" = "Darwin" ]
then
    echo "Installing venv on Darwin"
    brew install python3-venv
fi

python3 -m venv .venv
. .venv/bin/activate
pip3 install -r requirements.txt
Click to view example build.sh (with setup.sh)
#!/bin/bash
pip3 install -r requirements.txt
python3 -m PyInstaller --onefile --hidden-import="googleapiclient" src/main.py
tar -czvf dist/archive.tar.gz <PATH-TO-EXECUTABLE>
Click to view example build.sh (without setup.sh)
#!/bin/bash
set -e
UNAME=$(uname -s)

if [ "$UNAME" = "Linux" ]
then
    echo "Installing venv on Linux"
    sudo apt-get install -y python3-venv
fi
if [ "$UNAME" = "Darwin" ]
then
    echo "Installing venv on Darwin"
    brew install python3-venv
fi

python3 -m venv .venv
. .venv/bin/activate
pip3 install -r requirements.txt
python3 -m PyInstaller --onefile --hidden-import="googleapiclient" src/main.py
tar -czvf dist/archive.tar.gz <PATH-TO-EXECUTABLE>

For example, the following extends the my-module meta.json file using the single build file approach, adding a new build object to control its build parameters when used with module build start or module build local:

{
  "module_id": "acme:my-module",
  "visibility": "public",
  "url": "https://github.com/<my-repo-name>/my-module",
  "description": "An example custom module.",
  "build": {
    "setup": "./setup.sh",
    "build": "./build.sh",
    "path": "dist/archive.tar.gz",
    "arch": ["linux/amd64", "linux/arm64"]
  },
  "entrypoint": "<PATH-TO-EXECUTABLE>"
}

When you initiate a build job using either start or local, the command returns the build ID of your job. Provide that build ID to the module build logs command to show the relevant build logs for that build.

For example, use the following to initiate a build, and return the build logs as soon as it completes:

viam module build logs --wait --build-id=$(viam module build start --version "0.1.2")

To list all in-progress builds and their build status, use the following command:

viam module build list

organizations

The organizations command allows you to list the organizations your authenticated session has access to, and to create a new organization API key.

viam organizations list
viam organizations api-key create --org-id=<org-id> [--name=<key-name>]
viam organizations support-email [get | set] --org-id=<org-id> --support-email=<support-email>
viam organizations logo [get | set] --org-id=<org-id> [--logo-path=<logo-path>]
viam organizations firebase-config [set | read | delete] --org-id=<org-id> [--app-id=<app-id>] [--firebase-config-path=<path>]
viam organizations billing-service get-config --org-id=<org-id>
viam organizations billing-service [enable | update] --org-id=<org-id> --address=<address>
viam organizations billing-service disable --org-id=<org-id>
viam organization auth-service [enable | disable] --org-id=<org-id>
viam organization auth-service oauth-app [create | update] --client-authentication [required | unspecified | not_required | not_required_when_using_pkce] \
    --client-name <client-name> --enabled-grants [password | unspecified | refresh_token | implicit | device_code | authorization_code] \
    --logout-uri=https://logoipsum.com --origin-uris=https://logoipsum.com \
    --pkce=[required | not_required | unspecified] --redirect-uris=https://logoipsum.com/callback \
    --url-validation=[allow_wildcards | unspecified | exact_match] --org-id=<org-id>
viam organization auth-service oauth-app [list] --org-id=<org-id>
viam organization auth-service oauth-app [read | delete] --org-id=<org-id> --client-id=<client-id>

See Manage API keys for more information.

organizations list

List all organizations (name, ID, and namespace) that the authenticated session has access to.

# list all the organizations that you are currently authenticated to
viam organizations list

organizations api-key create

Create a new organization API key.

# create a new organization API key in org 123
viam organizations api-key create --org-id=123 --name=my-key
ArgumentDescriptionRequired?
--org-idThe organization to create the API key in.Required
--nameThe optional name for the organization API key. If omitted, a name will be auto-generated based on your login info and the current time.Optional

organizations support-email get

Get the support email for an organization.

viam organizations support-email get --org-id=<org-id>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required

organizations support-email set

Set the support email for an organization.

viam organizations support-email set --org-id=<org-id> --support-email=<support-email>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required
--support-emailThe support email to set for the organization.Required

organizations logo set

Upload the logo for an organization from a local file.

viam organizations logo set --org-id=<org-id> --logo-path=<logo-path>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required
--logo-pathPath to the logo file to upload. Must be a PNG file.Required

organizations logo get

Get the logo for an organization.

viam organizations logo get --org-id=<org-id>
ArgumentDescriptionRequired?
--org-idThe organization to get the logo for.Required

organizations firebase-config set

Upload a Firebase config JSON for a specific app ID. Organization owner only.

viam organizations firebase-config set --org-id=<org-id> --app-id=com.example.myapp --firebase-config-path=./firebase-config.json
ArgumentDescriptionRequired?
--org-idOrganization ID.Required
--app-idApp ID. For example, com.example.myapp.Required
--firebase-config-pathPath to the Firebase config JSON file.Required

organizations firebase-config read

Read Firebase config metadata for an organization. Organization owner only.

viam organizations firebase-config read --org-id=<org-id>
ArgumentDescriptionRequired?
--org-idOrganization ID.Required

organizations firebase-config delete

Delete a Firebase config for a specific app ID. Organization owner only.

viam organizations firebase-config delete --org-id=<org-id> --app-id=com.example.myapp
ArgumentDescriptionRequired?
--org-idOrganization ID.Required
--app-idApp ID. For example, com.example.myapp.Required

organizations billing-service get-config

Get the billing service config for an organization.

viam organizations billing-service get-config --org-id=<org-id>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required

organizations billing-service enable

Enable the billing service for an organization.

viam organizations billing-service enable --org-id=<org-id> --address=<address>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required
--addressThe stringified billing address that follows the pattern: line1, line2 (optional), city, state, zipcode.Required

organizations billing-service update

Update the billing service for an organization.

viam organizations billing-service update --org-id=<org-id> --address=<address>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required
--addressThe stringified billing address that follows the pattern: line1, line2 (optional), city, state, zipcode.Required

organizations billing-service disable

Disable the billing service for an organization.

viam organizations billing-service disable --org-id=<org-id>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required

organizations auth-service enable

Enable auth-service for OAuth applications.

viam organization auth-service enable --org-id=<org-id>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required

organizations auth-service disable

Disable auth-service for OAuth applications. Disabling the auth-service does not delete your OAuth token, it will just take off the custom branding.

viam organization auth-service disable --org-id=<org-id>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required

organizations auth-service oauth-app create

Create a new OAuth application.

viam organization auth-service oauth-app create --client-authentication=<policy> --client-name=<name> --enabled-grants=<grants> --logout-uri=<uri> --origin-uris=<uris> --pkce=<pkce> --redirect-uris=<uris> --url-validation=<validation> --org-id=<org-id>
ArgumentDescriptionRequired?
--org-idThe organization ID that is tied to the OAuth application.Required
--client-authenticationThe client authentication policy for the OAuth application. Options: unspecified, required, not_required, not_required_when_using_pkce.Required
--enabled-grantsComma-separated enabled grants for the OAuth application. Options: unspecified, refresh_token, password, implicit, device_code, authorization_code.Required
--logout-uriThe logout URI for the OAuth application.Required
--pkceProof Key for Code Exchange (PKCE) for the OAuth application. Options: unspecified, required, not_required, not_required_when_using_client_authentication.Required
--redirect-urisComma-separated redirect URIs for the OAuth application. Requires at least one.Required
--url-validationURL validation for the OAuth application. Options: unspecified, exact_match, allow_wildcards.Required
--client-nameThe name for the OAuth application.Optional
--origin-urisComma-separated origin URIs for the OAuth application.Optional
--invite-redirect-uriRedirect URI to send users after they accept an org invite.Optional

organizations auth-service oauth-app update

Update an existing OAuth application.

viam organization auth-service oauth-app update --org-id=<org-id> --client-id=<client-id> [other options]
ArgumentDescriptionRequired?
--org-idThe organization ID that is tied to the OAuth application.Required
--client-idThe client ID of the OAuth application to be updated.Required
--client-nameUpdated name for the OAuth application.Optional
--client-authenticationUpdated client authentication policy. Options: unspecified, required, not_required, not_required_when_using_pkce. Default: unspecified.Optional
--enabled-grantsUpdated comma-separated enabled grants. Options: unspecified, refresh_token, password, implicit, device_code, authorization_code.Optional
--logout-uriUpdated logout URI for the OAuth application.Optional
--origin-urisUpdated comma-separated origin URIs for the OAuth application.Optional
--pkceUpdated PKCE policy. Options: unspecified, required, not_required, not_required_when_using_client_authentication. Default: unspecified.Optional
--redirect-urisUpdated comma-separated redirect URIs for the OAuth application.Optional
--url-validationUpdated URL validation. Options: unspecified, exact_match, allow_wildcards. Default: unspecified.Optional
--invite-redirect-uriRedirect URI to send users after they accept an org invite.Optional

organizations auth-service oauth-app list

List OAuth applications for an organization.

viam organization auth-service oauth-app list --org-id=<org-id>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required

organizations auth-service oauth-app read

Read an OAuth application.

viam organization auth-service oauth-app read --org-id=<org-id> --client-id=<client-id>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required
--client-idThe client ID of the OAuth application.Required

organizations auth-service oauth-app delete

Delete an OAuth application.

viam organization auth-service oauth-app delete --org-id=<org-id> --client-id=<client-id>
ArgumentDescriptionRequired?
--org-idThe organization to perform the command on.Required
--client-idThe client ID of the OAuth application.Required

packages

The packages command allows you to upload packages to the Viam Cloud or export packages from the Viam Cloud. For example, you can use this command to download ML models or modules from the registry.

viam packages upload --path=<path-to-package.tar.gz> --org-id=<org-id> --name=<package-name> --version=<version> --type=<type>
viam packages export --type=<type> [--org-id=<org-id>] [--name=<package-name>] [--version=<version>] [--destination=<path-to-export-destination>]

packages upload

Upload a package to the Viam Cloud.

viam packages upload --path=./the_package.tar.gz --org-id=123 --name=MyMLModel --version=1.0.0 --type=ml_model --model-framework=tensorflow
ArgumentDescriptionRequired?
--pathThe path to the package for upload. Executable or zipped tar with the .tar.gz extension.Required
--org-idThe organization ID of the package.Required
--nameThe name of the package.Required
--versionThe version of the package or latest.Required
--typeThe type of the package: ml_model, archive, module, slam_map, or unspecified.Required
--model-frameworkThe framework for an uploaded ml_model. Valid options: unspecified, tflite, tensorflow, pytorch, or onnx.Required if --type=ml_model
--model-typeThe type of the model. Valid options: unspecified, single_label_classification, multi_label_classification, object_detection.Required if --type=ml_model

packages export

Download a package from the Viam Cloud.

viam packages export --type=ml_model --org-id=123 --name=MyMLModel --version=latest --destination=.
ArgumentDescriptionRequired?
--typeThe type of the package: ml_model, archive, module, slam_map, or unspecified.Required
--org-idThe organization ID or namespace of the package. Default: default-org value if set, else attempts to read from meta.json.Optional
--nameThe name of the package. Default: attempts to read from meta.json.Optional
--versionThe version of the package or latest. Default: latest.Optional
--destinationThe output directory for downloaded package. Default: ..Optional

parse-ftdc

The parse-ftdc command parses an FTDC (Full-Time Diagnostic Data Capture) file and opens an interactive REPL for inspecting performance metrics collected by viam-server. This is a diagnostic tool. Viam support may ask you to run it when troubleshooting performance issues.

viam machines part get-ftdc --part=<part-id> ftdc-data
viam parse-ftdc --path ftdc-tmp/<part-id>/viam-server-<date>-<time>.ftdc
ArgumentDescriptionRequired?
--pathThe absolute file path to the FTDC file.Required

profiles

The profiles command allows you to manage different CLI authentication profiles, so you can easily switch between API key authentications (for example authentication to one organization versus another).

viam profiles add --profile-name=<name-of-profile-to-add> --key-id=<API-key-ID> --key=<API-key>
viam profiles update --profile-name=<name-of-profile-to-update> --key-id=<API-key-ID> --key=<API-key>
viam profiles list
viam profiles remove --profile-name=<name-of-profile-to-remove>

Examples:

# Add a new profile for authentication (throws error if profile already exists)
viam profiles add --profile-name=mycompany --key-id=54321zyx --key=123abcd1234

# Update an existing profile for authentication, or add it if it doesn't exist
viam profiles update --key=123abcd1234 --key-id=54321zyx --profile-name=mycompany

# List all existing profiles by name
viam profiles list

# Remove a profile
viam profiles remove --profile-name=mycompany

# Example of using a profile to see a list of machines available to that profile
viam --profile=mycompany machines list

See Manage API keys for more information.

profiles add

Add a new profile for authentication. Throws an error if the profile already exists.

viam profiles add --profile-name=<name-of-profile-to-add> --key-id=<API-key-ID> --key=<API-key>
ArgumentDescriptionRequired?
--profile-nameName of the profile to add.Required
--key-idThe key id (UUID) of the API key.Required
--keyThe key value of the API key.Required

profiles update

Update an existing profile for authentication, or add it if it doesn’t exist.

viam profiles update --profile-name=<name-of-profile-to-update> --key-id=<API-key-ID> --key=<API-key>
ArgumentDescriptionRequired?
--profile-nameName of the profile to update.Required
--key-idThe key id (UUID) of the API key.Required
--keyThe key value of the API key.Required

profiles list

List all existing profiles by name.

viam profiles list

profiles remove

Remove a profile.

viam profiles remove --profile-name=<name-of-profile-to-remove>
ArgumentDescriptionRequired?
--profile-nameName of the profile to remove.Required

resource

The resource command enables, disables, or updates individual resources (components and services) on a machine part. Use it to temporarily disable a resource without removing it from the configuration, or to update attributes without using the Viam app.

viam resource enable --part=<part> --resource-name=<resource-name> [--resource-name=<resource-name> ...]
viam resource disable --part=<part> --resource-name=<resource-name> [--resource-name=<resource-name> ...]
viam resource update --part=<part> --resource-name=<resource-name> --config=<json-or-path>

Examples:

# enable a single resource
viam resource enable --part=abc123 --resource-name=my-sensor

# enable multiple resources at once
viam resource enable --part=abc123 --resource-name=my-sensor --resource-name=arm-1

# update a resource attribute inline
viam resource update --part=abc123 --resource-name=my-sensor --config='{"pin": "38"}'

# update from a JSON file
viam resource update --part=abc123 --resource-name=my-sensor --config=/path/to/updates.json

# delete an attribute by passing an empty value
viam resource update --part=abc123 --resource-name=my-sensor --config='{"pin": ""}'

resource enable

Enable one or more resources on a machine part.

viam resource enable --part=<part> --resource-name=<resource-name> [--resource-name=<resource-name> ...]
ArgumentDescriptionRequired?
--partMachine part ID or name.Required
--resource-nameName of the resource. Repeat the flag to apply enable to multiple resources at once.Required
--organizationOrganization ID or name. Required when using a name (rather than ID) to identify the part.Optional
--locationLocation ID or name. Required when using a name (rather than ID) to identify the part.Optional
--machineMachine ID or name. Required when using a name (rather than ID) to identify the part.Optional

resource disable

Disable one or more resources on a machine part. Disabled resources are not started by viam-server.

viam resource disable --part=<part> --resource-name=<resource-name> [--resource-name=<resource-name> ...]
ArgumentDescriptionRequired?
--partMachine part ID or name.Required
--resource-nameName of the resource. Repeat the flag to apply disable to multiple resources at once.Required
--organizationOrganization ID or name. Required when using a name (rather than ID) to identify the part.Optional
--locationLocation ID or name. Required when using a name (rather than ID) to identify the part.Optional
--machineMachine ID or name. Required when using a name (rather than ID) to identify the part.Optional

resource update

Replace a resource’s attributes with new values. The --config flag accepts inline JSON or a path to a JSON file. An empty JSON object deletes all attributes.

viam resource update --part=<part> --resource-name=<resource-name> --config=<json-or-path>
ArgumentDescriptionRequired?
--partMachine part ID or name.Required
--resource-nameName of the resource.Required
--configInline JSON or path to a JSON file containing the new attributes.Required
--organizationOrganization ID or name. Required when using a name (rather than ID) to identify the part.Optional
--locationLocation ID or name. Required when using a name (rather than ID) to identify the part.Optional
--machineMachine ID or name. Required when using a name (rather than ID) to identify the part.Optional

train

Use a training script to train an ML model on data.

viam train submit managed --dataset-id=<dataset-id> --model-org-id=<model-org-id> --model-name=<model-name> --model-type=<model-type> --model-labels=<model-labels> [...named args]
viam train submit custom from-registry --dataset-id=<dataset-id> --org-id=<org-id> --model-name=<model-name> --script-name=<script-name> --version=<version> --args=<arg-key>=<arg-value> [...named args]
viam train submit custom with-upload --dataset-id=<dataset-id> --org-id=<org-id> --model-name=<model-name> --path=<path> --script-name=<script-name> --args=<arg-key>=<arg-value> [...named args]
viam train get --job-id=<job-id>
viam train logs --job-id=<job-id>
viam train cancel --job-id=<job-id>
viam train list --org-id=<org-id> --job-status=<job-status>
viam train containers list

train submit managed

Submit a training job on data in the Viam Cloud with a Viam-managed training script.

# submit training job on data in Viam Cloud with a Viam-managed training script
viam train submit managed --dataset-id=456 --model-org-id=123 --model-name=MyCoolClassifier --model-type=single_label_classification --model-labels=1,2,3
ArgumentDescriptionRequired?
--dataset-idThe ID of the dataset to train on. To find the dataset ID of a given dataset, go to the DATASETS subtab of the DATA tab and select a dataset. Click in the left-hand menu and click Copy dataset ID.Required
--model-org-idThe organization ID to train and save the ML model in. You can find your organization ID by running viam organizations list or by visiting your organization’s Settings page in the Viam app.Required
--model-nameThe name of the ML model.Required
--model-typeType of model to train. Must be one of single_label_classification, multi_label_classification, or object_detection.Required
--model-labelsLabels to train on. These will either be classification or object detection labels.Required
--model-frameworkThe framework of model to train. Must be one of tflite or tensorflow.Optional
--model-versionSet the version of the submitted model. Defaults to current timestamp if unspecified.Optional

train submit custom from-registry

Submit a custom training job with an existing training script in the registry on data in the Viam Cloud.

# submit custom training job with an existing training script in the Registry on data in Viam Cloud
viam train submit custom from-registry --dataset-id=<INSERT DATASET ID> --org-id=<INSERT ORG ID> --model-name=MyRegistryModel --model-version=2 --version=1 --script-name=mycompany:MyCustomTrainingScript  --args=num_epochs=3,model_type=multi_label
ArgumentDescriptionRequired?
--dataset-idThe ID of the dataset to train on.Required
--org-idThe organization ID to train and save the ML model in.Required
--model-nameThe name of the ML model.Required
--script-nameThe registry name of the ML training script to use for training.Required
--versionThe version of the ML training script to use for training.Required
--container-versionDocker container version for training. Use viam train containers list to see available versions.Required
--model-versionSet the version of the submitted model. Defaults to current timestamp if unspecified.Optional
--argsPass custom comma-separated arguments to the training script. Example: num_epochs=3,model_type=multi_label. To include whitespace, enclose the value with whitespace in single and double quotes. Example: num_epochs=3,labels="'green_square blue_star'".Optional

train submit custom with-upload

Upload a draft training script and submit a custom training job on data in the Viam Cloud.

# submit custom training job with an uploaded training script on data in Viam Cloud
viam train submit custom with-upload --dataset-id=<INSERT DATASET ID> --model-org-id=<INSERT ORG ID> --model-name=MyRegistryModel --model-type=single_label_classification --model-version=2 --version=1 --path=<path-to-tar.gz> --script-name=mycompany:MyCustomTrainingScript --args=num_epochs=3,labels="'green_square blue_star'"
ArgumentDescriptionRequired?
--dataset-idThe ID of the dataset to train on.Required
--org-idThe organization ID to save the custom training script in.Required
--model-org-idThe organization ID to upload and run the training job in.Required
--model-nameThe name of the ML model.Required
--pathThe path to the ML training script to upload.Required
--script-nameThe registry name of the ML training script to use for training. This sets the name on upload.Required
--container-versionDocker container version for training. Use viam train containers list to see available versions.Required
--frameworkFramework of the ML training script to upload. Options: unspecified, tflite, tensorflow, pytorch, onnx.Optional
--model-typeType of model to train. Must be one of single_label_classification, multi_label_classification, object_detection, or unspecified.Optional
--versionThe version of the ML training script to upload. Default: current timestamp.Optional
--model-versionSet the version of the submitted model. Defaults to current timestamp if unspecified.Optional
--urlURL of the GitHub repository associated with the training scripts.Optional
--argsPass custom comma-separated arguments to the training script. Example: num_epochs=3,model_type=multi_label. To include whitespace, enclose the value with whitespace in single and double quotes. Example: num_epochs=3,labels="'green_square blue_star'".Optional

train get

Get a training job from the Viam Cloud based on training job ID.

# get a training job from Viam Cloud based on training job ID
viam train get --job-id=123
ArgumentDescriptionRequired?
--job-idThe ID of the training job to get. You can retrieve this value with train list.Required

train logs

Get the logs of a training job from the Viam Cloud based on training job ID.

# get training job logs from Viam Cloud based on training job ID
viam train logs --job-id=123
ArgumentDescriptionRequired?
--job-idThe ID of the training job to get logs for.Required

train cancel

Cancel a training job in the Viam Cloud based on training job ID.

# cancel training job in Viam Cloud based on training job ID
viam train cancel --job-id=123
ArgumentDescriptionRequired?
--job-idThe ID of the training job to cancel.Required

train list

List training jobs in Viam Cloud based on organization ID and job status.

# list training jobs in Viam Cloud based on organization ID and job status
viam train list --org-id=123 --job-status=completed
ArgumentDescriptionRequired?
--org-idThe organization ID to list training jobs from.Required
--job-statusTraining status to filter for. Can be one of canceled, canceling, completed, failed, in_progress, pending, or unspecified.Optional

train containers list

List supported Docker container images for custom training.

viam train containers list

training-script

Manage training scripts for custom ML training.

viam training-script upload --framework=<framework> --org-id=<org-id> --path=<path-to-script> --script-name=<script-name> --type=<type>
viam training-script update --org-id=<org-id> --script-name=<script-name> --visibility=<visibility>

training-script upload

Upload an ML training script to the registry.

# upload a single label classification script in the tflite framework to organization 123
viam training-script upload --framework=tflite --org-id=123 --path=. --script-name=MyCustomTrainingScript --type=single_label_classification
ArgumentDescriptionRequired?
--pathThe path to ML training scripts for upload.Required
--org-idThe organization ID to host the scripts in. You can find your organization ID by running viam organizations list or by visiting your organization’s Settings page in the Viam app.Required
--script-nameName of the ML training script to upload.Required
--versionVersion of the ML training script to upload.Optional
--frameworkFramework of the ML training script to upload, can be tflite, tensorflow, pytorch, or onnx.Optional
--urlURL of GitHub repository associated with the training script.Optional
--typeTask type of the ML training script to upload, can be single_label_classification, multi_label_classification, or object_detection.Optional
--draftIndicate draft mode, drafts are not viewable in the registry.Optional
--visibilityVisibility of the training script. Options: public, private.Optional

training-script update

Update the visibility of an ML training script in the registry.

# update MyCustomTrainingScript with public visibility
viam training-script update --org-id=123 --script-name=MyCustomTrainingScript --visibility=public --description="A single label classification training script"
ArgumentDescriptionRequired?
--org-idThe organization ID hosting the script. You can find your organization ID by running viam organizations list or by visiting your organization’s Settings page in the Viam app.Required
--script-nameName of the ML training script to update.Required
--visibilityVisibility of the registry item. Options: public, private.Required
--descriptionDescription of the ML training script.Optional
--urlURL of the GitHub repository associated with the training scripts.Optional

traces

The traces command imports viam-server trace files to an OTLP endpoint or prints them to the console. Use it to debug machine performance and request flow with a tracing backend such as Jaeger or Tempo.

The import-remote, print-remote, and get-remote subcommands require the machine to have a valid shell-type service. Organization and location are required if you are identifying the part by name rather than ID.

viam traces import-local <traces-file> [--endpoint=<host:port>]
viam traces import-remote --part=<part> [--endpoint=<host:port>] [--organization=<org>] [--location=<location>]
viam traces print-local <traces-file>
viam traces print-remote --part=<part> [--organization=<org>] [--location=<location>]
viam traces get-remote --part=<part> [target] [--organization=<org>] [--location=<location>]

traces import-local

Import traces from a local viam-server trace file to an OTLP endpoint.

viam traces import-local <traces-file> [--endpoint=<host:port>]

Pass the path to a local viam-server trace file as a positional argument.

ArgumentDescriptionRequired?
--endpointOTLP endpoint in host:port format. Default: localhost:4317.Optional

traces import-remote

Import traces from a remote machine to an OTLP endpoint.

viam traces import-remote --part=<part> [--endpoint=<host:port>] [--organization=<org>] [--location=<location>]
ArgumentDescriptionRequired?
--partMachine part ID or name.Required
--endpointOTLP endpoint in host:port format. Default: localhost:4317.Optional
--organizationOrganization ID or name. Required when using a name (rather than ID) to identify the part.Optional
--locationLocation ID or name. Required when using a name (rather than ID) to identify the part.Optional

traces print-local

Print traces from a local trace file to the console.

viam traces print-local <traces-file>

Pass the path to a local viam-server trace file as a positional argument.

traces print-remote

Print traces from a remote machine to the console.

viam traces print-remote --part=<part> [--organization=<org>] [--location=<location>]
ArgumentDescriptionRequired?
--partMachine part ID or name.Required
--organizationOrganization ID or name. Required when using a name (rather than ID) to identify the part.Optional
--locationLocation ID or name. Required when using a name (rather than ID) to identify the part.Optional

traces get-remote

Download traces from a remote machine to a local file. If [target] is omitted, the file is saved to the current working directory.

viam traces get-remote --part=<part> [target] [--organization=<org>] [--location=<location>]
ArgumentDescriptionRequired?
--partMachine part ID or name.Required
--organizationOrganization ID or name. Required when using a name (rather than ID) to identify the part.Optional
--locationLocation ID or name. Required when using a name (rather than ID) to identify the part.Optional

update

The update command updates the CLI to the latest version. If the CLI was installed with Homebrew, it updates through Homebrew. Otherwise, it downloads and replaces the binary directly.

viam update
ArgumentDescriptionRequired?
--no-progressHide progress output during the update. Default: false.Optional

version

The version command returns the version of the Viam CLI. To update to the latest version of the CLI, run viam update.

viam version

whoami

The whoami command returns the Viam user for an authenticated CLI session, or “Not logged in” if there is no authenticated session.

viam whoami

xacro

The xacro command converts ROS xacro files to URDF using a Docker container. Use it to integrate ROS-based robot descriptions with Viam’s frame system.

viam xacro convert --input-file=<file> --output-file=<file> [other options]

Examples:

# basic conversion
viam xacro convert --input-file=robot.xacro --output-file=robot.urdf

# pass xacro arguments
viam xacro convert --input-file=arm.xacro --output-file=arm.urdf --args=name:=ur20

# collapse fixed-joint chains so only one end effector exists
viam xacro convert --input-file=robot.xacro --output-file=robot.urdf --collapse-fixed-joints

xacro convert

Convert a xacro file to URDF.

ArgumentDescriptionRequired?
--input-filePath to the xacro file to expand.Required
--output-filePath where the URDF file will be written.Required
--argsxacro arguments to pass through, in the form name:=value. Repeat the flag for multiple arguments. Required if the xacro file uses <xacro:arg> tags.Optional
--ros-distroROS distribution to use. Auto-detected from the docker image if not specified.Optional
--docker-imageDocker image to use for xacro processing. Default: osrf/ros:humble-desktop.Optional
--package-xmlPath to package.xml if not in the current directory.Optional
--collapse-fixed-jointsCollapse fixed-joint chains to ensure only one end effector exists.Optional
--install-packagesInstall ros-<distro>-xacro in the container (required for the default image). Disable only if your custom image already includes xacro.Optional
--dry-runShow the docker command without executing it.Optional