Skip to content

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.

RoutePurpose
POST /dataset/{datasetId}/csvGenerate the training CSV
POST /dataset/{datasetId}/downloadZipExport images as a ZIP
POST /dataset/{datasetId}/operationMove or copy images into the dataset
POST /dataset/{datasetId}/images/updateAssign division, tag, labeled flag or groups
POST /dataset/{datasetId}/reviewactionAccept or roll back the images in review
POST /dataset/{datasetId}/deleteBulkDelete images
POST /dataset/{datasetId}/group/deleteDelete a group
POST /dataset/{datasetId}/deleteDelete the dataset

All of them accept an optional job to publish their progress: see Progress of long operations.

Training CSV ​

http
POST /dataset/{datasetId}/csv?test=20&validation=10

Writes 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:

ParameterDefaultEffect
testnonePercentage of images for the test set. When present, the images are split at random into train, test and validation
validationnonePercentage of images for the validation set, together with test
assign_scopeallWith predetermined, the images already in TRAIN, TEST or VALIDATION keep their division and only the rest are split
balance_groupsfalseWith test, also spreads each class over its groups in proportion
save_setfalseWith test, writes the resulting division on each image. Images left out of the CSV go back to PREDETERMINED, unless assign_scope=predetermined
tagmapnoneThe tags to include and the label each one gets in the CSV: see below
groupsnoneGroup ids separated by commas: only images in any of those groups. none selects the images without group
include_settrueWrites the division as the first column
include_groupsfalseWrites a column with the group names of the image, joined with |, after the division
include_pendingfalseIncludes 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 typeEffect of tagmap
MULTICLASSOptional. Narrows the CSV to the listed tags
ANOMALYOptional. The labels are always OK and NOK; a list without the defect tag leaves the defect images out
MULTILABEL, detection, oriented boxesNeeded: 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
OCRIgnored

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 typeRow
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:

json
{
  "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 ​

http
POST /dataset/{datasetId}/downloadZip
json
{ "images": ["Qm3xZ0aT9kLw2VbN7cYd", "b8Hn2LpQ5rTs0VwX1yZa"], "storage": true }
FieldRequiredMeaning
imagesyesIds of the images to export. Repeated ids count once; without ids the ZIP is empty
storagenotrue 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 typeFolders
MULTICLASS, OCROne per tag; Unclassified/ for images without class
ANOMALYOne per tag, with the masks in <tag>/Masks/
MULTILABELNormal/ 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 boxesOne 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.

json
{
  "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 ​

http
POST /dataset/{datasetId}/operation

Brings images into the dataset of the path, the destination. Pass either a list of images or a whole source dataset, never both:

json
{ "type": "copy", "images": ["Qm3xZ0aT9kLw2VbN7cYd", "b8Hn2LpQ5rTs0VwX1yZa"] }
json
{ "type": "move", "source": "rp-obj-bottles-2025" }
FieldRequiredMeaning
typeyesmove or copy
imagesone of the twoIds of the images to transfer
sourceone of the twoId of a dataset: all its images are transferred
keepDatenoCopies 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
originTypenoType 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 ANOMALY destination 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 MULTICLASS one, the image arrives without boxes or masks and not labeled. A MULTICLASS destination keeps the class of the image; segmentation and detection destinations reset it to unclassified.
json
{
  "data": {
    "processed": 596,
    "skipped": 0,
    "failed": ["b8Hn2LpQ5rTs0VwX1yZa"],
    "failedCount": 1,
    "requested": 597
  }
}
FieldMeaning
processedImages written in the destination
skippedIds that do not exist
failedIds that could not be transferred, the first 100
failedCountHow many failed in total
requestedDistinct 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 ​

http
POST /dataset/{datasetId}/images/update
json
{ "images": ["Qm3xZ0aT9kLw2VbN7cYd", "b8Hn2LpQ5rTs0VwX1yZa"], "change": { "set": "TEST" } }

Applies one change to a list of up to 100,000 images. change is exactly one of:

changeEffect 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
json
{ "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 ​

http
POST /dataset/{datasetId}/reviewaction
json
{ "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.

json
{ "data": { "processed": 340 } }

400 if action is not accept or rollback, 404 if the dataset does not exist.

Delete images ​

http
POST /dataset/{datasetId}/deleteBulk
json
{ "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.

json
{ "data": { "requested": 2, "deleted": 2, "failed": [], "failedFiles": [] } }
FieldMeaning
requestedIds received
deletedImages deleted
failedIds that could not be deleted. Their files are kept
failedFilesFiles 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 ​

http
POST /dataset/{datasetId}/group/delete
json
{ "id": "g1Xa8" }

Removes the group from the images that are in it and then deletes the group. The images themselves are not deleted.

json
{ "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 ​

http
POST /dataset/{datasetId}/delete

No 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.

json
{
  "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.