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

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

Source: https://docs.minds.sh/docs/api/platform/reference/dashboard--api-hmr-did-backup-confirm



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                        | POST                                                                           |
| Path                           | `/api/hmr/[did]/backup/confirm`                                                |
| Path parameters                | `did`                                                                          |
| 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]

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 [#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 [#confirmpayload]

```typescript
type ConfirmPayload = {
  userId: string;
};
```

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

## 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.

### POST [#post]

```typescript
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 [#response-and-error-branches]

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

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

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

```typescript
request.json()
```

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

```typescript
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`.

```typescript
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`.

```typescript
response.json()
```

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

```typescript
Response.json(data)
```

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

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

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

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