API referencePlatform APIEndpoint reference
GUIDE & REFERENCE

/api/hmr/[did]/backup/confirm (dashboard)

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

This is the dashboard 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
MethodsPOST
Path/api/hmr/[did]/backup/confirm
Path parametersdid
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

No explicit authentication check in this route module. Imported handlers or deployment middleware may impose additional controls; this inventory does not assert public deployment access.

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.

ConfirmPayload

type ConfirmPayload = {
  userId: string;
};

Source: minds-ui/apps/app/app/api/hmr/[did]/backup/confirm/route.ts:3.

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.

POST

POST = async (
  request: Request,
  { params }: { params: Promise<{ did: string }> },
) => {
  const { did } = await params;

  if (!did) {
    return Response.json({ error: 'Missing HMR DID' }, { status: 400 });
  }

  try {
    const payload = (await request.json()) as ConfirmPayload;

    if (!payload?.userId) {
      return Response.json(
        { error: 'userId is required to confirm HMR backup' },
        { status: 400 },
      );
    }

    const controller = new AbortController();
    const timeout = setTimeout(() => controller.abort(), 5_000);

    const response = await fetch(
      `${HMR_BASE_URL}/${encodeURIComponent(did)}/backup/confirm`,
      {
        method: 'POST',
        headers: hmrHeaders(),
        body: JSON.stringify({
          user_id: payload.userId,
        }),
        signal: controller.signal,
      },
    ).finally(() => clearTimeout(timeout));

    if (!response.ok) {
      const errorText = await response.text();
      return Response.json(
        {
          error: `Failed to confirm HMR backup (${response.status}): ${
            errorText || 'unexpected error'
          }`,
        },
        { status: response.status },
      );
    }

    const data = await response.json();
    return Response.json(data);
  } catch (error) {
    const message =
      error instanceof Error && error.name === 'AbortError'
        ? 'Timed out talking to the HMR Genesis service'
        : error instanceof Error
          ? error.message
          : 'Unexpected error confirming HMR backup';

    return Response.json({ error: message }, { status: 500 });
  }
}

Source: minds-ui/apps/app/app/api/hmr/[did]/backup/confirm/route.ts:21.

Response and error branches

Literal HTTP statuses in the route: 400, 500. Shared management error classes are defined in Errors and responses.

Response.json({ error: 'Missing HMR DID' }, { status: 400 })

Source: minds-ui/apps/app/app/api/hmr/[did]/backup/confirm/route.ts:28.

request.json()

Source: minds-ui/apps/app/app/api/hmr/[did]/backup/confirm/route.ts:32.

Response.json(
        { error: 'userId is required to confirm HMR backup' },
        { status: 400 },
      )

Source: minds-ui/apps/app/app/api/hmr/[did]/backup/confirm/route.ts:35.

Response.json(
        {
          error: `Failed to confirm HMR backup (${response.status}): ${
            errorText || 'unexpected error'
          }`,
        },
        { status: response.status },
      )

Source: minds-ui/apps/app/app/api/hmr/[did]/backup/confirm/route.ts:58.

response.json()

Source: minds-ui/apps/app/app/api/hmr/[did]/backup/confirm/route.ts:68.

Response.json(data)

Source: minds-ui/apps/app/app/api/hmr/[did]/backup/confirm/route.ts:69.

Response.json({ error: message }, { status: 500 })

Source: minds-ui/apps/app/app/api/hmr/[did]/backup/confirm/route.ts:78.

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/hmr/[did]/backup/confirm/route.ts. SHA-256: 050830e23ee8ac3727bec751edf0104030fa1bd73aa4eb7a142e3770bbb80fb1.

On this page