# `Weavr.Consumers`
[🔗](https://github.com/iamkanishka/weavr/blob/main/lib/weavr/resources/consumers.ex#L1)

Consumer identities — individuals onboarded to the Weavr platform.

All paths and operations are verified against Weavr's published docs.
The Consumer resource mirrors the Corporate resource but represents
individuals (not companies), goes through KYC (not KYB), and has
consumers instead of companies.

On Sandbox, email verification codes are always `"123456"` and emails
are not actually sent.

The following details **cannot be updated via the API** once KYC is
complete:
- Root user name, surname, email, mobile, date of birth, nationality
Contact Weavr support to restart due diligence if changes are needed.

# `create`

```elixir
@spec create(Weavr.Config.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}
```

Creates a new Consumer identity.

`POST /consumers` — no `auth_token` required (uses `api-key` only).

Key required fields in `attrs`:
- `"profileId"` — from Multi Portal > API Credentials
- `"rootUser"` — object with `name`, `surname`, `email`, `mobile`
  (with `countryCode` and `number`), `dateOfBirth`
- `"ipAddress"` — the end-user's IP address
- `"baseCurrency"` — ISO 4217 code (e.g. `"GBP"`, `"EUR"`)

# `get`

```elixir
@spec get(Weavr.Config.t(), String.t()) :: {:ok, map()} | {:error, Weavr.Error.t()}
```

Retrieves the details of the logged-in consumer. `GET /consumers`.

# `get_kyc`

```elixir
@spec get_kyc(Weavr.Config.t(), String.t()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}
```

Returns the KYC status for the logged-in consumer. `GET /consumers/kyc`.

# `send_email_verification`

```elixir
@spec send_email_verification(Weavr.Config.t(), String.t()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}
```

Sends an email verification code to the consumer root user.

`POST /consumers/verification/email/send` — step 1 of email verification.
On Sandbox the code is always `"123456"`.

# `start_kyc`

```elixir
@spec start_kyc(Weavr.Config.t(), String.t()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}
```

Initiates the KYC due diligence process for the logged-in consumer.

`POST /consumers/kyc` — returns a `reference` to initialise the KYC UI
Component embedded in your application.

# `update`

```elixir
@spec update(Weavr.Config.t(), String.t(), map()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}
```

Updates the logged-in consumer's details. `PATCH /consumers`. KYC-locked fields are ignored after approval.

# `verify_email`

```elixir
@spec verify_email(Weavr.Config.t(), String.t(), String.t()) ::
  :ok | {:error, Weavr.Error.t()}
```

Verifies the consumer root user's email.

`POST /consumers/verification/email/verify` — step 2. On Sandbox the
code is always `"123456"`. Returns 204 No Content on success.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
