The IDs of binary data to add to dataset
The ID of the dataset to be added to
await dataClient.addBinaryDataToDatasetByIds(
[
'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
],
'12ab3de4f56a7bcd89ef0ab1'
);
For more information, see Data API.
Add bounding box to an image.
The ID of the image to add the bounding box to
A label for the bounding box
The min X value of the bounding box normalized from 0 to 1
The min Y value of the bounding box normalized from 0 to 1
The max X value of the bounding box normalized from 0 to 1
The max Y value of the bounding box normalized from 0 to 1
The bounding box ID
const bboxId = await dataClient.addBoundingBoxToImageById(
'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
'label1',
0.3,
0.3,
0.6,
0.6
);
For more information, see Data API.
Add tags to binary data, specified by filter.
The tags to add to the data
Optional
filter: FilterOptional pb.Filter
specifying binary data to add tags to.
No filter
implies all binary data.
const data = await dataClient.addTagsToBinaryDataByFilter(
['tag1', 'tag2'],
[
{
componentName: 'camera-1',
} as Filter,
]
);
For more information, see Data API.
Add tags to binary data, specified by ID.
The list of tags to add to specified binary data. Must be non-empty.
The IDs of the data to be tagged. Must be non-empty.
const data = await dataClient.addTagsToBinaryDataByIds(
['tag1', 'tag2'],
[
'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
]
);
For more information, see Data API.
Filter and get a page of binary data. The returned metadata might be empty
if the metadata index of the data is out of the bounds of the returned
metadata list. The data will be paginated into pages of limit
items, and
the pagination ID will be included in the returned tuple.
Optional
filter: FilterOptional pb.Filter
specifying binary data to retrieve. No
filter
implies all binary data.
Optional
limit: numberThe maximum number of entries to include in a page. Defaults to 50 if unspecfied
Optional
sortOrder: OrderThe desired sort order of the data
Optional string indicating the ID of the last-returned data. If
provided, the server will return the next data entries after the last
ID.
Whether to include binary file data with each retrieved file
Whether to return only the total count of entries
Whether to retun internal data. Internal data is
used for Viam-specific data ingestion, like cloud SLAM. Defaults to
false
.
An array of data objects, the count (number of entries), and the last-returned page ID.
const data = await dataClient.binaryDataByFilter(
{
componentName: 'camera-1',
componentType: 'rdk:component:camera',
} as Filter,
1
);
For more information, see Data API.
Get binary data using the binary data ID.
The IDs of the requested binary data
An array of data objects
const data = await dataClient.binaryDataByIds([
'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
]);
For more information, see Data API.
Uploads the content and metadata for binary data.
Upload binary data collected on a robot through a specific component (for example, a motor) along with the relevant metadata to app.viam.com. binary data can be found under the "Sensors" subtab of the Data tab on app.viam.com.
The data to be uploaded, represented in bytes
The part ID of the component used to capture the data
The type of the component used to capture the data (for example, "movementSensor")
The name of the component used to capture the data
The name of the method used to capture the data.
The file extension of binary data including the period, for example .jpg, .png, or .pcd. The backend will route the binary to its corresponding mime type based on this extension. Files with a .jpeg, .jpg, or .png extension will be saved to the images tab.
Tuple containing Date
objects denoting the times
this data was requested[0] by the robot and received[1] from the
appropriate sensor.
Optional
tags: string[]The list of tags to allow for tag-based filtering when retrieving data
The binary data ID of the uploaded data
const binaryDataId = await dataClient.binaryDataCaptureUpload(
binaryData,
'123abc45-1234-5678-90ab-cdef12345678',
'rdk:component:camera',
'my-camera',
'ReadImage',
'.jpg',
[new Date('2025-03-19'), new Date('2025-03-19')]
);
For more information, see Data API.
Get a list of bounding box labels using a Filter.
Optional
filter: FilterOptional pb.Filter
specifying what data to get tags from.
No filter
implies all labels.
The list of bounding box labels
const data = await dataClient.boundingBoxLabelsByFilter({
componentName: 'camera-1',
} as Filter);
For more information, see Data API.
Configure a database user for the Viam organization's MongoDB Atlas Data Federation instance. It can also be used to reset the password of the existing database user.
The ID of the organization
The password of the user
await dataClient.configureDatabaseUser(
'123abc45-1234-5678-90ab-cdef12345678',
'Password01!'
);
For more information, see Data API.
Creates a new data pipeline using the given query and schedule.
The ID of the organization
The name of the data pipeline
The MQL query to run as a list of BSON documents
The schedule to run the query on (cron expression)
The ID of the created data pipeline
// {@link JsonValue} is imported from @bufbuild/protobuf
const mqlQuery: Record<string, JsonValue>[] = [
{
$match: {
component_name: 'sensor-1',
},
},
{
$limit: 5,
},
];
const pipelineId = await dataClient.createDataPipeline(
'123abc45-1234-5678-90ab-cdef12345678',
'my-pipeline',
mqlQuery,
'0 0 * * *'
);
Create a new dataset.
The name of the new dataset
The ID of the organization the dataset is being created in
The ID of the dataset
const datasetId = await dataClient.createDataset(
'my-new-dataset',
'123abc45-1234-5678-90ab-cdef12345678'
);
For more information, see Data API.
Filter and delete binary data.
Optional
filter: FilterOptional pb.Filter
specifying binary data to delete. No
filter
implies all binary data.
Whether or not to delete internal data. Default is true
The number of items deleted
const data = await dataClient.deleteBinaryDataByFilter({
componentName: 'camera-1',
componentType: 'rdk:component:camera',
organizationIds: ['123abc45-1234-5678-90ab-cdef12345678'],
startTime: new Date('2025-03-19'),
endTime: new Date('2025-03-20'),
} as Filter);
For more information, see Data API.
Delete binary data, specified by ID.
The IDs of the data to be deleted. Must be non-empty.
The number of items deleted
const data = await dataClient.deleteBinaryDataByIds([
'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
]);
For more information, see Data API.
Delete a dataset.
The ID of the dataset.
await dataClient.deleteDataset('12ab3de4f56a7bcd89ef0ab1');
For more information, see Data API.
Delete tabular data older than a specified number of days.
The ID of organization to delete data from
Delete data that was captured more than this
many days ago. For example if deleteOlderThanDays
is 10, this deletes
any data that was captured more than 10 days ago. If it is 0, all
existing data is deleted.
The number of items deleted
const data = await dataClient.deleteTabularData(
'123abc45-1234-5678-90ab-cdef12345678',
10
);
For more information, see Data API.
Obtain unified tabular data and metadata from the specified data source.
The ID of the part that owns the data
The name of the requested resource that captured the data
The subtype of the requested resource that captured the data
The data capture method name
Optional
startTime: DateOptional start time (Date
object) for requesting a
specific range of data
Optional
endTime: DateOptional end time (Date
object) for requesting a specific
range of data
An array of unified tabular data and metadata.
const data = await dataClient.exportTabularData(
'123abc45-1234-5678-90ab-cdef12345678',
'my-sensor',
'rdk:component:sensor',
'Readings',
new Date('2025-03-25'),
new Date('2024-03-27')
);
For more information, see Data API.
Get a connection to access a MongoDB Atlas Data federation instance.
Organization to retrieve connection for
Hostname of the federated database
const hostname = await dataClient.getDatabaseConnection(
'123abc45-1234-5678-90ab-cdef12345678'
);
For more information, see Data API.
Gets the most recent tabular data captured from the specified data source, as long as it was synced within the last year.
The ID of the part that owns the data
The name of the requested resource that captured the data. Ex: "my-sensor"
The subtype of the requested resource that captured the data. Ex: "rdk:component:sensor"
The data capture method name. Ex: "Readings"
A tuple containing [timeCaptured, timeSynced, payload] or null if no data has been synced for the specified resource OR the most recently captured data was over a year ago
const data = await dataClient.getLatestTabularData(
'123abc45-1234-5678-90ab-cdef12345678',
'my-sensor',
'rdk:component:sensor',
'Readings'
);
For more information, see Data API.
List all runs of a data pipeline.
The ID of the data pipeline
Optional
pageSize: numberThe number of runs to return per page
A page of data pipeline runs
List all of the datasets specified by the given dataset IDs.
The list of IDs of the datasets
The list of datasets
const datasets = await dataClient.listDatasetsByIds([
'12ab3de4f56a7bcd89ef0ab1',
]);
For more information, see Data API.
List all of the datasets for an organization.
The ID of the organization
The list of datasets in the organization
const datasets = await dataClient.listDatasetsByOrganizationID(
'123abc45-1234-5678-90ab-cdef12345678'
);
For more information, see Data API.
Remove BinaryData from the provided dataset.
The IDs of the binary data to remove from dataset
The ID of the dataset to be removed from
await dataClient.removeBinaryDataFromDatasetByIds(
[
'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
],
'12ab3de4f56a7bcd89ef0ab1'
);
For more information, see Data API.
Remove a bounding box from an image.
The ID of the image to remove the bounding box from
The ID of the bounding box to remove
await dataClient.removeBoundingBoxFromImageById(
'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
'5Z9ryhkW7ULaXROjJO6ghPYulNllnH20QImda1iZFroZpQbjahK6igQ1WbYigXED'
);
For more information, see Data API.
Remove tags from binary data, specified by filter.
List of tags to remove from specified binary data. Must be non-empty.
Optional
filter: FilterOptional pb.Filter
specifying binary data to add tags to.
No filter
implies all binary data.
The number of items deleted
const data = await dataClient.removeTagsFromBinaryDataByFilter(
['tag1', 'tag2'],
{
componentName: 'camera-1',
componentType: 'rdk:component:camera',
organizationIds: ['123abc45-1234-5678-90ab-cdef12345678'],
startTime: new Date('2025-03-19'),
endTime: new Date('2025-03-20'),
} as Filter
);
For more information, see Data API.
Remove tags from binary data, specified by ID.
List of tags to remove from specified binary data. Must be non-empty.
The IDs of the data to be edited. Must be non-empty.
The number of items deleted
const data = await dataClient.removeTagsFromBinaryDataByIds(
['tag1', 'tag2'],
[
'ccb74b53-1235-4328-a4b9-91dff1915a50/x5vur1fmps/YAEzj5I1kTwtYsDdf4a7ctaJpGgKRHmnM9bJNVyblk52UpqmrnMVTITaBKZctKEh',
]
);
For more information, see Data API.
Rename a dataset.
The ID of the dataset
The new name of the dataset
await dataClient.renameDataset(
'12ab3de4f56a7bcd89ef0ab1',
'my-new-dataset'
);
For more information, see Data API.
Filter and get a page of tabular data. The returned metadata might be empty
if the metadata index of the data is out of the bounds of the returned
metadata list. The data will be paginated into pages of limit
items, and
the pagination ID will be included in the returned tuple.
Optional
filter: FilterOptional pb.Filter
specifying tabular data to retrieve. No
filter
implies all tabular data.
Optional
limit: numberThe maximum number of entries to include in a page. Defaults to 50 if unspecfied
Optional
sortOrder: OrderThe desired sort order of the data
Optional string indicating the ID of the last-returned data. If
provided, the server will return the next data entries after the last
ID.
Whether to return only the total count of entries
Whether to retun internal data. Internal data is
used for Viam-specific data ingestion, like cloud SLAM. Defaults to
false
.
An array of data objects, the count (number of entries), and the last-returned page ID.
const data = await dataClient.tabularDataByFilter(
{
componentName: 'sensor-1',
componentType: 'rdk:component:sensor',
} as Filter,
5
);
For more information, see Data API.
Obtain unified tabular data and metadata, queried with MQL.
The ID of the organization that owns the data
The MQL query to run as a list of BSON documents
Optional
useRecentData: booleanWhether to query blob storage or your recent data store. Defaults to false. Deprecated - use dataSource instead.
Optional
tabularDataSource: TabularDataSourceAn array of data objects
// {@link JsonValue} is imported from @bufbuild/protobuf
const mqlQuery: Record<string, JsonValue>[] = [
{
$match: {
component_name: 'sensor-1',
},
},
{
$limit: 5,
},
];
const data = await dataClient.tabularDataByMQL(
'123abc45-1234-5678-90ab-cdef12345678',
mqlQuery
);
For more information, see Data API.
Obtain unified tabular data and metadata, queried with SQL.
The ID of the organization that owns the data
The SQL query to run
An array of data objects
const data = await dataClient.tabularDataBySQL(
'123abc45-1234-5678-90ab-cdef12345678',
'SELECT * FROM readings LIMIT 5'
);
For more information, see Data API.
Uploads the content and metadata for tabular data.
Upload tabular data collected on a robot through a specific component (for example, a motor) along with the relevant metadata to app.viam.com. Tabular data can be found under the "Sensors" subtab of the Data tab on app.viam.com.
The list of data to be uploaded, represented tabularly as an array.
The part ID of the component used to capture the data
The type of the component used to capture the data (for example, "movementSensor")
The name of the component used to capture the data
The name of the method used to capture the data.
Array of Date tuples, each containing two Date
objects denoting the times this data was requested[0] by the robot and
received[1] from the appropriate sensor. Passing a list of tabular data
and Timestamps with length n > 1 will result in n datapoints being
uploaded, all tied to the same metadata.
Optional
tags: string[]The list of tags to allow for tag-based filtering when retrieving data
The file ID of the uploaded data
const fileId = await dataClient.tabularDataCaptureUpload(
[
{
timestamp: '2025-03-26T10:00:00Z',
value: 10,
},
],
'123abc45-1234-5678-90ab-cdef12345678',
'rdk:component:sensor',
'my-sensor',
'Readings',
[
[
new Date('2025-03-26T10:00:00Z'),
new Date('2025-03-26T10:00:00Z'),
],
]
);
For more information, see Data API.
Get a list of tags using a filter.
Optional
filter: FilterOptional pb.Filter
specifying what data to get tags from.
No filter
implies all data.
The list of tags
const data = await dataClient.tagsByFilter({
componentName: 'camera-1',
} as Filter);
For more information, see Data API.
Add BinaryData to the provided dataset.