> ## 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.

# Quickstart

> Get your first OFAuth API call working in under 2 minutes

<Info>
  **Prerequisites**: You need an OFAuth account. [Sign up here](https://app.ofauth.com) if you don't have one.
</Info>

<Warning>
  **Use Sandbox for testing!** Before testing with real OnlyFans accounts, use the [Sandbox environment](/setup/sandbox) with test credentials. Too many login attempts on production accounts can trigger OnlyFans "suspicious activity" detection, which may cause account resets.
</Warning>

## Step 1: Set Up Your Account

<Steps>
  <Step title="Complete platform profile">
    Open [app.ofauth.com/platform/apps](https://app.ofauth.com/platform/apps) and complete the setup wizard with your app name, description, website, and privacy policy.
  </Step>

  <Step title="Create a client app">
    Choose your integration type (Redirect, Embed, or Whitelabel) and configure your allowed redirect URIs or origins. Copy your `clientAppId`.
  </Step>

  <Step title="Get your API key">
    Go to [API Keys](https://app.ofauth.com/platform/developers/keys). Your API key looks like `sk_live_...` (production) or `sk_sandbox_...` (testing). Keep it secure—don't commit it to version control.
  </Step>
</Steps>

**Verify it works:**

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.ofauth.com/v2/account/whoami \
    -H "apikey: YOUR_API_KEY"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.ofauth.com/v2/account/whoami", {
    headers: { apikey: "YOUR_API_KEY" }
  })
  console.log(await response.json())
  ```

  ```python Python theme={null}
  import requests
  response = requests.get(
      "https://api.ofauth.com/v2/account/whoami",
      headers={"apikey": "YOUR_API_KEY"}
  )
  print(response.json())
  ```
</CodeGroup>

<Check>
  You should see your organization details. If you get an error, double-check your API key.
</Check>

***

## Step 2: Connect an OnlyFans Account

Create a Link session to authenticate a user:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.ofauth.com/v2/link/init \
    -H "apikey: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "redirectUrl": "https://yourapp.com/callback"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.ofauth.com/v2/link/init", {
    method: "POST",
    headers: {
      apikey: "YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      redirectUrl: "https://yourapp.com/callback"
    })
  })

  const session = await response.json()
  if (session.mode !== "hosted") {
    throw new Error(`Expected hosted Link session, received ${session.mode}`)
  }
  console.log("Redirect user to:", session.url)
  ```

  ```python Python theme={null}
  import requests
  response = requests.post(
      "https://api.ofauth.com/v2/link/init",
      headers={
          "apikey": "YOUR_API_KEY",
          "Content-Type": "application/json"
      },
      json={
          "redirectUrl": "https://yourapp.com/callback"
      }
  )
  session = response.json()
  if session["mode"] != "hosted":
      raise ValueError(f"Expected hosted Link session, received {session['mode']}")
  print("Redirect user to:", session["url"])
  ```
</CodeGroup>

**What happens:**

1. You get a hosted Link session response with `mode: "hosted"` and a `url`
2. Redirect the user to that URL
3. They authenticate on OFAuth's secure page
4. On success, they're redirected to your `redirectUrl` with `connection_id` as a query parameter

<Tip>
  For testing, use a Sandbox API key (`sk_sandbox_...`) with [test credentials](/setup/sandbox).
</Tip>

***

## Step 3: Fetch Data

Once you have a Connection ID, use it to access OnlyFans data:

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.ofauth.com/v2/access/self \
    -H "apikey: YOUR_API_KEY" \
    -H "x-connection-id: conn_YOUR_CONNECTION_ID"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.ofauth.com/v2/access/self", {
    headers: {
      apikey: "YOUR_API_KEY",
      "x-connection-id": "conn_YOUR_CONNECTION_ID"
    }
  })

  const profile = await response.json()
  console.log("Connected as:", profile.name)
  ```

  ```python Python theme={null}
  import requests
  response = requests.get(
      "https://api.ofauth.com/v2/access/self",
      headers={
          "apikey": "YOUR_API_KEY",
          "x-connection-id": "conn_YOUR_CONNECTION_ID"
      }
  )
  print("Connected as:", response.json()["name"])
  ```
</CodeGroup>

<Check>
  **That's it!** You've connected an OnlyFans account and fetched data through OFAuth.
</Check>

***

## What's Next?

<CardGroup cols={2}>
  <Card title="Send Messages" icon="messages" href="/guides/messaging">
    Learn to send messages and manage chats
  </Card>

  <Card title="List Fans" icon="users" href="/guides/fans">
    Get subscriber lists and fan data
  </Card>

  <Card title="TypeScript SDK" icon="npm" href="/sdk/typescript/quickstart">
    Use our SDK for type-safe development
  </Card>

  <Card title="Set Up System Webhooks" icon="webhook" href="/api-reference/system-webhook-events/overview">
    Get notified when connections change
  </Card>
</CardGroup>

***

## Common Issues

<AccordionGroup>
  <Accordion title="401 Unauthorized">
    Check that your API key is correct and included in the `apikey` header.
  </Accordion>

  <Accordion title="Connection not found">
    The Connection ID may have expired or be invalid. Create a new Link session.
  </Accordion>

  <Accordion title="Session expired">
    OnlyFans sessions expire periodically. The user needs to re-authenticate via Link.
  </Accordion>
</AccordionGroup>

<Card title="Need Help?" icon="envelope" href="mailto:support@ofauth.com">
  Contact our support team for assistance
</Card>
