Skip to main content

Attach files to assets

Not everything is a number. A pump has a calibration certificate, a plant has a piping diagram, a daily run produces a CSV export. Store these as files — organized in folders, tagged with metadata, and linked to the dataset they belong to.

Upload a file

Give the file a destination path and some metadata. The Java client uploads raw bytes; the Python and Rust clients upload a local file to a destination folder.

import java.nio.file.Files;
import java.nio.file.Path;

byte[] content = Files.readAllBytes(Path.of("calibration_a12.pdf"));

var uploaded = client.files().upload(
FileUploadRequest.builder()
.path("certificates/2026/calibration_a12.pdf") // destination
.content(content)
.contentType("application/pdf")
.externalId("calibration_pump_esp_a12")
.dataSetId(42L)
.description("ESP A-12 calibration certificate")
.build());

System.out.println("stored as id " + uploaded.getItems().iterator().next().getId());
Link a file to its asset

Set dataSetId (or the external_id/metadata) so a file is discoverable from the dataset and asset it documents — the calibration certificate next to the pump it certifies.

List a directory

Browse the folder tree. Each entry is a file or a folder (type), with its name, path and size.

var listing = client.files().list("/certificates/2026");
listing.getItems().forEach(node ->
System.out.println(node.getType() + " " + node.getName() + " " + node.getSize() + " bytes"));

Download

The Java client downloads a file's raw bytes by id:

byte[] bytes = client.files().download("99");
Files.write(Path.of("calibration_a12.pdf"), bytes);

Delete

client.files().delete(List.of(IdCollection.createFromExternalId("calibration_pump_esp_a12")));

See the Files reference for every method and the upload metadata fields.