Dataset routes
All these routes act on one dataset, the {datasetId} of the path. Base URLs, authentication and the response envelope are in Requests and responses. Every route except the CSV takes its time on a large dataset: call them on usapi.
| Route | Purpose |
|---|---|
POST /dataset/{datasetId}/csv | Generate the training CSV |
POST /dataset/{datasetId}/downloadZip | Export images as a ZIP |
POST /dataset/{datasetId}/operation | Move or copy images into the dataset |
POST /dataset/{datasetId}/images/update | Assign division, tag, labeled flag or groups |
POST /dataset/{datasetId}/reviewaction | Accept or roll back the images in review |
POST /dataset/{datasetId}/deleteBulk | Delete images |
POST /dataset/{datasetId}/group/delete | Delete a group |
POST /dataset/{datasetId}/delete | Delete the dataset |
All of them accept an optional job to publish their progress: see Progress of long operations.
Training CSV
POST /dataset/{datasetId}/csv?test=20&validation=10Writes the CSV that a training reads: one row per image, box or mask, with the gs:// location of the image file and its label. The file is saved in the storage bucket of the project as model-config/<datasetId>.csv and the answer gives its location. With include_groups it is saved as model-config/<datasetId>.groups.csv instead, so that an export with the extra column never replaces the file a training reads.
The options go in the query string:
| Parameter | Default | Effect |
|---|---|---|
test | none | Percentage of images for the test set. When present, the images are split at random into train, test and validation |
validation | none | Percentage of images for the validation set, together with test |
assign_scope | all | With predetermined, the images already in TRAIN, TEST or VALIDATION keep their division and only the rest are split |
balance_groups | false | With test, also spreads each class over its groups in proportion |
save_set | false | With test, writes the resulting division on each image. Images left out of the CSV go back to PREDETERMINED, unless assign_scope=predetermined |
tagmap | none | The tags to include and the label each one gets in the CSV: see below |
groups | none | Group ids separated by commas: only images in any of those groups. none selects the images without group |
include_set | true | Writes the division as the first column |
include_groups | false | Writes a column with the group names of the image, joined with |, after the division |
include_pending | false | Includes images that are not marked as labeled |
Boolean parameters accept true, false, 1 and 0.
Without test, the CSV keeps the division each image already has and leaves out the images in REVIEW; oriented-box datasets do not apply that filter. With test, the images in REVIEW take part in the split like the rest.
The random split is stratified by class: every class gets its share of each set, an image with several classes counts for its rarest one, and a class with three or more images gets at least one image in test and one in validation when there is room for all classes.
tagmap is a list of entries <label>-|-<tagId> joined with --||--; a space inside a label or id is written !!-. Scratch-|-scratch--||--Dent-|-dent_deep includes the tags scratch and dent_deep and labels them Scratch and Dent. Without tagmap, a tag is written with its id.
| Dataset type | Effect of tagmap |
|---|---|
MULTICLASS | Optional. Narrows the CSV to the listed tags |
ANOMALY | Optional. The labels are always OK and NOK; a list without the defect tag leaves the defect images out |
MULTILABEL, detection, oriented boxes | Needed: only the annotations of the listed tags enter the CSV, so pass every tag you want to train on. In detection, list 0 to include the images without boxes |
OCR | Ignored |
Which images enter. In classification and anomaly datasets every image with a tag other than unclassified enters. In the other types only images marked as labeled do, unless include_pending is set; oriented-box datasets take every image that has boxes.
Rows by dataset type, after the optional division and group columns:
| Dataset type | Row |
|---|---|
MULTICLASS | "<image>","<label>" |
ANOMALY | "<image>","OK" or "NOK", then "<mask>" (empty for a normal image or one without mask) |
MULTILABEL | "<image>","<label>","<mask>", one row per mask; normal and unannotated images get a row with OK or 0 |
imageObjectDetection | "<image>","<label>",x1,y1,,,x2,y2,,, one row per box, with coordinates as fractions of the image size, cut to the image. An image without boxes gives "<image>","<label>" |
imageObjectDetectionOBB | "<division>","<image>","<label>",x1,y1,x2,y2,x3,y3,x4,y4, one row per box. The division column is always written. A box whose center is outside the image, or that is larger than the image, is left out |
OCR | "<image>","<text>",x1,y1,,,x2,y2,,, one row per text box. An image without boxes gives "<image>" |
The division column holds train, test, validation or predetermined, in lower case; oriented-box datasets write it in upper case.
The answer:
{
"data": {
"message": "Detection csv generated",
"training": {
"name": "rp-obj-bottles",
"dataset": "gs://<projectId>/model-config/rp-obj-bottles.csv"
}
}
}404 if the dataset does not exist and 400 if its type has no CSV.
ZIP export
POST /dataset/{datasetId}/downloadZip{ "images": ["Qm3xZ0aT9kLw2VbN7cYd", "b8Hn2LpQ5rTs0VwX1yZa"], "storage": true }| Field | Required | Meaning |
|---|---|---|
images | yes | Ids of the images to export. Repeated ids count once; without ids the ZIP is empty |
storage | no | true saves the ZIP in the storage of the project and answers with a download link. Without it the answer is the ZIP file itself, a mode kept for older clients |
The ZIP holds the original file of each image, byte for byte and with its own extension, in one folder per tag:
| Dataset type | Folders |
|---|---|
MULTICLASS, OCR | One per tag; Unclassified/ for images without class |
ANOMALY | One per tag, with the masks in <tag>/Masks/ |
MULTILABEL | Normal/ for normal images, Anomaly/<tag>/ for each tag of the image with its masks in Anomaly/<tag>/Masks/, and Anomaly/0/ for the rest |
| Detection, oriented boxes | One per tag present in the image (the image is repeated in each); Unclassified/ for images without boxes |
Images with the same name get _1, _2… skipped counts the requested ids that are not in the ZIP: ids that do not exist, images without file and images that could not be read. A mask that cannot be read is left out, and its image is still exported. The ZIP is named after the dataset, with the date.
{
"data": {
"url": "https://firebasestorage.googleapis.com/v0/b/<projectId>/o/exports%2F…%2Fbottles_2026-10-30.zip?alt=media&token=…",
"name": "bottles_2026-10-30.zip",
"size": 734003200,
"images": 598,
"skipped": 2,
"expiresAt": "2026-11-06T09:12:44.000Z"
}
}The link works without signing in and lasts at least until expiresAt, seven days later. Exports older than that are removed when a new one is made.
With storage: true the export goes on even if the client disconnects. It can be cancelled when it was started with a job: see Cancelling an export; the answer is then 499.
404 if the dataset does not exist.
Move or copy images
POST /dataset/{datasetId}/operationBrings images into the dataset of the path, the destination. Pass either a list of images or a whole source dataset, never both:
{ "type": "copy", "images": ["Qm3xZ0aT9kLw2VbN7cYd", "b8Hn2LpQ5rTs0VwX1yZa"] }{ "type": "move", "source": "rp-obj-bottles-2025" }| Field | Required | Meaning |
|---|---|---|
type | yes | move or copy |
images | one of the two | Ids of the images to transfer |
source | one of the two | Id of a dataset: all its images are transferred |
keepDate | no | Copies only: true gives each copy the date of its original instead of the date of the copy (default false). A move never changes the date |
originType | no | Type of the dataset the images come from. Only used for an image whose own dataset no longer exists |
What a transfer does:
- A copy is a new image with its own files: original, previews and masks. It gets a new id and a generated name, and its comment says which image it was copied from. Deleting the original later does not affect the copy. The answer does not list the ids of the copies.
- A move keeps the image, its id and its name, takes its masks along and empties its comment.
- Tags the destination lacks are created with the name, color and description they have in the source.
- An
ANOMALYdestination never gets new tags. Images that come from a dataset of another type keep their class if they were unclassified or normal, and get the defect tag of the destination otherwise. - Groups are matched by name in the destination, and created when missing.
- Annotations survive only between datasets of the same type; detection and oriented boxes count as one type. Into a dataset of another type, and always into a
MULTICLASSone, the image arrives without boxes or masks and not labeled. AMULTICLASSdestination keeps the class of the image; segmentation and detection destinations reset it to unclassified.
{
"data": {
"processed": 596,
"skipped": 0,
"failed": ["b8Hn2LpQ5rTs0VwX1yZa"],
"failedCount": 1,
"requested": 597
}
}| Field | Meaning |
|---|---|
processed | Images written in the destination |
skipped | Ids that do not exist |
failed | Ids that could not be transferred, the first 100 |
failedCount | How many failed in total |
requested | Distinct ids received, or images in source when the operation started |
An image whose original file cannot be copied goes to failed and the rest continue. If no image at all could be transferred, the answer is 500 with 0 of N images transferred before failing and the first error. If the operation stops for another reason, the answer is 500 with N of M images transferred before failing: the images already transferred stay transferred. Repeating a move that stopped halfway is safe; repeating a copy duplicates what was already copied.
400 if type is not move or copy, if there are no images and no source, if both are given, or if source is the destination itself. 404 if the destination or source does not exist.
Update many images
POST /dataset/{datasetId}/images/update{ "images": ["Qm3xZ0aT9kLw2VbN7cYd", "b8Hn2LpQ5rTs0VwX1yZa"], "change": { "set": "TEST" } }Applies one change to a list of up to 100,000 images. change is exactly one of:
change | Effect on each image |
|---|---|
{ "set": "TRAIN" } | Sets the division: PREDETERMINED, TRAIN, VALIDATION, TEST or REVIEW |
{ "tag": "<tagId>" } | Sets the class of the image |
{ "labeled": true } | Sets or clears the labeled flag |
{ "groups": { "add": ["<groupId>"] } } | Adds the image to those groups |
{ "groups": { "remove": ["<groupId>"] } } | Removes the image from those groups |
{ "groups": { "clear": true } } | Removes the image from all its groups |
{ "data": { "requested": 2, "updated": 2, "missing": 0, "failed": 0 } }missing counts ids that do not exist and failed ids that are not valid or could not be written.
400 if images is empty or has more than 100,000 ids, or if change is not one of the six forms. 404 if the dataset, the tag or one of the groups does not exist.
Review action
POST /dataset/{datasetId}/reviewaction{ "action": "accept" }Closes the review of the images that an automatic classification left in the REVIEW division. accept moves them to PREDETERMINED with the class they were given; rollback moves them to PREDETERMINED and returns them to unclassified.
{ "data": { "processed": 340 } }400 if action is not accept or rollback, 404 if the dataset does not exist.
Delete images
POST /dataset/{datasetId}/deleteBulk{ "images": ["Qm3xZ0aT9kLw2VbN7cYd", "b8Hn2LpQ5rTs0VwX1yZa"] }Deletes the images and the files that belong only to them: the original, the previews no other image uses and the masks.
{ "data": { "requested": 2, "deleted": 2, "failed": [], "failedFiles": [] } }| Field | Meaning |
|---|---|
requested | Ids received |
deleted | Images deleted |
failed | Ids that could not be deleted. Their files are kept |
failedFiles | Files that could not be removed from storage |
Ids that do not exist are skipped. If reading the images fails halfway, the answer is 500 with deleted N of M images before failing: the images deleted so far stay deleted, and the call can be repeated with the same list.
400 if images is missing or empty.
Delete a group
POST /dataset/{datasetId}/group/delete{ "id": "g1Xa8" }Removes the group from the images that are in it and then deletes the group. The images themselves are not deleted.
{ "data": { "id": "g1Xa8", "updated": 57 } }If some image could not be updated the answer is 500 and the group is kept, so the call can be repeated. 400 without id, 404 if the group does not exist.
Delete the dataset
POST /dataset/{datasetId}/deleteNo body is needed. Deletes, in this order: the images of the dataset with their files, the evaluation results of its models, the share links of its models, the models, and the dataset itself with its tags and groups. The dataset is removed last, so a deletion that is interrupted leaves the dataset visible and the call can be repeated.
{
"data": {
"id": "rp-obj-bottles-2025",
"images": 5120,
"models": 3,
"annotations": 1536,
"shareTokens": 1,
"failedFiles": []
}
}The trained model files kept by the training service are not removed.
404 if the dataset does not exist.