Skip to content

Feature Request: Add metadata parameter to volume creation (similar to sandbox create) #1643

Description

@payall4u

Is your feature request related to a problem? Please describe.

We need to associate custom metadata (e.g. underlying storage backend info, region, cluster, disk type, project/owner tags) with volumes at creation time. Currently Volume.create() only accepts a name parameter — there is no way to attach arbitrary key-value pairs to a volume. This makes it difficult to tag and organize volumes in multi-tenant environments and prevents storing operational metadata alongside the volume resource itself.

Describe the solution you'd like

Add a metadata: Optional[Dict[str, str]] parameter to volume creation, following the exact same pattern already used for sandboxes. This includes:

  1. OpenAPI spec — Add VolumeMetadata schema (additionalProperties: {type: string}), and add metadata fields to NewVolume, Volume, ListedVolume schemas and the GET /volumes query parameters (for filtering).
  2. API client model — Add metadata: Union[Unset, Dict[str, str]] to NewVolume in api/client/models/new_volume.py.
  3. Python SDK — Add metadata: Optional[Dict[str, str]] to both Volume.create() and AsyncVolume.create(), pass it through to the API model, and surface it in VolumeAndToken/VolumeInfo types so it's available after creation.
  4. Equivalent changes to JS SDK and CLI for consistency.

Example usage:

volume = Volume.create(
    name="my-data",
    metadata={
        "region": "us-east-1",
        "storage_class": "ssd",
        "project": "my-project",
    }
)

info = volume.get_info(volume.volume_id)
print(info.metadata)  # {"region": "us-east-1", ...}

Describe alternatives you've considered

  • Encoding metadata in the volume name — fragile, limited, and not searchable via the API.
  • Maintaining a separate metadata mapping service — adds unnecessary operational complexity for a feature that should be natively supported.

Additional context

Sandbox creation already supports this exact pattern end-to-end:

  • Sandbox.create() accepts metadata: Optional[Dict[str, str]] (sandbox_sync/main.py:160)
  • NewSandbox API model carries a metadata field (api/client/models/new_sandbox.py)
  • SandboxMetadata is defined in the OpenAPI spec as additionalProperties: {type: string} (spec/openapi.yml:258-261)
  • SandboxInfo.metadata surfaces it after creation (sandbox/sandbox_api.py:483)
  • SandboxQuery.metadata supports filtering sandboxes by metadata when listing (sandbox/sandbox_api.py:565)

This request mirrors that same pattern for volumes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions