Skip to content

Billing and projects

Project exit and export

The current organization owner can export a project's retained content in pages and close the project. The sign-in account and other projects remain.

Local preview

Local preview only, project lifecycle contract 1. Status and exit cover the whole project, in both environments.

Quickstart

Export while the project is active. Poll until the export leaves pending, then read its pages.

export.ts
const status = await roye.projectLifecycle.get(projectId);
let exportJob = await roye.projectLifecycle.createExport(projectId, 'export-1');
while (exportJob.status === 'pending') {
  await new Promise(resolve => setTimeout(resolve, 1000));
  exportJob = await roye.projectLifecycle.getExport(projectId, exportJob.id);
}
if (exportJob.status === 'ready') {
  const page = await roye.projectLifecycle.exportPage(projectId, exportJob.id, { limit: 25 });
  // Pass page.next as cursor to read more pages when present.
}

Then exit, optionally with an export of its own.

exit.ts
const closed = await roye.projectLifecycle.listClosed(organizationId, { limit: 25 });
const exited = await roye.projectLifecycle.exit(projectId, { idempotencyKey: 'exit-1', export: true });
// Poll exited.exportId separately before reading its pages.

Resources

ResourceFields
Lifecyclestatus (active, closing, closed), closedAt, eraseBy, cleanup, exportId, exportAvailableUntil
Cleanupstate (pending, running, complete, overdue), pendingOriginals, lastError
Exportstatus (pending, ready, expired), cutoff, expiresAt. A paged copy, not an atomic snapshot.
Page itemmodule, resource, environment, createdAt, expiresAt, body

Authentication

  • Send a fresh owner sign-in token on every request, including the organization listing. Backend keys get no access after exit.
  • Project routes need X-Roye-Project (the path's project) and X-Roye-Environment (development or production).
Headers (project routes)
Authorization: Bearer <owner ID token>
X-Roye-Project: <projectId>
X-Roye-Environment: development
Roye-Contract-Version: 1
Content-Type: application/json

Exit and erasure

  • Exit is permanent. It immediately blocks ordinary access and new funding in both environments.
  • export: true returns a separate exportId with an exit-time cutoff.
  • Cleanup erases content and exported copies by eraseBy. Roye resumes a failed or overdue stage itself; you only read cleanup.
  • An export is unreadable once its content expires or cleanup reaches it. Unfinished preparation may expire rather than delay erasure, so download before exit.
  • The owner still sees original payment and refund status after exit.

Endpoints

Project routes start with /v1/projects/:projectId/lifecycle. POST bodies take an idempotencyKey.

RoutePurpose
GET /Lifecycle status.
POST /exitExit. export (boolean) adds an export.
POST /exportsExport while active. Returns 201.
GET /exports/:exportIdExport status.
GET /exports/:exportId/pagesOne page of items.
GET /v1/organizations/:organizationId/lifecycle/projectsThe organization's closed projects.

Limits

LimitValue
PagingOnly limit (1 to 25) and cursor (the returned next). Other queries, duplicate keys and invalid bodies are refused.
Export lifetimeWithin seven days of its request, and at most seven days after exit.
Erasure deadlineWithin seven days of exit.
Content lifetime30 days from creation or revision. Reads and exports do not extend it.

Errors

Errors use the shared JSON error envelope.

CodeHTTPMeaning
invalid_request400Bad body or query.
contract_version_unsupported400Wrong contract version.
unauthorized, forbidden401, 403No sign-in or owner authority.
not_found404Hidden resource or unknown route.
idempotency_conflict409The exit key is bound to another export choice.
operation_replay_expired410The export has expired.
unavailable503The export is still being prepared.

Recovery and usage

  • Retry a POST with the same idempotency key. An expired request cannot recreate copies.
  • Lifecycle routes record no usage of their own. Erasure keeps the minimal original call, unknown usage, accounting and refund authority; see Funding and usage.