Preview API
Preview upload is a three-step flow. Reserve upload slots, PUT each declared
artifact to its returned URL, then finalize the reservation. Authenticate API
requests with a Bearer API key with the preview_upload scope or a Peach CLI
session token. Send JSON bodies with Content-Type: application/json.
With a session token, both reserve and finalize also require
x-rnx-account-id: <account-id>. You must be a member of that account. An API
key selects its own account. See Authentication.
Reserve upload slots
POST https://peachsim.com/api/v1/previews
The response contains shareId, a reservation token, expiresAt in Unix
milliseconds, and presigned slots for the bundle and declared files or recording
artifacts. The reservation expires after 15 minutes. Each upload slot has
putUrl, objectKey, and contentType.
File entries can instead have skipped: true and no putUrl when their
contentHash identifies bytes already stored or another file in the reservation
uploads the same bytes. Do not PUT skipped entries.
PUT the exact declared bytes directly to each returned putUrl, using its
contentType as the Content-Type header. The presigned URL authorizes the PUT;
do not send your API key or session token to storage.
Finalize
POST https://peachsim.com/api/v1/previews/finalize
The API verifies that all declared objects arrived and returns the hosted link:
url is a short link that redirects to the preview page at
https://peachsim.com/preview/{id}, which keeps working too.
visibility is private when only signed-in members of the account can open
the link, and public when anyone with the link can. Previews uploaded with
an account credential start private; the owner turns on Public link from
the preview page’s share menu.
contentHash and snapshotsStored are also returned. An unknown or expired reservation
token returns 401 unauthorized.
The finalizing credential must resolve to the account that reserved the upload.
When using a session token, finalize as the same user and send the same
x-rnx-account-id as the reserve request. The reservation token in the JSON
body does not replace Bearer authentication.
Read metadata
GET https://peachsim.com/api/v1/previews/{id} requires Bearer authentication.
API keys require preview_upload and can read only their own account’s previews.
Session tokens can read previews the user can access, including public previews;
account membership alone does not grant access to every private repository preview.
The response includes its hosted url,
device details, files, recording artifacts, Git provenance, and account
attribution.
For a recording covered by a hosted test job, reserve with billingKind: "test_run"
and runnerJobId. The job must belong to the same account, be running, and have
a recording left. An API key also requires test_runs. Ordinary preview uploads
omit these fields. See Test Runs.