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

# Connect Channel (OAuth)

> Generate an OAuth authorization URL for a given integration. Use this to connect a new social media channel. Only OAuth-based integrations are supported (integrations that require an external URL, such as Mastodon, are not available via this endpoint).

This returns the URL to send a person to. It does not connect anything on its own, because the
network shows a consent screen to a human and then redirects back.

<Info>
  There is no headless way to add a channel, and that is the network's rule rather than ours.
</Info>

## Two ways this returns 400

Both arrive before any request reaches the network, so they are quick to tell apart from a real
OAuth failure.

| Message                                                                             | What it means                                                                                                                                                                                                              |
| ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Integration not allowed`                                                           | The `{integration}` value is not one she can connect this way. Check the spelling against the identifiers in [Provider Tools](/public-api/integrations/provider-tools); they are lowercase and not always the display name |
| `This integration requires an external URL and is not supported via the public API` | The network needs you to say *where* it lives before it can start, which this endpoint has no way to ask for                                                                                                               |

<Warning>
  **Mastodon and other self-hosted networks are not connectable through this endpoint.** They need
  an instance URL, and the only place that asks for one is **Add Channel** in the app. That is what
  the second message above means in practice.
</Warning>

## Refreshing an existing channel

<Tip>
  Pass `?refresh=<integration-id>` and the flow reconnects that channel instead of adding a new one.
  Use it when a channel has gone red because the network expired its token rather than because
  someone revoked access.
</Tip>

## After the redirect

The person lands back on your `FRONTEND_URL`.

<Check>
  The channel appears in [List Channels](/public-api/integrations/list). That is the check worth
  polling for, since this endpoint only ever hands out a URL.
</Check>


## OpenAPI

````yaml GET /social/{integration}
openapi: 3.1.0
info:
  title: PostQueen Public API
  description: >-
    API for managing social media posts, integrations, and media uploads in
    PostQueen.


    ## Authentication


    All endpoints require an API key passed in the `Authorization` header:


    ```

    Authorization: your-api-key

    ```


    Get your API key from PostQueen Settings.


    ## Rate Limits


    The create-post endpoint is capped per organization per hour. With
    `API_LIMIT` unset the ceiling is **90 requests per hour**; the shipped
    Compose files and PostQueen Cloud both set it to **30**. No other endpoint
    is throttled.


    ## Terminology


    The UI uses `channel`, but the API uses `integration`. They refer to the
    same thing.


    ## Supported Platforms (34)


    **Social Platforms:** X (Twitter), LinkedIn, LinkedIn Page, Facebook,
    Instagram, Instagram Standalone, Threads, Bluesky, Mastodon, Warpcast
    (Farcaster), Nostr, VK


    **Video Platforms:** YouTube, TikTok


    **Community Platforms:** Reddit, Lemmy, Discord, Slack, Telegram, Kick,
    Twitch


    **Design Platforms:** Pinterest, Dribbble


    **Blogging Platforms:** Medium, Dev.to, Hashnode, WordPress, Moltbook


    **Business:** Google My Business (GMB), Listmonk (newsletters), Whop, Skool
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.postqueen.ai/public/v1
    description: PostQueen Cloud
  - url: https://{host}/api/public/v1
    description: Self-hosted
    variables:
      host:
        default: localhost:4007
        description: Your PostQueen instance domain
security:
  - ApiKeyAuth: []
tags:
  - name: Integrations
    description: Manage connected social media channels
  - name: Posts
    description: Create, list, and delete posts
  - name: Uploads
    description: Upload media files
  - name: Notifications
    description: View organization notifications
  - name: Analytics
    description: View analytics for integrations and posts
  - name: Video Generation
    description: Generate videos with AI
  - name: OAuth
    description: Authorize third-party apps and exchange codes for access tokens
paths:
  /social/{integration}:
    get:
      tags:
        - Integrations
      summary: Get OAuth URL for a channel
      description: >-
        Generate an OAuth authorization URL for a given integration. Use this to
        connect a new social media channel. Only OAuth-based integrations are
        supported (integrations that require an external URL, such as Mastodon,
        are not available via this endpoint).
      operationId: getIntegrationUrl
      parameters:
        - name: integration
          in: path
          required: true
          description: >-
            The integration identifier (e.g. x, linkedin, facebook, instagram,
            youtube, tiktok, reddit, etc.)
          schema:
            type: string
        - name: refresh
          in: query
          required: false
          description: >-
            Pass an existing integration ID to refresh its OAuth token instead
            of creating a new connection
          schema:
            type: string
      responses:
        '200':
          description: OAuth authorization URL
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    description: The OAuth authorization URL to redirect the user to
              example:
                url: >-
                  https://twitter.com/i/oauth2/authorize?response_type=code&client_id=...
        '400':
          description: Integration not allowed or requires an external URL
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Your PostQueen API key

````