Skip to content

API surface

The local API is HTTP, served at http://127.0.0.1:8000 by default. Every mutating endpoint requires a same-site rewind_session cookie, which the server sets on the first GET request from an allowed origin.

Routes are versioned under /api/v1 and /api/v2. v2 supersedes v1 in the few places where both exist; the request area uses v2 for sending, and history uses v2 for the v2-style body payload. When the table says "v1", that's the only version.

The endpoint groups below match the modules/ folders in apps/api/src/modules/. Each module is a thin Elysia sub-app that delegates to a domain service in apps/api/src/core/<domain>/; the composition root in app.ts is the only place that wires them together. See Architecture → Backend modules for the file map.

For concept-level explanations of each resource, see Workspace overview (regions of the UI), Collections and folders, Request settings (network options), Environments, Viewing and filtering history, Importing OpenAPI, Restoring a backup, and Running a collection.

Health (modules/health)

MethodPathNotes
GET/healthReturns { status: "ok", service: "rewind-api-studio", timestamp }. Useful as a liveness check.

Workspace summary (modules/workspace)

MethodPathNotes
GET/api/v1/workspaceReturns collections, environments, and the 50 most recent history entries. Used by the sidebar on boot.

Collections & folders (modules/collection)

MethodPathNotes
GET/api/v1/collectionsList every collection.
POST/api/v1/collectionsCreate a collection. Body: { name, description? }.
GET/api/v1/collections/:idGet one collection, including its folders and requests.
PUT/api/v1/collections/:idUpdate name/description.
DELETE/api/v1/collections/:idDelete and cascade.
POST/api/v1/collections/:id/duplicateCreate a copy of the collection.
POST/api/v1/collections/:id/foldersCreate a folder. Body: { name, parentId? }.
PATCH/api/v1/folders/:idRename or move a folder.
DELETE/api/v1/folders/:idDelete the folder. Requests inside are moved to the folder's parent.
PATCH/api/v1/workspace/treeBulk-mutate folder/request ordering and parent. Body shape: { collectionId, items: [{ type, id, parentFolderId, sortOrder }] }. Lives on the collection module but stays under /workspace for backward compatibility.

Requests (modules/request)

MethodPathNotes
POST/api/v1/collections/:id/requestsCreate a saved request inside a collection. Body: full request draft.
GET/api/v1/requests/:idGet a saved request.
PUT/api/v1/requests/:idUpdate. Body must include expectedRevision to detect conflicts.
DELETE/api/v1/requests/:idDelete.
POST/api/v1/requests/:id/duplicateCreate a copy.

The actual send and runner endpoints live on the execution module; they're listed below under that heading.

Execution (modules/execution)

MethodPathNotes
POST/api/v1/requests/sendSend a draft. Body: { requestId?, draft, executionId? }. Returns the v1 SendResult shape.
POST/api/v2/requests/sendSend a draft. Same input, returns the v2 response shape with the response body wrapped in a body: { kind, contentType, bodyUrl, ... } envelope.
DELETE/api/v1/executions/:idCancel an in-flight request.
POST/api/v1/runnerRun every request in a collection. Body: { collectionId, environmentId?, stopOnFailure? }. Returns the same shape the UI dialog shows.

Concept overview: Running a collection.

Environments (modules/environment)

MethodPathNotes
GET/api/v1/environmentsList every environment.
POST/api/v1/environmentsCreate. Body: { name, isActive?, variables? }.
PUT/api/v1/environments/:idUpdate.
DELETE/api/v1/environments/:idDelete.

History (modules/history)

MethodPathNotes
GET/api/v1/historyList entries. Supports query, method, outcome, collectionId, from, to, limit, cursor.
DELETE/api/v1/historyClear all history.
GET/api/v1/history/:idGet one entry, v1 shape.
GET/api/v2/history/:idGet one entry, v2 shape (response body in envelope).
GET/api/v2/history/:id/bodyDownload the stored response body.
DELETE/api/v1/history/:idDelete one entry.

Concept overview: Viewing and filtering and Reopening from history.

Attachments (modules/attachment)

MethodPathNotes
POST/api/v1/attachmentsMultipart upload. Form field: file. Max size 100 MB.
GET/api/v1/attachments/:idDownload a stored file.
DELETE/api/v1/attachments/:idDelete.
MethodPathNotes
GET/api/v1/cookies?jarId=defaultList cookies in the named jar.
DELETE/api/v1/cookies?jarId=defaultClear all cookies in the named jar.

Settings (modules/settings)

MethodPathNotes
GET/api/v1/settings/networkGet proxy and TLS settings.
PUT/api/v1/settings/networkUpdate.
GET/api/v1/settings/storageGet the four storage knobs.
PUT/api/v1/settings/storageUpdate.

Import & export (modules/importer)

MethodPathNotes
POST/api/v1/import/openapiBody: { source } — the OpenAPI document as text.
POST/api/v1/import/postmanBody: { source } — the Postman collection as text.
POST/api/v1/import/workspaceBody: a WorkspaceExport payload (see Request schema).
GET/api/v1/export/workspace?includeSecrets=falseWorkspace as JSON.
GET/api/v1/export/postman/:idDownload a single collection as Postman v2.1 JSON.

Archive (modules/archive)

The archive endpoints are v2 because they require the v2 send/response shape on the request side.

MethodPathNotes
GET/api/v2/workspace/archive?includeSecrets=&includeResponseBodies=&confirm=Download a .rewind archive. The two opt-in flags require confirm=true for that flag.
POST/api/v2/workspace/archive/previewMultipart upload of a .rewind file. Returns the manifest preview.
POST/api/v2/workspace/archive/restore?confirmSecrets=&confirmResponseBodies=Multipart upload of a .rewind file. Restores the workspace.

Concept overview: Exporting and backups and Restoring a backup.

Diagnostics (modules/diagnostic)

MethodPathNotes
GET/api/v1/diagnostics/archiveDownloads a .tar.gz with a diagnostic.json and the current log files.

Concept overview: Data and storage → Diagnostic archive.

Error responses

Every error response has the centralized Api.Error shape from apps/api/src/http/response.ts:

json
{ "error": "<code>", "message": "<human readable>", "details": "<optional extra>" }

The error value is one of the codes in the ApiErrorCode union:

  • validation_error — request body failed Elysia validation. details is the Elysia validation report.
  • request_validation_error — request draft is invalid (e.g. unresolved variables, bad URL). details is an object with the specific cause.
  • not_found — the resource doesn't exist.
  • forbidden — the request crossed the origin allowlist or the same-site session check.
  • conflict — save revision mismatch. details.current is the current stored state.
  • internal_error — anything else; the message is the underlying error message.

Status codes

The API uses these status codes consistently:

  • 200 for successful reads and updates
  • 201 for successful creates
  • 400 for validation errors
  • 403 for origin or session errors
  • 404 for missing resources
  • 409 for revision conflicts
  • 500 for anything else

What's next?

Released under the MIT License.