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

# Create Profile

> Create a new patient profile and assign it to a profile group

Create a new patient profile and assign it to a profile group. The profile holds demographic data used across appointments and lab orders.

## Request

### Body parameters

<ParamField body="first_name" type="string" required>
  First name of the patient. Must use latin characters, between 1 and 100 characters.
</ParamField>

<ParamField body="last_name" type="string">
  Last name of the patient. Must use latin characters, between 1 and 100 characters.
</ParamField>

<ParamField body="sex" type="integer" required>
  Biological sex per ISO/IEC 5218. Use `0` for unknown, `1` for male, `2` for female.
</ParamField>

<ParamField body="date_of_birth" type="string" required>
  Date of birth in `YYYY-MM-DD` format. Must be a date in the past.
</ParamField>

<ParamField body="profile_group" type="string" required>
  Polymorphic reference (UUID or slug) to the profile group to assign this profile to. The UUID is
  the immutable identifier and survives slug renames; the slug remains accepted for marketing and
  partner integrations built on readable identifiers. UUID is preferred. The profile group must be
  within your API key's access context.
</ParamField>

<ParamField body="email" type="string">
  Email address for the profile. If omitted, Aniva auto-generates an email address.
</ParamField>

<ParamField body="phone" type="string">
  Phone number in E.164 format (e.g., `+14155552671`).
</ParamField>

<ParamField body="height" type="number">
  Height in centimeters.
</ParamField>

<ParamField body="weight" type="number">
  Weight in kilograms.
</ParamField>

<ParamField body="language" type="string" default="en">
  Preferred language for the profile. Accepted values: `en`, `de`, `fi`. Defaults to `en`.
</ParamField>

<ParamField body="transactional_emails_enabled" type="boolean">
  Whether this profile should receive transactional (programmatic) emails — appointment
  confirmations, result-ready notices, etc. Overrides the profile group default. Distinct from
  marketing opt-in. Omit to use the default.
</ParamField>

<ParamField body="marketing_emails_enabled" type="boolean">
  Whether this profile opts in to marketing emails (newsletters, product updates). Overrides the
  profile group default. Distinct from transactional emails. Omit to use the profile group default.
  Write-only: not returned in the profile response.
</ParamField>

## Response

On success, the API returns `201 Created` with the newly created profile.

<ResponseField name="id" type="string" required>
  Unique profile identifier (UUID).
</ResponseField>

<ResponseField name="handle" type="string">
  Profile handle or username. May be `null`.
</ResponseField>

<ResponseField name="first_name" type="string">
  First name. May be `null`.
</ResponseField>

<ResponseField name="last_name" type="string">
  Last name. May be `null`.
</ResponseField>

<ResponseField name="email" type="string">
  Email address. May be `null`.
</ResponseField>

<ResponseField name="phone" type="string">
  Phone number in E.164 format. May be `null`.
</ResponseField>

<ResponseField name="sex" type="integer">
  Biological sex per ISO/IEC 5218 (`0` = unknown, `1` = male, `2` = female). May be `null`.
</ResponseField>

<ResponseField name="date_of_birth" type="string">
  Date of birth in `YYYY-MM-DD` format. May be `null`.
</ResponseField>

<ResponseField name="height" type="number">
  Height in centimeters. May be `null`.
</ResponseField>

<ResponseField name="weight" type="number">
  Weight in kilograms. May be `null`.
</ResponseField>

<ResponseField name="language" type="string">
  Preferred language (`en`, `de`, or `fi`).
</ResponseField>

<ResponseField name="transactional_emails_enabled" type="boolean">
  Whether this profile receives transactional (programmatic) emails. `null` when never set.
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp of when the profile was created.
</ResponseField>

<ResponseField name="updated_at" type="string">
  ISO 8601 timestamp of the last update. `null` for newly-created profiles.
</ResponseField>

## Error responses

| Status | Description                                                                                                          |
| ------ | -------------------------------------------------------------------------------------------------------------------- |
| `400`  | Validation error — one or more fields failed validation.                                                             |
| `403`  | Forbidden — your API key does not have access to this operation or the profile group is outside your access context. |
| `404`  | Profile group not found.                                                                                             |
| `500`  | Internal server error.                                                                                               |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://anivahealth.com/api/v1/profiles \
    --header 'x-api-key: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "first_name": "Maria",
      "last_name": "Schmidt",
      "sex": 2,
      "date_of_birth": "1985-03-22",
      "profile_group": "acme-clinic-berlin",
      "email": "maria.schmidt@example.com",
      "phone": "+4930123456789",
      "height": 168,
      "weight": 65,
      "language": "de",
      "transactional_emails_enabled": true,
      "marketing_emails_enabled": false
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 201 theme={null}
  {
    "id": "a3f1c2d4-8b7e-4f2a-9c1d-2e3f4a5b6c7d",
    "handle": null,
    "first_name": "Maria",
    "last_name": "Schmidt",
    "email": "maria.schmidt@example.com",
    "phone": "+4930123456789",
    "sex": 2,
    "date_of_birth": "1985-03-22",
    "height": 168,
    "weight": 65,
    "language": "de",
    "transactional_emails_enabled": true,
    "created_at": "2026-04-01T09:14:32Z",
    "updated_at": null
  }
  ```

  ```json 400 theme={null}
  {
    "error": "date_of_birth must be a date in the past"
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Profile group not found"
  }
  ```
</ResponseExample>
