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.
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.
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
| Resource | Fields |
|---|---|
| Lifecycle | status (active, closing, closed), closedAt, eraseBy, cleanup, exportId, exportAvailableUntil |
| Cleanup | state (pending, running, complete, overdue), pendingOriginals, lastError |
| Export | status (pending, ready, expired), cutoff, expiresAt. A paged copy, not an atomic snapshot. |
| Page item | module, 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) andX-Roye-Environment(developmentorproduction).
Authorization: Bearer <owner ID token>
X-Roye-Project: <projectId>
X-Roye-Environment: development
Roye-Contract-Version: 1
Content-Type: application/jsonExit and erasure
- Exit is permanent. It immediately blocks ordinary access and new funding in both environments.
export: truereturns a separateexportIdwith an exit-time cutoff.- Cleanup erases content and exported copies by
eraseBy. Roye resumes a failed or overdue stage itself; you only readcleanup. - 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.
| Route | Purpose |
|---|---|
GET / | Lifecycle status. |
POST /exit | Exit. export (boolean) adds an export. |
POST /exports | Export while active. Returns 201. |
GET /exports/:exportId | Export status. |
GET /exports/:exportId/pages | One page of items. |
GET /v1/organizations/:organizationId/lifecycle/projects | The organization's closed projects. |
Limits
| Limit | Value |
|---|---|
| Paging | Only limit (1 to 25) and cursor (the returned next). Other queries, duplicate keys and invalid bodies are refused. |
| Export lifetime | Within seven days of its request, and at most seven days after exit. |
| Erasure deadline | Within seven days of exit. |
| Content lifetime | 30 days from creation or revision. Reads and exports do not extend it. |
Errors
Errors use the shared JSON error envelope.
| Code | HTTP | Meaning |
|---|---|---|
invalid_request | 400 | Bad body or query. |
contract_version_unsupported | 400 | Wrong contract version. |
unauthorized, forbidden | 401, 403 | No sign-in or owner authority. |
not_found | 404 | Hidden resource or unknown route. |
idempotency_conflict | 409 | The exit key is bound to another export choice. |
operation_replay_expired | 410 | The export has expired. |
unavailable | 503 | The 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.