Upload a Snapshot

POST /api/0/projects/{organization_id_or_slug}/{project_id_or_slug}/preprodartifacts/snapshots/

Upload a new snapshot with image metadata.

The request body is a JSON object containing app_id (required), images (required, a mapping of filenames to image metadata objects), and optional VCS fields (head_sha, base_sha, provider, head_repo_name, head_ref, base_repo_name, base_ref, pr_number).

The body can be compressed with zstd: send it with the header Content-Encoding: zstd. It can be up to 256 MiB after decompression.

When VCS info with a base_sha is provided and a matching base snapshot exists, a comparison is automatically triggered.

This endpoint requires a bearer token with project:write access.

Path Parameters

organization_id_or_slug (string)
REQUIRED

The ID or slug of the organization the resource belongs to.

project_id_or_slug (string)
REQUIRED

The ID or slug of the project the resource belongs to. Project slugs are unique within each organization.

Body Parameters

app_id (string)
REQUIRED

ID of the app the snapshot belongs to, such as com.example.app.

images (object)
REQUIRED

Metadata of the snapshot's images, keyed by image file name.

diff_threshold (number)

Fraction of changed pixels, from 0 up to but not including 1, above which an image counts as changed. Images can override it.

selective (boolean)

Whether the snapshot holds only some of the app's images. Requires base_sha.

all_image_file_names (array(string))

File names of all the app's images, including the ones a selective snapshot leaves out. Requires selective, and must include every key of images.

head_sha (string)

SHA of the commit the build was made from.

base_sha (string)

SHA of the commit to compare against, such as the merge base of a pull request. Requires head_sha.

provider (string)

VCS provider of the repository, such as github.

head_repo_name (string)

Name of the repository the build was made from, such as owner/repo.

base_repo_name (string)

Name of the repository of the base commit, such as owner/repo.

head_ref (string)

Branch or ref the build was made from, such as feature/xyz.

base_ref (string)

Branch or ref of the base commit, such as main.

pr_number (integer)

Number of the pull request the build belongs to.

Scopes

<auth_token> requires one of the following scopes:
  • org:ci
  • project:admin
  • project:releases
  • project:write
Copied
curl https://sentry.io/api/0/projects/{organization_id_or_slug}/{project_id_or_slug}/preprodartifacts/snapshots/ \
 -H 'Authorization: Bearer <auth_token>' \
 -H 'Content-Type: application/json' \
 -d '{}'
RESPONSESCHEMA
Copied
{ "artifactId": "100", "snapshotMetricsId": "200", "imageCount": 5, "snapshotUrl": "https://sentry.io/organizations/org/preprod/snapshots/100/" }
Was this helpful?