---
title: "Adding Data to VxData"
image: "https://docs.virdx.dev/img/virdx-social-card.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.virdx.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding Data to VxData

## Creating New Resources

:::info

Read [the full guide](/vxdata-api/guides/integrating-datasets) on the mental models behind adding data before starting to add large amounts of data.

:::

The VxData SDK exposes `ResourceCreate` requests that allow you to create new resources in the database.

```py
from vxdata.schemas.create import MeasurementCreate

client.resources.create(MeasurementCreate(
identifier="psa/BB12345/2025-01-01",
license="VIRDX-PSEUDONYMIZED",
value=1.23,
unit="ng/ml"
))
```

This operation will fail if a resource with the same identifier already exists. 
Read below for a guide on updating existing resources.

## Updating Existing Resources

```py
from vxdata.schemas.update import MeasurementUpdate

client.resources.update(
"psa/BB12345/2025-01-01",
MeasurementUpdate(
    value=100.0,
))
```

## Uploading Files

For any blob data that can't be represented as resources / tabular entries, vxData offers functionality to upload data to our Ceph blob storage system.
Files are moved via the `storage` module of the SDK:

```py
# uploads a file to a timestamped, randomized folder name in the specified group,
# so returned url will be similar to `s3://vxdata/my-project/20260101_ABCXYZ/model.pt`.
url = vxd.storage.upload("model.pt", group="my-project")
urls = vxd.storage.upload(["a.nii.gz", "b.nii.gz"], group="my-project")  # list in, list out
dir_url = vxd.storage.upload("training-run/", group="my-project")  # whole directory; url ends in /
```

This returned value should then be used when creating resources: 
most relevant resources have a `url` field to put this S3-URL into.

Small files are being uploaded as one streamed PUT operations, large ones (>1GB) are uploaded as parallel multiparts.
This improves upload speeds and avoids loading the entire file into memory.
On any failure the multipart upload is aborted server-side: nothing partial
ever becomes visible.

Source: https://docs.virdx.dev/vxdata-api/guides/writing/index.mdx
