> ## Documentation Index
> Fetch the complete documentation index at: https://docs.glider.fi/llms.txt
> Use this file to discover all available pages before exploring further.

# Admin Tenant Registration Requests

> Internal-only endpoints for reviewing console self-service registration requests

These endpoints let authorized operators review self-service registration
requests submitted on the console login page, approve or reject them, and
resend the verification email.

Approving a request creates the tenant **without** an API key and with an
unverified email; the requester receives an email whose verification link must
be clicked before they can sign in and create their own keys in the console.

## Auth

All routes are protected by the platform admin token:

* `Authorization: Bearer <admin-token>`
* `Content-Type: application/json`

## List Requests

`GET /v1/admin/tenant-requests?status=pending&limit=50&offset=0`

`status` is optional (`pending`, `approved`, `rejected`); `limit` defaults to
50 (max 200), `offset` to 0. Results are ordered newest first.

Response:

```json theme={null}
{
  "success": true,
  "data": {
    "requests": [
      {
        "id": 1,
        "email": "founder@acme.example",
        "organizationName": "Acme",
        "note": "Building a robo-advisor",
        "status": "pending",
        "ipAddress": "203.0.113.7",
        "userAgent": "Mozilla/5.0 ...",
        "createdAt": "2026-08-04T12:00:00.000Z",
        "decidedAt": null,
        "decidedBy": null,
        "tenantId": null,
        "emailVerifiedAt": null,
        "verificationTokenExpiresAt": null
      }
    ]
  }
}
```

## Approve Request

`POST /v1/admin/tenant-requests/:id/approve`

Creates the tenant (no API key, email unverified), links it to the request, and
sends the approval email with a 7-day verification link. `decidedBy` is
required and recorded as the decision audit trail.

```json theme={null}
{
  "decidedBy": "ops@glider.fi"
}
```

Response:

```json theme={null}
{
  "success": true,
  "data": {
    "request": { "id": 1, "status": "approved", "tenantId": "tenant_id" },
    "tenant": {
      "id": "tenant_id",
      "email": "founder@acme.example",
      "name": "Acme"
    },
    "successEmailSent": true
  }
}
```

`successEmailSent: false` means the tenant was created but the email failed —
use resend-verification below.

## Reject Request

`POST /v1/admin/tenant-requests/:id/reject`

Marks the request rejected. No email is sent to the requester.

```json theme={null}
{
  "decidedBy": "ops@glider.fi"
}
```

Response:

```json theme={null}
{
  "success": true,
  "data": {
    "request": { "id": 1, "status": "rejected", "decidedBy": "ops@glider.fi" }
  }
}
```

## Resend Verification

`POST /v1/admin/tenant-requests/:id/resend-verification`

Regenerates the verification token (new 7-day expiry) and resends the approval
email. Only valid for approved requests. No body.

Response:

```json theme={null}
{
  "success": true,
  "data": { "successEmailSent": true }
}
```

## Errors

* `404`: request id was not found
* `400`: request was already decided (approve/reject), or is not approved
  (resend-verification)
* `401`: missing or invalid token
