File tags
Each file can carry a list of string tags. Tags are set at upload time or managed via dedicated REST API endpoints. They appear in all file info responses and can be used as a filter in file search.
Tags require API version 0.7. All tag endpoints require the
Accept: application/vnd.uploadcare-v0.7+json header.
Normalization
All tag input is normalized before storage:
Limits and allowed characters
All limits are evaluated after normalization and deduplication. Tags that contain any other character (spaces, Unicode, +, @, etc.) are rejected with HTTP 400.
Setting tags at upload time
Pass tags as a form field alongside other upload parameters for
POST /base/ (direct upload) and POST /multipart/start/. The value is a
comma-separated list of tag names.
Validation errors (too many tags, tag too long, invalid characters) return HTTP 400 and the upload does not proceed:
The standard upload response does not include tags. To read tags after
upload, use GET /files/{uuid}/ or GET /files/{uuid}/tags/.
Tags in file info
When tags are enabled, the tags field is included in all file info responses
at API version 0.7:
A file with no tags returns "tags": [].
Endpoints that include tags:
GET /files/{uuid}/— single file infoGET /files/— file list- Webhook payloads
REST API
All tag endpoints:
- Require
Accept: application/vnd.uploadcare-v0.7+json - Require standard Uploadcare authentication (secret key)
- Are scoped to the authenticated project
- Return 404 for files in other projects or removed files
Get tags
Returns the current tag list.
Response 200:
Returns {"tags": []} for a file with no tags.
Replace tags
Replaces the entire tag set. Previous tags not in the new list are deleted. An empty array clears all tags.
Response 200:
tags— resulting tag list in storage orderadded— tags in the new set but not in the previous set (sorted alphabetically)deleted— tags in the previous set but not in the new set (sorted alphabetically)
Calling PUT with the same set of tags (regardless of input case or order)
is safe and produces no write — added and deleted will both be empty.
Update tags (add and/or remove)
Adds and/or removes tags in a single atomic operation. Both add and delete
are optional and default to []. Delete is applied first, then add — so a tag
can be removed and re-added in one request.
Response 200:
tags— resulting tag list in storage orderadded— tags that were not previously present and were addeddeleted— tags that were present and were removed
Tags in add that already exist are silently skipped. Tags in delete that
are not present are silently ignored. An empty body {} is valid and returns
the current state unchanged. If the resulting count would exceed 50, the
request fails with 400.
Filtering by tags in file search
Use the tags key in POST /files/search/ to filter files by their tags:
All three keys are optional, but at least one must be non-empty. Tag values are normalized before the search query is built.
Get $YOUR_PUBLIC_KEY and $YOUR_SECRET_KEY from
API keys.