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

# Accept client portal invitation

> Accept a client portal invitation by creating a new user account or adding client access to an existing account. Returns a session for immediate login.



## OpenAPI

````yaml /api-reference/cx/swagger.json post /cp/user/_accept
openapi: 3.0.0
info:
  description: CX API.
  title: CX API
  contact:
    name: API Support
    url: https://stax.ai
    email: support@stax.ai
  version: '1.0'
servers:
  - url: https://api.cx.stax.ai
security: []
paths:
  /cp/user/_accept:
    post:
      tags:
        - client-portal
      summary: Accept client portal invitation
      description: >-
        Accept a client portal invitation by creating a new user account or
        adding client access to an existing account. Returns a session for
        immediate login.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pkg_routes_cp_user.AcceptInviteRequest'
        description: Accept invitation request (invite, client, password required)
        required: true
      responses:
        '200':
          description: Session data for authenticated user
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/types.Session'
        '400':
          description: >-
            Bad request - invalid invitation token, client ID, or user already
            has access
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '401':
          description: Unauthorized - incorrect password for existing account
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    pkg_routes_cp_user.AcceptInviteRequest:
      type: object
      properties:
        client:
          type: string
        invite:
          type: string
        password:
          type: string
        token:
          type: string
    types.Session:
      type: object
      properties:
        _id:
          type: string
        active:
          type: boolean
        amr:
          description: >-
            AMR is the set of authentication method references completed this
            session.
          type: array
          items:
            $ref: '#/components/schemas/types.AuthMethod'
        automation:
          description: >-
            Used to track if the session is for an automation (e.g. API key) or
            a user
          type: boolean
        client:
          $ref: '#/components/schemas/types.ClientAccess'
        created_on:
          type: string
        exchanged:
          description: >-
            If the session ID is exchanged for a token, we need to set it here
            so it's not exchanged again
          type: boolean
        expires_on:
          type: string
        ip:
          type: string
        mechanism:
          type: string
        otp:
          description: >-
            If 2FA is required, an OTP is generated and sent to the user

            As long as the OTP exists here, the session is NOT valid. When the
            user enters the OTP, it gets cleared from the session and the
            session becomes valid.
          type: string
        refreshOn:
          description: >-
            The session needs to automatically refresh itself every 5 minutes to
            keep the data from going stale.
          type: string
        team:
          $ref: '#/components/schemas/types.Team'
        token:
          type: string
        type:
          description: 'Session type: Normal | Delegate | Desktop'
          type: string
        updatedOn:
          description: >-
            Used to track if the session data is stale. The client passes a
            `x-session-update` header which must be before or at the update
            time.

            If not, the session is refreshed
          type: string
        user:
          $ref: '#/components/schemas/types.User'
        user_agent:
          type: string
    types.AuthMethod:
      type: string
      enum:
        - pwd
        - email_link
        - sms
        - mfa
        - otp
        - sso
      x-enum-comments:
        AuthMethodOTP: location email code
        AuthMethodSMS: portal SMS login code
        AuthMethodSSO: reserved until IdP ships
      x-enum-descriptions:
        - ''
        - ''
        - portal SMS login code
        - ''
        - location email code
        - reserved until IdP ships
      x-enum-varnames:
        - AuthMethodPassword
        - AuthMethodEmailLink
        - AuthMethodSMS
        - AuthMethodMFA
        - AuthMethodOTP
        - AuthMethodSSO
    types.ClientAccess:
      type: object
      properties:
        accepted_on:
          type: string
        client:
          type: string
        contact:
          type: string
        invited_on:
          type: string
        scopes:
          type: array
          items:
            type: string
        team:
          type: string
    types.Team:
      type: object
      properties:
        _id:
          type: string
        about:
          type: string
        address:
          $ref: '#/components/schemas/types.Address'
        alert_contacts:
          type: array
          items:
            $ref: '#/components/schemas/types.TeamTPAContact'
        api_key:
          type: string
        brand:
          $ref: '#/components/schemas/types.BrandConfig'
        client_billing:
          $ref: '#/components/schemas/types.TeamClientBillingSettings'
        client_directory:
          type: string
        client_directory_template:
          type: string
        client_invite_follow_up:
          $ref: '#/components/schemas/types.ClientFollowUpConfig'
        client_roles:
          type: array
          items:
            $ref: '#/components/schemas/types.Role'
        client_task_follow_up:
          $ref: '#/components/schemas/types.ClientFollowUpConfig'
        created_on:
          type: string
        default_send_role:
          type: string
        deleted_at:
          type: string
        ein:
          type: string
        email:
          type: string
        fallback_email:
          type: string
        fax_number:
          type: string
        is_disabled:
          type: boolean
        legal_name:
          type: string
        limits:
          $ref: '#/components/schemas/types.UsageLimits'
        login:
          type: string
        name:
          type: string
        ooo_reassign:
          type: boolean
        page:
          type: string
        past_due_date:
          description: >-
            PastDueDate marks the account billing-past-due (ENG-8475). See
            legacytypes.Team.
          type: string
        phone:
          type: string
        plan_tier:
          description: |-
            Plan Tiers
             - TPA: Charged by active plan sponsor + active additional plan [Default value if not set]
             - Free: Meant for collaborators - only have access to files, companies, plans, and participants
             - Pro: Full access - charged by user count, no payroll or client portal
             - Enterprise: Full access - custom contract for collaborators
          type: string
        plan_year_questionnaires:
          type: array
          items:
            type: string
        primary_contact:
          $ref: '#/components/schemas/types.TeamTPAContact'
        priority_weights:
          $ref: '#/components/schemas/types.PriorityWeights'
        recordkeeper_fees_config:
          $ref: '#/components/schemas/types.TeamRecordkeeperFeesConfig'
        retirement:
          $ref: '#/components/schemas/types.RetirementConfig'
        scopes:
          type: array
          items:
            type: string
        security_config:
          $ref: '#/components/schemas/types.TeamSecurityConfig'
        share_directory_template:
          type: string
        sla:
          type: integer
        smtp:
          $ref: '#/components/schemas/types.SMTPConfiguration'
        stripe:
          $ref: '#/components/schemas/types.StripeConfig'
        website:
          type: string
        working_hours:
          description: Queue routing team settings
          allOf:
            - $ref: '#/components/schemas/types.WorkingHoursConfig'
    types.User:
      type: object
      properties:
        _id:
          type: string
        clients:
          type: array
          items:
            $ref: '#/components/schemas/types.ClientAccess'
        community:
          description: Community role (eg. "Moderator")
          type: string
        created_on:
          type: string
        deleted_at:
          type: string
        email:
          type: string
        memberships:
          type: array
          items:
            $ref: '#/components/schemas/types.Membership'
        mfa_enabled:
          description: Is MFA enabled?
          type: boolean
        mfa_secret:
          description: The secret for MFA TOTP
          type: string
        mfa_verified_at:
          type: string
        name:
          type: string
        out_of_office:
          description: Availability for queue routing (user-level, not per-team)
          type: array
          items:
            $ref: '#/components/schemas/types.OOOWindow'
        password:
          type: string
        phone:
          type: string
        signature:
          type: string
        team:
          description: The team the user is logged in to
          type: string
        timezone:
          type: string
        validation_code:
          description: The validation code for the user
          type: string
    types.Address:
      type: object
      properties:
        attn:
          type: string
        city:
          type: string
        country:
          type: string
        desc:
          type: string
        state:
          type: string
        street:
          type: string
        street2:
          type: string
        unit:
          type: string
        zip:
          type: string
    types.TeamTPAContact:
      type: object
      properties:
        email:
          type: string
        first_name:
          type: string
        last_name:
          type: string
        phone:
          type: string
        user_id:
          type: string
    types.BrandConfig:
      type: object
      properties:
        color:
          type: string
        display:
          type: string
        domain:
          type: string
        edges:
          type: string
        logo:
          type: string
        wallpaper:
          type: string
    types.TeamClientBillingSettings:
      type: object
      properties:
        approval_location:
          type: string
        billing_contact_role:
          type: string
        default_currency:
          type: string
        default_invoice_grouping:
          type: string
        default_proration:
          type: string
        default_terms_days:
          type: integer
        export_schedule:
          type: string
        export_trigger:
          type: string
        plan_dimension:
          description: none | class | sub_customer; empty means none
          type: string
        revision:
          type: integer
        two_person_approval:
          type: boolean
    types.ClientFollowUpConfig:
      type: object
      properties:
        excluded_client_statuses:
          description: >-
            ExcludedClientStatuses is the per-reminder-type Client Status
            Controls

            list (ENG-8573). Clients whose status is in this list do not receive

            automated reminders of this type. Empty means no status is excluded.
          type: array
          items:
            type: string
        follow_up_enabled:
          type: boolean
        message:
          type: string
        send_from:
          description: >-
            Standardized sender/recipient keys (reminders redesign). When unset,
            sender

            fields fall back to the account-wide Team.DefaultSendRole /
            Team.FallbackEmail.
          type: string
        send_from_fallback:
          description: Sender fallback email address
          type: string
        send_interval_after_due:
          type: integer
        send_interval_before_due:
          type: integer
        send_to:
          description: Contact/External recipient roles
          type: array
          items:
            type: string
        send_to_fallback:
          description: Recipient fallback email when no contact holds a SendTo role
          type: string
        send_until:
          type: integer
    types.Role:
      type: object
      properties:
        name:
          type: string
        required:
          type: boolean
        type:
          description: contact, assignee, external
          type: string
    types.UsageLimits:
      type: object
      properties:
        base_storage:
          type: integer
        dashboard_users:
          type: integer
        max_users:
          type: integer
        usage:
          type: integer
    types.PriorityWeights:
      type: object
      properties:
        high:
          type: integer
        normal:
          type: integer
        urgent:
          type: integer
    types.TeamRecordkeeperFeesConfig:
      type: object
      properties:
        ongoing:
          $ref: '#/components/schemas/types.TeamOngoingTPAFees'
        transactional:
          $ref: '#/components/schemas/types.TeamTransactionalTPAFees'
    types.RetirementConfig:
      type: object
      properties:
        address_requirement:
          type: boolean
        census_collection_columns:
          type: array
          items:
            $ref: '#/components/schemas/sharedtypes.CensusColumnKey'
        collect_eligible_compensation:
          type: boolean
        collect_statutory_compensation:
          type: boolean
        email_requirement:
          type: boolean
        hours_assumption:
          type: boolean
        mep_pep_visibility:
          type: boolean
        phone_requirement:
          type: boolean
    types.TeamSecurityConfig:
      type: object
      properties:
        advisor_mfa:
          $ref: '#/components/schemas/types.MFAPolicy'
        allow_magic_link:
          type: boolean
        allow_password:
          type: boolean
        portal_login:
          $ref: '#/components/schemas/types.PortalLoginConfig'
        portal_mfa:
          $ref: '#/components/schemas/types.MFAPolicy'
        require_sso:
          description: home-org SSO enforcement (IdP stub until later)
          type: boolean
    types.SMTPConfiguration:
      type: object
      properties:
        auth_method:
          $ref: '#/components/schemas/mail.SMTPAuthType'
        enabled:
          type: boolean
        host:
          type: string
        password:
          type: string
        port:
          type: integer
        require_tls:
          type: boolean
        username:
          type: string
    types.StripeConfig:
      type: object
      properties:
        customer_id:
          type: string
        subscription_id:
          type: string
        subscription_items:
          type: object
          additionalProperties:
            type: string
    types.WorkingHoursConfig:
      type: object
      properties:
        schedule:
          type: array
          items:
            $ref: '#/components/schemas/types.WorkingHoursSchedule'
        timezone:
          type: string
        use_user_timezone:
          type: boolean
    types.Membership:
      type: object
      properties:
        about:
          type: string
        accepted_on:
          type: string
        api_keys:
          type: array
          items:
            $ref: '#/components/schemas/types.APIKey'
        email:
          $ref: '#/components/schemas/types.EmailConfig'
        email_signature:
          type: string
        filters:
          $ref: '#/components/schemas/types.Filters'
        invited_on:
          type: string
        preferences:
          $ref: '#/components/schemas/types.Preferences'
        scopes:
          type: array
          items:
            type: string
        starred_pages:
          type: array
          items:
            type: string
        suspended:
          type: boolean
        team:
          type: string
        title:
          type: string
        working_hours:
          description: Per-team working hours override for queue routing capacity
          allOf:
            - $ref: '#/components/schemas/types.WorkingHoursConfig'
    types.OOOWindow:
      type: object
      properties:
        end:
          type: string
        note:
          type: string
        start:
          type: string
    types.TeamOngoingTPAFees:
      type: object
      properties:
        annual_amount:
          description: AnnualAmount is the annual dollar amount for flat fee methods.
          type: number
          minimum: 0
        basis_points_annual:
          description: >-
            BasisPointsAnnual is the annual rate in whole basis points (e.g. 50
            = 0.50%).
          type: integer
          minimum: 0
        enabled:
          type: boolean
        method:
          description: Method is one of the OngoingFee* constants when Enabled is true.
          type: string
          enum:
            - basis_points
            - flat_plan_pro_rata
            - flat_plan_per_capita
            - flat_per_participant
    types.TeamTransactionalTPAFees:
      type: object
      properties:
        distribution_fee:
          type: number
          minimum: 0
        enabled:
          type: boolean
        loan_initiation_fee:
          type: number
          minimum: 0
        loan_maintenance_fee:
          type: number
          minimum: 0
        loan_maintenance_quarter:
          type: string
          enum:
            - Q1
            - Q2
            - Q3
            - Q4
    sharedtypes.CensusColumnKey:
      type: string
      enum:
        - first_name
        - last_name
        - ssn
        - birth_date
        - hire_date
        - terminated
        - termination_date
        - termination_reason
        - rehire_date
        - hours_worked
        - employment_type
        - employee_category
        - gross_compensation
        - statutory_compensation
        - gross_minus_exclusions
        - hpi_compensation
        - new_compensation_group
        - prevailing_wage
        - compensation_from_entry
        - pre_tax_deferral
        - roth_deferral
        - match_contribution
        - safe_harbor_match
        - qaca_match
        - safe_harbor_non_elective
        - profit_sharing
        - division_code
        - ct_group_code
      x-enum-varnames:
        - CensusColumnFirstName
        - CensusColumnLastName
        - CensusColumnSSN
        - CensusColumnBirthDate
        - CensusColumnHireDate
        - CensusColumnTerminated
        - CensusColumnTerminationDate
        - CensusColumnTerminationReason
        - CensusColumnRehireDate
        - CensusColumnHoursWorked
        - CensusColumnEmploymentType
        - CensusColumnEmployeeCategory
        - CensusColumnGrossCompensation
        - CensusColumnStatutoryCompensation
        - CensusColumnGrossMinusExclusions
        - CensusColumnHPICompensation
        - CensusColumnNewCompensationGroup
        - CensusColumnPrevailingWage
        - CensusColumnCompensationFromEntry
        - CensusColumnPreTaxDeferral
        - CensusColumnRothDeferral
        - CensusColumnMatchContribution
        - CensusColumnSafeHarborMatch
        - CensusColumnQACAMatch
        - CensusColumnSafeHarborNonElective
        - CensusColumnProfitSharing
        - CensusColumnDivisionCode
        - CensusColumnCTGroupCode
    types.MFAPolicy:
      type: object
      properties:
        grace_days:
          type: integer
        required:
          type: boolean
        required_since:
          type: string
    types.PortalLoginConfig:
      type: object
      properties:
        email:
          $ref: '#/components/schemas/types.PortalEmailLogin'
        sms:
          $ref: '#/components/schemas/types.PortalSMSLogin'
    mail.SMTPAuthType:
      type: string
      enum:
        - CRAM-MD5
        - CUSTOM
        - LOGIN
        - LOGIN-NOENC
        - NOAUTH
        - PLAIN
        - PLAIN-NOENC
        - XOAUTH2
        - SCRAM-SHA-1
        - SCRAM-SHA-1-PLUS
        - SCRAM-SHA-256
        - SCRAM-SHA-256-PLUS
        - AUTODISCOVER
      x-enum-varnames:
        - SMTPAuthCramMD5
        - SMTPAuthCustom
        - SMTPAuthLogin
        - SMTPAuthLoginNoEnc
        - SMTPAuthNoAuth
        - SMTPAuthPlain
        - SMTPAuthPlainNoEnc
        - SMTPAuthXOAUTH2
        - SMTPAuthSCRAMSHA1
        - SMTPAuthSCRAMSHA1PLUS
        - SMTPAuthSCRAMSHA256
        - SMTPAuthSCRAMSHA256PLUS
        - SMTPAuthAutoDiscover
    types.WorkingHoursSchedule:
      type: object
      properties:
        end_time:
          type: string
        start_time:
          type: string
        weekday:
          type: string
    types.APIKey:
      type: object
      properties:
        created_by:
          type: string
        created_on:
          type: string
        name:
          type: string
        secret:
          type: string
    types.EmailConfig:
      type: object
      properties:
        access_token:
          description: >-
            AccessToken/RefreshToken are the legacy provider OAuth tokens. Kept
            dormant

            during the Nylas migration for rollback safety — Nylas owns token
            refresh

            once a grant exists, so these are not written for Backend == "nylas"
            accounts.
          type: string
        address:
          type: string
        auto_reply:
          type: boolean
        auto_reply_body:
          type: string
        auto_reply_from:
          type: string
        auto_reply_subject:
          type: string
        auto_reply_to:
          type: string
        backend:
          type: string
        connected_at:
          type: string
        error:
          type: string
        errored_at:
          type: string
        grant_id:
          description: >-
            Nylas migration fields. GrantID is the Nylas grant scoping all
            per-account

            API calls; GrantStatus mirrors the Nylas grant state
            (valid|invalid|expired);

            Backend == "nylas" is the per-account switch every send/sync code
            path checks.
          type: string
        grant_status:
          type: string
        last_sync:
          type: string
        private:
          type: boolean
        provider:
          type: string
        refresh_token:
          type: string
        status:
          type: string
        sync_mutex:
          type: boolean
    types.Filters:
      type: object
      properties:
        client:
          type: object
          additionalProperties: true
        message:
          type: object
          additionalProperties: true
        plan:
          type: object
          additionalProperties: true
        project:
          type: object
          additionalProperties: true
        task:
          type: object
          additionalProperties: true
    types.Preferences:
      type: object
      properties:
        email_on_assignments:
          type: boolean
        email_on_assists:
          type: boolean
        email_on_client_actions:
          type: boolean
        email_on_client_updates:
          type: boolean
        email_on_community:
          type: boolean
        email_on_mentions:
          type: boolean
        email_on_overdue:
          type: boolean
        email_on_shared_files:
          type: boolean
    types.PortalEmailLogin:
      type: object
      properties:
        enabled:
          type: boolean
        from_email:
          description: empty = Stax default
          type: string
    types.PortalSMSLogin:
      type: object
      properties:
        enabled:
          type: boolean
        phone_number:
          description: nil = Stax default
          type: string
  securitySchemes:
    ApiKeyAuth:
      description: CX API key. Create one in CX under Settings → Advanced → API Keys.
      in: header
      name: x-api-key
      type: apiKey

````

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