---
sidebar:
  label: roboto.storage.api_operations
  order: 0
title: roboto.storage.api_operations
---
## Module Contents

### AbortTransactionsRequest

```python
class roboto.storage.api_operations.AbortTransactionsRequest(/, **data: Any)
```

`from roboto.storage import AbortTransactionsRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/storage/api_operations.py#L14-L26)

Bases: `pydantic.BaseModel`

Request body for `POST /v1/files/transactions/abort`, which abandons uploads.

Each file an aborted upload wrote returns to its latest [`Available`](/docs/reference/python-sdk/roboto/domain/files/record#roboto.domain.files.record.FileStatus.Available) version, if it has one. IDs that match no upload are ignored.

**Parameters**

- **data** (`Any`)

**Attributes**

- **AbortTransactionsRequest.transaction_ids** (`list[str]`): IDs of the uploads to abort.

  Each is a `BeginUploadResponse.transaction_id` or a `BeginSignedUrlUploadResponse.upload_id`.

### BeginSignedUrlUploadRequest

```python
class roboto.storage.api_operations.BeginSignedUrlUploadRequest(/, **data: Any)
```

`from roboto import BeginSignedUrlUploadRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/storage/api_operations.py#L81-L101)

Bases: `pydantic.BaseModel`

Request body for `POST /v1/files/signed_url_upload`, which begins an upload of one file to a pre-signed URL.

Roboto creates the file, or a new version of the file already at `file_path`, and holds it in the [`Reserved`](/docs/reference/python-sdk/roboto/domain/files/record#roboto.domain.files.record.FileStatus.Reserved) state until its upload completes.

**Parameters**

- **data** (`Any`)

**Attributes**

- **BeginSignedUrlUploadRequest.association** (`roboto.association.Association`): Resource to upload the file to: a dataset, device, device type, organization, or topic.

  Any other kind raises `RobotoInvalidRequestException`.

- **BeginSignedUrlUploadRequest.file_path** (`str`): Path within `association` to upload the file to, such as `path/to/metadata.json`.

- **BeginSignedUrlUploadRequest.file_size** (`int`): Size of the file in bytes.

- **BeginSignedUrlUploadRequest.origination** (`str | None`) = `None`: What uploaded the file, such as `roboto client v1.0.0`. `None` records the caller's user ID.

### BeginSignedUrlUploadResponse

```python
class roboto.storage.api_operations.BeginSignedUrlUploadResponse(/, **data: Any)
```

`from roboto import BeginSignedUrlUploadResponse`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/storage/api_operations.py#L104-L115)

Bases: `pydantic.BaseModel`

Response body of `POST /v1/files/signed_url_upload`.

Send the file's bytes to `upload_url` with an HTTP PUT, then complete the upload with `PUT /v1/files/upload/{upload_id}/complete`.

**Parameters**

- **data** (`Any`)

**Attributes**

- **BeginSignedUrlUploadResponse.upload_id** (`str`): Unique ID of the upload, beginning with `tx_`.
- **BeginSignedUrlUploadResponse.upload_url** (`str`): Pre-signed URL that accepts the file's bytes in an HTTP PUT.

### BeginUploadRequest

```python
class roboto.storage.api_operations.BeginUploadRequest(/, **data: Any)
```

`from roboto import BeginUploadRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/storage/api_operations.py#L29-L54)

Bases: `pydantic.BaseModel`

Request body for `POST /v1/files/upload`, which begins an upload of one or more files.

Sent by [`upload()`](/docs/reference/python-sdk/roboto/storage/file_service#roboto.storage.file_service.FileService.upload), through [`UploadTransaction`](/docs/reference/python-sdk/roboto/storage/upload_transaction#roboto.storage.upload_transaction.UploadTransaction). Roboto creates a file for each path in `resource_manifest`, or a new version of the file already at that path, and holds it in the [`Reserved`](/docs/reference/python-sdk/roboto/domain/files/record#roboto.domain.files.record.FileStatus.Reserved) state until its upload completes.

**Parameters**

- **data** (`Any`)

**Attributes**

- **BeginUploadRequest.association** (`roboto.association.Association`): Resource to upload the files to: a dataset, device, device type, organization, or topic.

  Any other kind raises `RobotoInvalidRequestException`.

- **BeginUploadRequest.device_id** (`str | None`) = `None`: ID of the device that produced the files, which must be in the organization the files are uploaded to.

  `None` records the calling device when a device makes the request, and no device otherwise.

- **BeginUploadRequest.origination** (`str`): What uploaded the files, such as `roboto client v1.0.0`.

- **BeginUploadRequest.resource_manifest** (`dict[str, int]`): Size in bytes of each file to upload, keyed by its path within `association`, such as `logs/run.mcap`.

### BeginUploadResponse

```python
class roboto.storage.api_operations.BeginUploadResponse(/, **data: Any)
```

`from roboto import BeginUploadResponse`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/storage/api_operations.py#L57-L78)

Bases: `pydantic.BaseModel`

Response body of `POST /v1/files/upload`.

Read by [`upload()`](/docs/reference/python-sdk/roboto/storage/file_service#roboto.storage.file_service.FileService.upload), through [`UploadTransaction`](/docs/reference/python-sdk/roboto/storage/upload_transaction#roboto.storage.upload_transaction.UploadTransaction). To finish the upload:

1. Write each file's bytes to its URI in `upload_mappings`, with credentials from `GET /v1/files/upload/{upload_id}/credentials`.
2. Optionally, report files as they finish with `PUT /v1/files/upload/{upload_id}/progress`, which marks them [`Available`](/docs/reference/python-sdk/roboto/domain/files/record#roboto.domain.files.record.FileStatus.Available).
3. Complete the upload with `PUT /v1/files/upload/{upload_id}/complete`, which marks available every file not reported yet.

**Parameters**

- **data** (`Any`)

**Attributes**

- **BeginUploadResponse.transaction_id** (`str`): Unique ID of the upload, beginning with `tx_`, which is the `{upload_id}` in the routes that continue it.

- **BeginUploadResponse.upload_mappings** (`dict[str, str]`): URI to write each file's bytes to, such as `s3://<bucket>/<key>`, keyed by the file's path.

  The keys are the paths of `BeginUploadRequest.resource_manifest`.

### ReportUploadProgressRequest

```python
class roboto.storage.api_operations.ReportUploadProgressRequest(/, **data: Any)
```

`from roboto import ReportUploadProgressRequest`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/storage/api_operations.py#L118-L129)

Bases: `pydantic.BaseModel`

Request body for [`await_uploads()`](/docs/reference/python-sdk/roboto/storage/upload_transaction#roboto.storage.upload_transaction.UploadTransaction.await_uploads).

Sent to `PUT /v1/files/upload/{upload_id}/progress` to mark the files of an upload that finished before the whole upload completes. Each reported file becomes [`Available`](/docs/reference/python-sdk/roboto/domain/files/record#roboto.domain.files.record.FileStatus.Available).

**Parameters**

- **data** (`Any`)

**Attributes**

- **ReportUploadProgressRequest.manifest_items** (`list[str]`): URIs of the files whose bytes are fully written.

  Each is a value of `BeginUploadResponse.upload_mappings`.

### ReportUploadProgressResponseItem

```python
class roboto.storage.api_operations.ReportUploadProgressResponseItem(/, **data: Any)
```

`from roboto.storage import ReportUploadProgressResponseItem`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/storage/api_operations.py#L132-L146)

Bases: `pydantic.BaseModel`

Item of the response body of `PUT /v1/files/upload/{upload_id}/progress`.

Each item is one file marked available. Read by [`await_uploads()`](/docs/reference/python-sdk/roboto/storage/upload_transaction#roboto.storage.upload_transaction.UploadTransaction.await_uploads). Roboto returns one item per reported URI that matched a file of the upload, and omits URIs that matched none without failing the request. `await_uploads` reports only URIs from the upload's own `upload_mappings`, so it raises `RobotoInternalException` when the items do not match the URIs it reported one to one.

**Parameters**

- **data** (`Any`)

**Attributes**

- **ReportUploadProgressResponseItem.file_id** (`str`): ID of the file marked available, beginning with `fl_`.
- **ReportUploadProgressResponseItem.uri** (`str`): URI of the file, one of the request's `ReportUploadProgressRequest.manifest_items`.
