API referencePlatform APIEndpoint reference
GUIDE & REFERENCE

/api/v1/tenants/[id]/status (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.

PropertyContract
MethodsGET
Path/api/v1/tenants/[id]/status
Path parametersid
Query parameters read in routeNone read directly; schema validation below may define additional fields
Headers read in routeNo 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.

TenantStatusResponse

TenantStatusResponse = z.object({
  id: z.string(),
  status: TenantStatus,
  health: TenantHealthCheck,
  current_operation: z
    .object({
      type: z.enum(['provisioning', 'scaling', 'backup', 'restore']),
      started_at: z.string().datetime(),
      progress_percent: z.number().min(0).max(100),
    })
    .optional(),
})

Source: minds-ui/apps/api-service/types/tenant.ts:251.

TenantStatusResponse

export type TenantStatusResponse = z.infer<typeof TenantStatusResponse>

Source: minds-ui/apps/api-service/types/tenant.ts:264.

RouteContext

interface RouteContext {
  params: Promise<{ id: string }>
}

Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/status/route.ts:18.

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.

GET

export async function GET(request: NextRequest, context: RouteContext) {
  const requestId = generateRequestId()
  const { id } = await context.params
  let rateLimitInfo: RateLimitMetadata | undefined

  try {
    const tenantId = validateTenantId(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)
    }

    const status = await getTenantStatusResponse(authContext, tenantId)
    const response = apiSuccess<TenantStatusResponse>(status)
    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 get tenant status:', error)
    const response = apiError(
      new ApiError(500, 'INTERNAL_ERROR', 'Failed to get tenant status'),
      requestId,
    )
    return withRequestMetadata(response, requestId, rateLimitInfo)
  }
}

Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/status/route.ts:22.

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]/status/route.ts:42.

apiSuccess<TenantStatusResponse>(status)

Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/status/route.ts:46.

apiError(error, requestId)

Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/status/route.ts:50.

apiError(
      new ApiError(500, 'INTERNAL_ERROR', 'Failed to get tenant status'),
      requestId,
    )

Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/status/route.ts:54.

new ApiError(500, 'INTERNAL_ERROR', 'Failed to get tenant status')

Source: minds-ui/apps/api-service/app/api/v1/tenants/[id]/status/route.ts:55.

Service dependencies

  • minds-ui/apps/api-service/lib/api-response.ts
  • minds-ui/apps/api-service/lib/validation.ts
  • minds-ui/apps/api-service/types/tenant.ts
  • minds-ui/apps/api-service/types/errors.ts
  • minds-ui/apps/api-service/lib/services/auth-context.ts
  • minds-ui/apps/api-service/lib/services/tenant-service.ts
  • minds-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]/status/route.ts. SHA-256: b5ec83bf59b1de3a13f99ff2e1997342d47af561144a49b35b954ab7d1cb5196.

On this page