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

# Exchange a magic link token for a session

> Consumes the one-time portal redirect (magic link) token emailed during bot signup and returns an API session. The token is a UUIDv7 that encodes its creation time; it expires after a configurable validity window (15 minutes by default) and is cleared on first use. Although the action creates a session, the route uses the GET verb because it is opened from an email link. On first use the account is also initialized. For bot signup (freemium) accounts the response is a minimal envelope containing only the `api_v2_token`; accounts that are permitted to use magic links but are not freemium accounts may instead receive an extended session payload when additional steps (such as two-factor authentication or identity verification) are required. This endpoint is public; the magic link token in the query string is the credential.



## OpenAPI

````yaml /openapi/source/external/signup/bot-signup.json get /v2/bot_sessions
openapi: 3.0.0
info:
  version: 1.0.0
  title: Bot Signup API
  contact:
    email: mission.control.squad@telnyx.com
servers:
  - url: https://api.telnyx.com
security: []
tags:
  - name: Bot Signup
    description: >-
      Agentic (bot) signup for Telnyx accounts. An AI agent solves a
      reverse-CAPTCHA challenge designed to be easy for LLMs and hard for
      humans, registers an account, and signs in by consuming a magic link
      emailed to the account owner. All endpoints are public and
      unauthenticated; signup endpoints are additionally gated by the freemium
      feature flags and per-country availability.
paths:
  /v2/bot_sessions:
    get:
      tags:
        - Bot Signup
      summary: Exchange a magic link token for a session
      description: >-
        Consumes the one-time portal redirect (magic link) token emailed during
        bot signup and returns an API session. The token is a UUIDv7 that
        encodes its creation time; it expires after a configurable validity
        window (15 minutes by default) and is cleared on first use. Although the
        action creates a session, the route uses the GET verb because it is
        opened from an email link. On first use the account is also initialized.
        For bot signup (freemium) accounts the response is a minimal envelope
        containing only the `api_v2_token`; accounts that are permitted to use
        magic links but are not freemium accounts may instead receive an
        extended session payload when additional steps (such as two-factor
        authentication or identity verification) are required. This endpoint is
        public; the magic link token in the query string is the credential.
      operationId: createBotSession
      parameters:
        - name: email
          in: query
          required: true
          description: Email address associated with the magic link token.
          schema:
            type: string
            format: email
            example: agent-owner@example.com
        - name: portal_redirect_token
          in: query
          required: true
          description: >-
            Single-use portal redirect (magic link) token, a UUIDv7 sent to the
            account owner's email.
          schema:
            type: string
            format: uuid
            example: 01890a7e-e2f7-7c3d-8dbb-9a2c5f3d1e0b
      responses:
        '200':
          description: >-
            Session created. Bot signup accounts receive a minimal token
            envelope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BotSessionResponse'
              example:
                data:
                  api_v2_token: KEY0189A1B2C3D4E5F6071829AB3C4D5E_5FhZonmFvcw8Yq0dME27Bg
        '400':
          description: The account could not be initialized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errors:
                  - detail: Account could not be initialized
        '401':
          description: >-
            Missing or invalid email or token, expired token, or the account is
            not eligible to sign in (inactive, suspended, not permitted to use
            magic links, or must use SSO).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errors:
                  - detail: >-
                      Your sign-in link has expired. Please request a new
                      one-time sign-in link.
        '403':
          description: >-
            Request blocked by security policy (for example, the caller's
            country is not accepted).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errors:
                  - detail: >-
                      Your registration cannot be accepted as it does not comply
                      with our security standards. You may contact support for
                      assistance.
        '404':
          description: >-
            Bot signup is not available (freemium master switch disabled or the
            caller's country is not enabled).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errors:
                  - code: '10005'
                    title: Resource not found
                    detail: The requested resource or URL could not be found.
                    source:
                      pointer: /
                    meta:
                      url: https://developers.telnyx.com/docs/overview/errors/10005
      security: []
components:
  schemas:
    BotSessionResponse:
      type: object
      required:
        - data
      properties:
        data:
          type: object
          required:
            - api_v2_token
          properties:
            api_v2_token:
              type: string
              description: >-
                API v2 session token for the signed-in user. Use it as a bearer
                token on authenticated endpoints.
              example: KEY0189A1B2C3D4E5F6071829AB3C4D5E_5FhZonmFvcw8Yq0dME27Bg
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
      required:
        - errors
    Error:
      type: object
      description: >-
        API error. General errors carry only `detail`; structured errors also
        include `code`, `title`, `source`, and `meta`.
      properties:
        code:
          type: string
          description: Machine-readable Telnyx error code.
          example: '10005'
        title:
          type: string
          description: Short human-readable summary.
          example: Resource not found
        detail:
          type: string
          description: Human-readable explanation of the error.
          example: The requested resource or URL could not be found.
        source:
          type: object
          properties:
            pointer:
              type: string
              description: JSON pointer to the offending attribute.
              example: /
        meta:
          type: object
          properties:
            url:
              type: string
              description: Link to the error documentation.
              example: https://developers.telnyx.com/docs/overview/errors/10005
      required:
        - detail

````