Skip to content

POST /api/runs/:runId/restore

Summary

Restores a completed run by creating a new restore job that duplicates the original run’s snapshots and metadata.

Intent

Allows users to recover or replay the state of a previously completed run by cloning its file snapshots into a new job, useful for rollback or re-deployment scenarios.

Parameters

NameTypeRequiredDescription
runIdstringYesThe unique identifier of the completed run to restore.
customerIdstringNoOptional customer identifier sent in the request body. If provided, it must match the customerId associated with the run; otherwise the request is rejected with 403.

Request example

Terminal window
curl -X POST https://maps.google.com//api/runs/:runId/restore \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"customerId": "cust-456"}'

Response example

{
"ok": true,
"restoreJobId": "a3f1c2d4-e5b6-7890-abcd-ef1234567890",
"pagesUrl": "https://example.pages.dev/docs"
}

Error cases

  • 404 — No run exists with the provided runId
  • 403 — A customerId was provided in the request body but does not match the customerId on the run
  • 409 — The run exists but its status is not ‘complete’
  • 422 — The run is complete but has no file snapshots associated with it

Gotchas

  • Only runs with a status of ‘complete’ can be restored; attempting to restore an in-progress or failed run returns 409.
  • If customerId is included in the request body, it must exactly match the customerId stored on the original run — a mismatch returns 403 even if the runId is valid.
  • The restored job is created with status ‘complete’ immediately; it does not re-execute any pipeline logic, it only copies existing snapshots.
  • All copied snapshots receive new UUIDs and a new createdAt timestamp, so they are independent records from the originals.
  • A RESTORED event is recorded on the new job referencing the original runId, which can be used for audit trail purposes.
  • The endpoint returns the pagesUrl from the original run, not a newly generated one.