# Register a practitioner

Operation ID: `provider.register`

Create a Cognito user (role=practitioner) and a matching FHIR Practitioner resource. Unless the deployment sets AUTO_VERIFY_EMAIL=true, the account starts unverified and an email OTP is sent — call provider.verifyEmail before provider.login will treat the account as fully onboarded. When AUTO_VERIFY_EMAIL=true, the email is verified immediately and this call attempts an automatic login; on success the response also carries access_token/id_token/expires_in so the caller can skip a separate login. Accepts an extensive credentialing payload (specialty, state_licenses, education_credentials, languages_spoken, insurances_accepted, npi, address, race, ...) — see the request schema for the full accepted shape.

## Public method

`register`

Signature: `provider.register(request)`

Return type: `Promise<RegisterPractitionerResponse>`

## Authentication

Classification: **PUBLIC**

## Prerequisites

None documented.

## HTTP

`POST /auth/register`

## Path parameters

None.

## Query parameters

None.

## Body parameters

| Name | Type | Required | Format | Allowed values | Default | Nullable | Description |
|---|---|---:|---|---|---|---:|---|
| `body` | [`provider.RegisterRequest`](../models/provider.RegisterRequest.md) | No |  |  |  | Yes |  |

Request model: [`provider.RegisterRequest`](../models/provider.RegisterRequest.md)

## Request example

```json
{
  "address": {},
  "date_of_birth": "string",
  "department": "string",
  "education_credentials": [
    "string"
  ],
  "email": "user@example.com",
  "first_name": "string",
  "gender": "male",
  "insurances_accepted": [
    {
      "payer_id": "string",
      "payer_name": "string"
    }
  ],
  "languages_spoken": [
    "string"
  ],
  "last_name": "string",
  "npi": "string",
  "organization": "string",
  "password": "stringxx",
  "phone": "string",
  "race": "string",
  "specialty": [
    "string"
  ],
  "state_licenses": [
    {
      "expiration_date": "string",
      "license_number": "string",
      "state": "st"
    }
  ],
  "tenant_id": "string"
}
```

## Success responses

| Status | Shape | Content type | Description |
|---|---|---|---|
| `201` | [`provider.RegisterResponse`](../models/provider.RegisterResponse.md) | application/json | Provider registered |

## Success response examples

### 201

```json
{
  "access_token": "example-access-token",
  "cognito_sub": "00000000-0000-4000-8000-000000000000",
  "email_otp_sent": true,
  "email_verified": false,
  "expires_in": 3600,
  "fhir_practitioner_id": "practitioner-example-001",
  "id_token": "example-id-token"
}
```

## Common errors

| Status | Shape | Content type | Description |
|---|---|---|---|
| `400` | [`provider.ErrorResponse`](../models/provider.ErrorResponse.md) | application/json | Required fields are missing, invalid, or Cognito/FHIR rejected the registration |

## Error examples

### 400 — Required fields are missing

```json
{
  "error": "tenant_id, first_name, last_name, email and password are required"
}
```

### 400 — Password does not meet the minimum length

```json
{
  "error": "password must be at least 8 characters"
}
```

## NodeJS / TypeScript implementation

```ts
import { HCSDK } from "@healthcloudai/hc-sdk";
import type { RegisterPractitionerRequest } from "@healthcloudai/hc-sdk";
```

```ts
const request = {
  "address": {},
  "date_of_birth": "string",
  "department": "string",
  "education_credentials": [
    "string"
  ],
  "email": "user@example.com",
  "first_name": "string",
  "gender": "male",
  "insurances_accepted": [
    {
      "payer_id": "string",
      "payer_name": "string"
    }
  ],
  "languages_spoken": [
    "string"
  ],
  "last_name": "string",
  "npi": "string",
  "organization": "string",
  "password": "stringxx",
  "phone": "string",
  "race": "string",
  "specialty": [
    "string"
  ],
  "state_licenses": [
    {
      "expiration_date": "string",
      "license_number": "string",
      "state": "st"
    }
  ],
  "tenant_id": "string"
};

const result = await provider.register(request);
```

## cURL

```bash
curl -X POST \
  -H 'Content-Type: application/json' \
  -d '{"address":{},"date_of_birth":"string","department":"string","education_credentials":["string"],"email":"user@example.com","first_name":"string","gender":"male","insurances_accepted":[{"payer_id":"string","payer_name":"string"}],"languages_spoken":["string"],"last_name":"string","npi":"string","organization":"string","password":"stringxx","phone":"string","race":"string","specialty":["string"],"state_licenses":[{"expiration_date":"string","license_number":"string","state":"st"}],"tenant_id":"string"}' \
  'https://dev-api-provider.health.cloud/auth/register'
```

## Notes

None.

## Prepared Test Console scenario

No canonical scenario is currently associated.

## Real response

No approved real integration response is currently published. Unapproved candidates are never rendered as examples.
