Validate an uploaded archive and preview what it would restore.
const url = 'https://api.tradr.cloud/api/account-data/import/preview';const options = {method: 'POST', headers: {'Content-Type': 'application/zip'}, body: 'binary'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tradr.cloud/api/account-data/import/preview \ --header 'Content-Type: application/zip' \ --data binaryAuthed. Reads the raw .zip request body, validating it before any write: manifest present and version supported, counts match, every row strict, references resolve, invariants hold and the target account is empty. Writes nothing. Returns the server’s own per-category counts, the source app version, the export date, any degradations and a digest the confirm call must echo. Rate limited with import (10 / hour per user, fallback 6). The server bounds processing to a four-minute limit from handler entry; a longer run times out and previews nothing. Scripts sign in for a session cookie and, on split-origin deployments, send an allowed Origin header.
Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “ Responses ”{ counts, sourceAppVersion, exportedAt, degradations, digest }.
ARCHIVE_VERSION_UNSUPPORTED, ARCHIVE_INVALID or ARCHIVE_EMPTY.
No valid session.
IMPORT_TARGET_NOT_EMPTY — the account already holds data; the message names the categories.
ARCHIVE_TOO_LARGE — the upload exceeded a cap; the message names the cap.
IMPORT_TIMED_OUT — processing exceeded the four-minute server limit; nothing was previewed.
Rate limit exceeded (10 / hour per user).
IMPORT_CAPACITY_REACHED — the server is already processing another import; nothing was spooled.