> ## Documentation Index
> Fetch the complete documentation index at: https://sure-917046f5-mintlify-docs-update-1787365312803.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Exchange mobile SSO authorization code for tokens

> Exchanges a one-time authorization code (received via deep link after mobile SSO) for OAuth tokens. The code is single-use and expires after 5 minutes.



## OpenAPI

````yaml /openapi.yaml post /api/v1/auth/sso_exchange
openapi: 3.0.3
info:
  title: Sure API
  version: v1
  description: OpenAPI documentation generated from executable request specs.
servers:
  - url: https://app.sure.am
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/auth/sso_exchange:
    post:
      tags:
        - Auth
      summary: Exchange mobile SSO authorization code for tokens
      description: >-
        Exchanges a one-time authorization code (received via deep link after
        mobile SSO) for OAuth tokens. The code is single-use and expires after 5
        minutes.
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                code:
                  type: string
                  description: One-time authorization code from mobile SSO callback
              required:
                - code
        required: true
      responses:
        '200':
          description: tokens issued
          content:
            application/json:
              schema:
                type: object
                properties:
                  access_token:
                    type: string
                  refresh_token:
                    type: string
                  token_type:
                    type: string
                  expires_in:
                    type: integer
                  created_at:
                    type: integer
                  user:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      email:
                        type: string
                      first_name:
                        type: string
                      last_name:
                        type: string
                      ui_layout:
                        type: string
                        enum:
                          - dashboard
                          - intro
                      ai_enabled:
                        type: boolean
        '401':
          description: invalid or expired code
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        message:
          type: string
          nullable: true
        details:
          oneOf:
            - type: array
              items:
                type: string
            - type: object
          nullable: true
        errors:
          type: array
          items:
            type: string
          nullable: true
          description: >-
            Validation error messages (alternative to details used by trades,
            valuations, etc.)

````