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

# Invite a user by email

> Creates a pending invitation for an email address. Omit organization_id to invite the user as the founder of a new organization that is created on their first sign-in; provide it to invite them into an existing organization. The invitation is redeemed automatically the first time the invitee signs in with that email.




## OpenAPI

````yaml /openapi/openapi.yaml post /invites
openapi: 3.0.3
info:
  title: Albus API
  description: Albus service REST API
  version: 1.0.0
servers:
  - url: https://albus.sh/api
    description: Production server
  - url: http://localhost:8080
    description: Local development server
security:
  - bearerAuth: []
  - apiKeyAuth: []
tags:
  - name: Auth
    description: Identify the authenticated user.
  - name: Health
    description: Check service availability.
  - name: Secrets
    description: Manage secrets available to agent sessions.
  - name: Sessions
    description: Run and inspect agent sessions.
  - name: Tokens
    description: Manage organization API keys.
paths:
  /invites:
    post:
      tags:
        - Invites
      summary: Invite a user by email
      description: >
        Creates a pending invitation for an email address. Omit organization_id
        to invite the user as the founder of a new organization that is created
        on their first sign-in; provide it to invite them into an existing
        organization. The invitation is redeemed automatically the first time
        the invitee signs in with that email.
      operationId: createInvite
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateInviteRequest'
      responses:
        '200':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Invite'
        '400':
          description: Bad request (invalid email or role)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrBadRequest'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrUnauthorized'
        '409':
          description: An invitation for this email already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrConflict'
      security:
        - bearerAuth: []
components:
  schemas:
    CreateInviteRequest:
      type: object
      required:
        - email
      properties:
        email:
          type: string
          format: email
          description: Email address of the person to invite.
        role:
          type: string
          enum:
            - admin
            - member
          description: >
            Role to grant the invitee. Defaults to admin when inviting to a new
            organization and member when inviting into an existing one.
        organization_id:
          type: string
          description: >
            Organization to invite the user into (e.g. "42"). Omit to create a
            new organization for the user on their first sign-in.
    Invite:
      type: object
      required:
        - id
        - email
        - role
      properties:
        id:
          type: string
          description: Invitation identifier
        email:
          type: string
          description: Invited email address
        role:
          type: string
          description: Role the invitee will be granted
        organization_id:
          type: string
          description: >
            Organization the invitee will join. Absent when the invitation
            creates a new organization on first sign-in.
    ErrBadRequest:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable error message
          example: Invalid request parameters
    ErrUnauthorized:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable error message
          example: Invalid or expired token
    ErrConflict:
      type: object
      required:
        - message
      properties:
        message:
          type: string
          description: Human-readable error message
          example: Idempotency key reused with a different request body
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    apiKeyAuth:
      type: http
      scheme: bearer
      description: Org-scoped API key issued via POST /tokens

````