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

# Invite by Document

> Finds the account by `dni`, `type_dni` and `type`, then invites its
open onboarding: the one of `business_unit` when given, else the
oldest open one of the recipient; one is opened when none exists.
The recipient is `email` when given (it must be the primary user or
legal representative), otherwise that member. `force` resends at
most once per minute. A document other than `CHL_RUT` answers
`skipped` with `type-dni-not-supported`. Requires
`maihue-onboarding:invite` and the `portal-customer-onboarding` flag
(`403` when it is off).

`type` here is the **account type** (`person`, `company`), not the
business unit of the create body: `home` → `person`, `horeca` and
`business` → `company`; send the business unit in `business_unit`.




## OpenAPI

````yaml POST /maihue/onboarding/send-email
openapi: 3.0.1
info:
  title: Maihue Onboarding API
  description: |
    Onboardings of Maihue customers (maihue/onboarding). An onboarding asks
    one recipient (the primary user of a person account, or the legal
    representative of a company) to finish the steps of its type for one
    account and business unit: consent, identity, payment method and
    password for `customer_activation`.

    - An account may have several onboardings, but only **one open per
      business unit**: a second operator create answers
      `409 onboarding-already-open` with the open one in
      `error.metadata.onboarding`, and a drip create answers the open one
      with `onboarding.already_open: true` (the customer stays
      provisioned). A terminal status (`completed`, `expired`, `cancelled`)
      frees the slot.
    - Creating never sends anything. Inviting sends the invitation email
      through the notification core (gateway `horizon-maihue-onboarding`,
      `external_id` `<onboarding>:invitation:<n>`) and links it to the
      onboarding.
    - Statuses: `created` → `invited` → `in_progress` (magic link consumed or
      first step done) → `completed`; any open status → `expired` (hourly
      cron, when the type sets an expiry) or `cancelled`.
    - Only `CHL_RUT` accounts onboard.

    Callers authenticate with a user JWT or an API key (`x-api-key`, ADR
    0105); the key that created an onboarding is recorded on it
    (`api_key`, `created_origin: api_key`).
  version: '2026-10-21'
servers:
  - description: Production
    url: https://api.bbrands.io/api/v3
  - description: Certification
    url: https://certification.api.bbrands.io/api/v3
  - description: Development
    url: https://development.api.bbrands.io/api/v3
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Maihue Onboarding
    description: Create, list, invite and cancel onboardings.
paths:
  /maihue/onboarding/send-email:
    post:
      tags:
        - Maihue Onboarding
      summary: Invite by document (drip)
      description: |
        Finds the account by `dni`, `type_dni` and `type`, then invites its
        open onboarding: the one of `business_unit` when given, else the
        oldest open one of the recipient; one is opened when none exists.
        The recipient is `email` when given (it must be the primary user or
        legal representative), otherwise that member. `force` resends at
        most once per minute. A document other than `CHL_RUT` answers
        `skipped` with `type-dni-not-supported`. Requires
        `maihue-onboarding:invite` and the `portal-customer-onboarding` flag
        (`403` when it is off).

        `type` here is the **account type** (`person`, `company`), not the
        business unit of the create body: `home` → `person`, `horeca` and
        `business` → `company`; send the business unit in `business_unit`.
      operationId: maihueOnboardingSendEmail
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MaihueOnboardingSendEmailBody'
            examples:
              person:
                summary: Invite the home onboarding of a person
                value:
                  business_unit: home
                  dni: 12345678-5
                  type: person
                  type_dni: CHL_RUT
              company:
                summary: Invite the business onboarding of a company
                value:
                  business_unit: business
                  dni: 76543210-3
                  type: company
                  type_dni: CHL_RUT
      responses:
        '200':
          $ref: '#/components/responses/InvitationNotSent'
        '202':
          $ref: '#/components/responses/InvitationEnqueued'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/Unprocessable'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '503':
          $ref: '#/components/responses/NotEnqueued'
components:
  schemas:
    MaihueOnboardingSendEmailBody:
      type: object
      required:
        - dni
        - type
        - type_dni
      additionalProperties: false
      properties:
        dni:
          type: string
          maxLength: 50
          description: RUT of the account, with check digit.
          example: 12345678-5
        type:
          type: string
          enum:
            - company
            - person
          description: |
            Account type: `person` for a `home` customer, `company` for
            `horeca` and `business`.
        type_dni:
          type: string
          enum:
            - CHL_RUT
            - CHL_PASSPORT
          description: '`CHL_PASSPORT` answers `200 skipped` with `type-dni-not-supported`.'
        business_unit:
          type: string
          enum:
            - home
            - horeca
            - business
          description: |
            Business unit whose onboarding is invited (the `type` of the
            create body). When absent, the oldest open onboarding of the
            recipient.
        email:
          type: string
          format: email
          description: |
            Recipient. Must be the account's `primary_user` (person) or
            `legal_representative` (company), else `422
            recipient-not-linked`; that member when absent.
        force:
          type: boolean
          description: Send again even when an invitation is live; at most once per minute.
    MaihueOnboardingInviteResult:
      type: object
      properties:
        onboarding:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - enqueued
            - already_sent
            - skipped
            - failed
        notification:
          type: string
          format: uuid
          description: The notification sent (or the live one for `already_sent`).
        reason:
          type: string
          description: For `skipped`.
          enum:
            - type-dni-not-supported
            - no-eligible-recipient
            - onboarding-not-pending
            - notification-skipped
    Meta:
      type: object
      properties:
        correlation:
          type: string
          description: Request correlation id; quote it when reporting an issue.
        status:
          type: integer
        timestamp:
          type: string
          format: date-time
        version:
          type: string
          nullable: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: Machine-readable error code.
            errors:
              type: array
              items: {}
              description: |
                Details. The onboarding reasons (`account-not-found`,
                `onboarding-already-open`, `onboarding-closed`,
                `type-dni-not-supported`, `no-eligible-recipient`,
                `recipient-not-linked`, `invitation-not-enqueued`) and the
                validation messages are listed here.
            message:
              type: string
            metadata:
              type: object
              additionalProperties: true
        meta:
          $ref: '#/components/schemas/Meta'
  responses:
    InvitationNotSent:
      description: '`already_sent` or `skipped` (with `reason`)'
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/MaihueOnboardingInviteResult'
              message:
                type: string
              meta:
                $ref: '#/components/schemas/Meta'
    InvitationEnqueued:
      description: Invitation enqueued
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/MaihueOnboardingInviteResult'
              message:
                type: string
              meta:
                $ref: '#/components/schemas/Meta'
    BadRequest:
      description: Validation error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing, invalid, revoked or expired credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: The caller lacks the permission, or `portal-customer-onboarding` is off
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: '`onboarding-not-found`, `account-not-found` or a missing catalog value'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Conflict:
      description: >-
        `onboarding-already-open` (operator create, with `metadata.onboarding`)
        or `onboarding-closed`
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unprocessable:
      description: >-
        `type-dni-not-supported`, `no-eligible-recipient` or
        `recipient-not-linked`
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TooManyRequests:
      description: |
        Rate limit of the API key exceeded: a sliding window of
        `rate_limit_per_minute` requests per key (600 when the key sets
        none). Wait `Retry-After` seconds; `X-RateLimit-*` carry the budget.
      headers:
        Retry-After:
          description: Seconds until the window frees a request.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotEnqueued:
      description: >-
        `invitation-not-enqueued`: the core could not store or queue it; safe to
        retry
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: A `secret` API key, `hzk_<env>_<prefix>_<secret>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.