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

# Initialize a Link session

> Initialize a Link session for authentication.



## OpenAPI

````yaml https://api.ofauth.com/openapi.json post /v2/link/init
openapi: 3.1.0
info:
  title: OFAuth API
  version: 1.0.0
  description: >-
    OFAuth API including Account, Connections, Link, Access, Dynamic Rules,
    Vault+, and Realtime webhook contracts
  contact:
    email: support@ofauth.com
    url: https://ofauth.com/
servers:
  - url: https://api.ofauth.com
security:
  - ApiKey: []
tags:
  - name: Account
    description: Account management endpoints.
  - name: Connections
    description: Connection management endpoints.
  - name: Link
    description: Link authentication and session endpoints.
  - name: Access
    description: All Access related endpoints.
  - name: Analytics
    description: 'Access: charts, tops, and performance metrics.'
  - name: Earnings
    description: 'Access: earnings charts, transactions, and chargebacks.'
  - name: Messages
    description: 'Access: messaging, chats, queue, and mass messaging.'
  - name: Posts
    description: 'Access: create, edit, list, and manage posts.'
  - name: Promotions
    description: 'Access: promotions, trials, and bundles.'
  - name: Users
    description: 'Access: user profiles, subscriptions, and actions.'
  - name: Vault
    description: 'Access: vault folders, media, and management.'
  - name: Upload
    description: 'Access: media upload and processing.'
  - name: Self
    description: 'Access: authenticated account details and settings.'
  - name: Stories
    description: 'Access: stories listing and management.'
  - name: Subscriptions
    description: 'Access: subscription offers, discounts, and management.'
  - name: Realtime
    description: >-
      Realtime webhook delivery contracts, including relayed OnlyFans websocket
      events.
  - name: Dynamic Rules
    description: Dynamic signing rules operations.
  - name: Vault+
    description: Vault+ caching and management.
externalDocs:
  description: OFAuth Developer Documentation
  url: https://docs.ofauth.com
paths:
  /v2/link/init:
    post:
      tags:
        - Link
      summary: Initialize a Link session
      description: Initialize a Link session for authentication.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                clientAppId:
                  type: string
                  pattern: ^app_[a-zA-Z0-9]+$
                  description: Client app id.
                mode:
                  type: string
                  enum:
                    - redirect
                    - embed
                    - hosted
                    - whitelabel
                  description: >-
                    Optional mode hint when clientAppId is omitted. Migrate to
                    explicit clientAppId and configure type on the client app.
                  deprecated: true
                options:
                  type: object
                  properties:
                    returnRawSession:
                      type: boolean
                      description: >-
                        Returns raw session data in whitelabel status responses.
                        Migrate to client app configuration and omit this field.
                      deprecated: true
                  description: >-
                    Optional session flags. Migrate to client app configuration
                    and omit this field.
                  deprecated: true
                redirectUrl:
                  type: string
                  format: uri
                  description: >-
                    URL to redirect to after completion. URL must be included in
                    the client app settings. If omitted, Link uses the default
                    redirect URI from the resolved client app when available.
                origin:
                  type: string
                  format: uri
                  description: >-
                    Optional embed origin override. Migrate to explicit
                    clientAppId with allowed origins configured on the client
                    app.
                  deprecated: true
                clientReferenceId:
                  type: string
                  description: Your internal reference ID for webhook correlation.
                connectionId:
                  type: string
                  description: Existing connection ID to reconnect.
                geolocation:
                  type: object
                  properties:
                    country:
                      type: string
                      description: Geolocation country code override (e.g. US).
                    state:
                      type: string
                      description: >-
                        Geolocation state/region override (e.g. CA for
                        California).
                    city:
                      type: string
                      description: Geolocation city override (e.g. San Francisco).
                  required:
                    - country
      responses:
        '200':
          description: Link session initialized successfully
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    properties:
                      mode:
                        type: string
                        enum:
                          - hosted
                      url:
                        type: string
                        description: URL to redirect the user to
                      expiresAt:
                        type: string
                        description: ISO timestamp when the session expires
                    required:
                      - mode
                      - url
                      - expiresAt
                  - type: object
                    properties:
                      mode:
                        type: string
                        enum:
                          - whitelabel
                      clientSecret:
                        type: string
                        description: Client secret for whitelabel route access
                      expiresAt:
                        type: string
                        description: ISO timestamp when the session expires
                    required:
                      - mode
                      - clientSecret
                      - expiresAt
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '403':
          description: Limit reached
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '404':
          description: Client app not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
        '500':
          description: Failed to initialize Link session
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
components:
  securitySchemes:
    ApiKey:
      type: apiKey
      name: apiKey
      in: header
      description: >-
        Your OFAuth [API key](/quickstart#2-copy-your-api-key) for
        authenticating requests.

````