Skip to content

Add key-value metadata support for image upload (DATAMAN-156)#440

Merged
digaobarbosa merged 5 commits intomainfrom
dataman-156-add-key-value-support-for-sdk
Feb 25, 2026
Merged

Add key-value metadata support for image upload (DATAMAN-156)#440
digaobarbosa merged 5 commits intomainfrom
dataman-156-add-key-value-support-for-sdk

Conversation

@digaobarbosa
Copy link
Contributor

@digaobarbosa digaobarbosa commented Feb 24, 2026

Description

Add support for passing key-value metadata during image upload via the Python SDK, matching the backend API capability.

Users can now attach custom metadata to images in a single request instead of uploading first then calling a separate API.

Implementation

  • Added explicit metadata: Optional[Dict] parameter to upload(), single_upload(), upload_image(), and rfapi.upload_image()
  • Local uploads: metadata serialized as JSON and added as a multipart form field
  • Hosted uploads: metadata serialized as JSON and added as a query parameter
  • Auto-detect hosted images (URLs) in project.upload() — no need for explicit hosted_image=True flag
  • CLI support: -M/--metadata argument accepts JSON string

Type of change

  • New feature

How has this change been tested?

  • All 24 existing unit tests pass (test_rfapi.py + test_project.py)
  • Added 2 new tests:
    • test_upload_image_local_with_metadata: verifies metadata in multipart body
    • test_upload_image_hosted_with_metadata: verifies metadata in query param
  • Created demo scripts for manual testing:
    • tests/manual/demo_upload_local_metadata.py
    • tests/manual/demo_upload_hosted_metadata.py

Will the change affect Universe?

No

Docs

  • Docs updated? N/A - internal API feature

Usage

project.upload("image.jpg", metadata={"camera_id": "cam001", "location": "warehouse"})

CLI:

roboflow upload image.jpg -p my-project -M '{"camera_id":"cam001"}'

@digaobarbosa digaobarbosa self-assigned this Feb 24, 2026
@digaobarbosa digaobarbosa requested a review from a team February 24, 2026 14:32
@digaobarbosa digaobarbosa merged commit 1eb8238 into main Feb 25, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants