# /api/provisioning/instances/preflight (dashboard)

Source-derived dashboard endpoint contract, authentication, request validation, responses, and errors.

Source: https://docs.minds.sh/docs/api/platform/reference/dashboard--api-provisioning-instances-preflight



This is the **dashboard** service route. Its origin and authentication are described in [Platform API overview](/docs/api/platform) and [Authentication](/docs/api/platform/authentication). A path shared by another service is a different endpoint.

| Property                       | Contract                                                                       |
| ------------------------------ | ------------------------------------------------------------------------------ |
| Methods                        | GET                                                                            |
| Path                           | `/api/provisioning/instances/preflight`                                        |
| Path parameters                | None                                                                           |
| 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 [#authentication-and-access]

Dashboard session cookie through @repo/auth/server. Some auth-summary routes can redirect to sign-in; inspect the status branches below.

## Method behavior [#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 [#get]

```typescript
export async function GET() {
  try {
    const session = await getSession();
    if (!session) {
      return NextResponse.json(
        { error: { code: 'UNAUTHENTICATED', message: 'Sign in at auth.l1fe.ai.' } },
        { status: 401, headers: noStoreHeaders() }
      );
    }

    const cookieStore = await cookies();
    const organizationContext = await loadMindsOrganizationContext({
      accessToken: session.accessToken,
      activeTenantId: cookieStore.get(ACTIVE_TENANT_COOKIE)?.value,
      tokenOrgId: session.user.orgId,
      tokenTenantId: session.user.tenantId,
    });

    return NextResponse.json(
      buildMindsLiveProvisioningPreflight({ organizationContext }),
      { headers: noStoreHeaders() }
    );
  } catch {
    return NextResponse.json(
      {
        ok: false,
        error: {
          code: 'PREFLIGHT_FAILED',
          message: 'Minds provisioning preflight failed while reading production state.',
        },
      },
      { status: 500, headers: noStoreHeaders() }
    );
  }
}
```

Source: `minds-ui/apps/app/app/api/provisioning/instances/preflight/route.ts:14`.

## Response and error branches [#response-and-error-branches]

Literal HTTP statuses in the route: 401, 500. Shared management error classes are defined in [Errors and responses](/docs/api/platform/errors).

```typescript
NextResponse.json(
        { error: { code: 'UNAUTHENTICATED', message: 'Sign in at auth.l1fe.ai.' } },
        { status: 401, headers: noStoreHeaders() }
      )
```

Source: `minds-ui/apps/app/app/api/provisioning/instances/preflight/route.ts:18`.

```typescript
NextResponse.json(
      buildMindsLiveProvisioningPreflight({ organizationContext }),
      { headers: noStoreHeaders() }
    )
```

Source: `minds-ui/apps/app/app/api/provisioning/instances/preflight/route.ts:32`.

```typescript
NextResponse.json(
      {
        ok: false,
        error: {
          code: 'PREFLIGHT_FAILED',
          message: 'Minds provisioning preflight failed while reading production state.',
        },
      },
      { status: 500, headers: noStoreHeaders() }
    )
```

Source: `minds-ui/apps/app/app/api/provisioning/instances/preflight/route.ts:37`.

## Service dependencies [#service-dependencies]

* `minds-ui/apps/app/lib/organizations.ts`
* `minds-ui/apps/app/lib/provisioning/preflight.ts`

## Evidence [#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/app/app/api/provisioning/instances/preflight/route.ts`. SHA-256: `e0d1b7e123bfe5fbadedd5edeb2548603c6e8e5a060e897d91c92a9cb4c4e6d9`.
