> ## 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.

# Accept Invitation

> Accept an invitation and create a user account.

Validates the invitation token, creates a user account with the provided
password, and returns authentication tokens.

Flow:
1. Validate token exists
2. Validate token not expired
3. Validate token not already accepted
4. Validate password strength
5. Create user account
6. Mark invitation as accepted
7. Generate JWT tokens
8. Return auth response



## OpenAPI

````yaml post /api/v1/invitations/{token}/accept
openapi: 3.1.0
info:
  title: SnackBase
  description: Open-source Backend-as-a-Service (BaaS)
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/invitations/{token}/accept:
    post:
      tags:
        - invitations
      summary: Accept Invitation
      description: |-
        Accept an invitation and create a user account.

        Validates the invitation token, creates a user account with the provided
        password, and returns authentication tokens.

        Flow:
        1. Validate token exists
        2. Validate token not expired
        3. Validate token not already accepted
        4. Validate password strength
        5. Create user account
        6. Mark invitation as accepted
        7. Generate JWT tokens
        8. Return auth response
      operationId: accept_invitation_api_v1_invitations__token__accept_post
      parameters:
        - name: token
          in: path
          required: true
          schema:
            type: string
            title: Token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvitationAcceptRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthResponse'
        '400':
          description: Validation error
        '404':
          description: Invalid, expired, or already accepted token
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    InvitationAcceptRequest:
      properties:
        password:
          type: string
          minLength: 8
          title: Password
          description: Password for the new user account
      type: object
      required:
        - password
      title: InvitationAcceptRequest
      description: Request schema for accepting an invitation.
    AuthResponse:
      properties:
        token:
          type: string
          title: Token
          description: JWT access token
        refresh_token:
          type: string
          title: Refresh Token
          description: JWT refresh token
        expires_in:
          type: integer
          title: Expires In
          description: Access token expiration time in seconds
        account:
          $ref: '#/components/schemas/AccountResponse'
          description: Account information
        user:
          $ref: >-
            #/components/schemas/snackbase__infrastructure__api__schemas__auth_schemas__UserResponse
          description: User information
      type: object
      required:
        - token
        - refresh_token
        - expires_in
        - account
        - user
      title: AuthResponse
      description: Response for successful authentication (login).
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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.
    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.
    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

````