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

# Issue a one-time exchange code for the current user JWT

> Replace an authenticated user JWT with a short-lived one-time code.

Dashboard and customer backends call this before constructing a Connect
URL. The already-verified JWT is read from the Authorization header and
stored server-side; only the opaque code is allowed into the browser URL.
API keys and admin tokens are rejected because Connect requires a concrete
app user subject.



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/hyperspell.yaml post /oauth/token-exchange/issue
openapi: 3.1.0
info:
  title: Hyperspell API
  summary: >-
    Hyperspell is the memory layer for AI apps and agents. Through the API, you
    can add memories, connect data sources to index them in real-time, and
    search memories with our natural language query engine.
  termsOfService: https://hyperspell.com/blog/tos
  contact:
    name: Hyperspell
    url: https://hyperspell.com/
    email: hello@hyperspell.com
  version: 0.32.1
servers:
  - url: https://api.hyperspell.com
    description: Production
security:
  - APIKey: []
    AsUser: []
paths:
  /oauth/token-exchange/issue:
    post:
      tags:
        - OAuth
      summary: Issue a one-time exchange code for the current user JWT
      description: >-
        Replace an authenticated user JWT with a short-lived one-time code.


        Dashboard and customer backends call this before constructing a Connect

        URL. The already-verified JWT is read from the Authorization header and

        stored server-side; only the opaque code is allowed into the browser
        URL.

        API keys and admin tokens are rejected because Connect requires a
        concrete

        app user subject.
      operationId: issue_oauth_token_exchange_oauth_token_exchange_issue_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenExchangeIssueResponse'
      security:
        - APIKey: []
        - AsUser: []
components:
  schemas:
    TokenExchangeIssueResponse:
      properties:
        code:
          type: string
          title: Code
        expires_in:
          type: integer
          title: Expires In
          default: 120
      type: object
      required:
        - code
      title: TokenExchangeIssueResponse
  securitySchemes:
    APIKey:
      type: http
      description: >-
        API Key or JWT User Token. If using an API Key, set the X-As-User header
        to act as a specific user. A JWT User Token is always scoped to a
        specific user.
      scheme: bearer
      bearerFormat: Bearer <token>
    AsUser:
      type: apiKey
      description: >-
        Optionally set this header to act as a specific user when using an API
        Key, equivalent to first exchanging the API Key for a User Token
      in: header
      name: X-As-User

````