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

# Register

> Register a new account and user.

In multi-tenant mode (default):
- Creates a new account with the provided details
- Creates the first user as an admin

In single-tenant mode:
- Joins the pre-configured account
- Assigns 'user' role (not admin)



## OpenAPI

````yaml post /api/v1/auth/register
openapi: 3.1.0
info:
  title: SnackBase
  description: Open-source Backend-as-a-Service (BaaS)
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/auth/register:
    post:
      tags:
        - auth
      summary: Register
      description: |-
        Register a new account and user.

        In multi-tenant mode (default):
        - Creates a new account with the provided details
        - Creates the first user as an admin

        In single-tenant mode:
        - Joins the pre-configured account
        - Assigns 'user' role (not admin)
      operationId: register_api_v1_auth_register_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RegisterRequest'
        required: true
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RegistrationResponse'
        '400':
          description: Validation error
        '404':
          description: Single-tenant account not found
        '409':
          description: Conflict - email or slug already exists
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    RegisterRequest:
      properties:
        email:
          type: string
          format: email
          title: Email
          description: User's email address
        password:
          type: string
          minLength: 1
          title: Password
          description: User's password
        account_name:
          anyOf:
            - type: string
              maxLength: 255
              minLength: 1
            - type: 'null'
          title: Account Name
          description: Display name for the account (required in multi-tenant mode)
        account_slug:
          anyOf:
            - type: string
              maxLength: 32
              minLength: 3
            - type: 'null'
          title: Account Slug
          description: URL-friendly account identifier (auto-generated if not provided)
      type: object
      required:
        - email
        - password
      title: RegisterRequest
      description: Request body for account registration.
    RegistrationResponse:
      properties:
        message:
          type: string
          title: Message
          description: Success message instructing to verify email
        user:
          $ref: >-
            #/components/schemas/snackbase__infrastructure__api__schemas__auth_schemas__UserResponse
          description: User information
        account:
          $ref: '#/components/schemas/AccountResponse'
          description: Account information
      type: object
      required:
        - message
        - user
        - account
      title: RegistrationResponse
      description: Response for successful registration (verification required).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    snackbase__infrastructure__api__schemas__auth_schemas__UserResponse:
      properties:
        id:
          type: string
          title: Id
          description: User ID
        email:
          type: string
          title: Email
          description: User's email address
        role:
          type: string
          title: Role
          description: User's role name
        is_active:
          type: boolean
          title: Is Active
          description: Whether the user is active
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the user was created
      type: object
      required:
        - id
        - email
        - role
        - is_active
        - created_at
      title: UserResponse
      description: User information in auth responses.
    AccountResponse:
      properties:
        id:
          type: string
          title: Id
          description: Account ID in XX#### format
        slug:
          type: string
          title: Slug
          description: URL-friendly account identifier
        name:
          type: string
          title: Name
          description: Display name for the account
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the account was created
      type: object
      required:
        - id
        - slug
        - name
        - created_at
      title: AccountResponse
      description: Account information in auth responses.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````