/api/v1/tenants/[id]/backups/[backupId] (management)
Source-derived management endpoint contract, authentication, request validation, responses, and errors.
This is the management service route. Its origin and authentication are described in Platform API overview and Authentication. A path shared by another service is a different endpoint.
| Property | Contract |
|---|---|
| Methods | DELETE |
| Path | /api/v1/tenants/[id]/backups/[backupId] |
| Path parameters | id, backupId |
| Query parameters read in route | None read directly; schema validation below may define additional fields |
| Headers read in route | No additional direct header reads; authentication helpers may read credentials |
Authentication and access
Management auth context: validated x-api-key or configured session authentication; trusted gateway integration may select its auth pipeline. Organization/tenant checks are separate.
Request and response definitions
The following named definitions are imported or declared by this route. Optional markers, defaults, bounds, and enum values are shown exactly as implemented. A response type is a source contract, not an example populated with real account data.
RouteContext
interface RouteContext {
params: Promise<{ id: string; backupId: string }>
}Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/backups/[backupId]/route.ts:15.
Method behavior
The handler excerpt preserves field validation, response envelopes, cookie changes, and exception branches. Values returned by service helpers retain their named response type above; for passthrough routes, the upstream response is authoritative.
DELETE
export async function DELETE(request: NextRequest, context: RouteContext) {
const requestId = generateRequestId()
const { id, backupId } = await context.params
let rateLimitInfo: RateLimitMetadata | undefined
try {
const tenantId = validateTenantId(id)
const resolvedBackupId = validatePathParam(backupId, 'backup_id')
const authContext = await resolveAuthContext(request)
const evaluation = await enforceRateLimit({
context: authContext,
tenantId,
})
rateLimitInfo = {
...evaluation.metadata,
retryAfter: evaluation.retryAfter,
}
if (evaluation.blocked) {
throw new RateLimitExceededError(evaluation.retryAfter ?? 60)
}
await deleteBackup(authContext, tenantId, resolvedBackupId)
const response = apiNoContent()
return withRequestMetadata(response, requestId, rateLimitInfo)
} catch (error) {
if (error instanceof ApiError) {
const response = apiError(error, requestId)
return withRequestMetadata(response, requestId, rateLimitInfo)
}
console.error('Failed to delete backup:', error)
const response = apiError(
new ApiError(500, 'INTERNAL_ERROR', 'Failed to delete backup'),
requestId,
)
return withRequestMetadata(response, requestId, rateLimitInfo)
}
}Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/backups/[backupId]/route.ts:19.
Response and error branches
Literal HTTP statuses in the route: 500. Shared management error classes are defined in Errors and responses.
new RateLimitExceededError(evaluation.retryAfter ?? 60)Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/backups/[backupId]/route.ts:39.
apiError(error, requestId)Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/backups/[backupId]/route.ts:47.
apiError(
new ApiError(500, 'INTERNAL_ERROR', 'Failed to delete backup'),
requestId,
)Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/backups/[backupId]/route.ts:51.
new ApiError(500, 'INTERNAL_ERROR', 'Failed to delete backup')Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/backups/[backupId]/route.ts:52.
Service dependencies
minds-ui/apps/api-service/lib/api-response.tsminds-ui/apps/api-service/lib/validation.tsminds-ui/apps/api-service/types/errors.tsminds-ui/apps/api-service/lib/services/auth-context.tsminds-ui/apps/api-service/lib/services/backup-service.tsminds-ui/apps/api-service/lib/services/rate-limit.ts
Evidence
Generated from the local source snapshot on 2026-09-12. This page documents implemented code and does not certify a deployed service, permissions configuration, or successful provider operation.
Source file: minds-ui/apps/api-service/app/api/v1/tenants/[id]/backups/[backupId]/route.ts. SHA-256: 60a07123ad86936678ea144313c19ac2af8227857333410fac3f40662595f057.
/api/v1/tenants/[id]/backups/[backupId]/restore (management)
Source-derived management endpoint contract, authentication, request validation, responses, and errors.
/api/v1/tenants/[id]/backups (management)
Source-derived management endpoint contract, authentication, request validation, responses, and errors.