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

# Generate OAuth URL

> Generates a browser authorization URL for connecting a new social account to a project.

This endpoint is useful for multi-user integrations where your application lets
your own users, clients, or brands connect their social accounts to WoopSocial
without giving them access to your WoopSocial account.

A common flow is:
1. Create or select a WoopSocial project for your user, client, or brand.
2. Call this endpoint from your backend with that `projectId`, the target `platform`,
   and a `redirectUrl` in your application.
3. Open the returned `url` in your user's browser.
4. After OAuth completes, WoopSocial redirects the browser back to `redirectUrl`
   with result query parameters.
5. Use `projectId` and `socialAccountIds` from the redirect, or call
   `GET /social-accounts?projectId=...`, to store or confirm the connected account
   in your application.

When `redirectUrl` is provided, the browser is redirected back to that URL after
the OAuth callback is handled.

For Facebook, WoopSocial shows a page-selection screen after authorization
because Facebook may return more pages than the user appeared to select in
the Facebook dialog in cases where the user has authorized with WoopSocial previously. The selected pages are connected to the single
`projectId` from this request, then WoopSocial redirects back to
`redirectUrl` when one was provided.

When `redirectUrl` is provided, WoopSocial appends these query parameters on success:
- `status=success`
- `projectId`: the project identifier from the request
- `platform`: the connected social platform
- `socialAccountIds`: comma-separated connected social account identifiers. This may contain one or more IDs depending on the platform OAuth flow.

When `redirectUrl` is provided, WoopSocial appends these query parameters on failure:
- `status=error`
- `projectId`: the project identifier from the request
- `platform`: the requested social platform
- `error`: an OAuth callback error code

If the OAuth callback state is missing or expired, WoopSocial cannot safely
determine the original `redirectUrl`, so the callback returns an HTTP error
instead of redirecting.

The redirect never includes OAuth tokens or credentials.




## OpenAPI

````yaml /openapi.yaml post /social-accounts/authorization-url
openapi: 3.1.0
info:
  title: WoopSocial API
  version: 1.0.0
  summary: API for WoopSocial integrations.
  description: >
    This is the public-facing OpenAPI contract for WoopSocial. It supports
    scheduling posts for various social media platforms such as Facebook,
    Instagram, LinkedIn, LinkedIn Pages, Pinterest, Threads, TikTok, X (formerly
    Twitter) and YouTube.
servers:
  - url: https://api.woopsocial.com/v1
    description: WoopSocial API URL.
  - url: http://localhost:9123/api/external/v1
    description: Local WoopSocial API URL.
security: []
tags:
  - name: Posts
    description: Post scheduling endpoints.
  - name: Projects
    description: Project discovery endpoints.
  - name: Social Accounts
    description: Connected social account discovery endpoints.
  - name: Media
    description: Media upload endpoints.
  - name: Webhooks
    description: Webhook endpoint management.
  - name: Health
    description: Basic connectivity endpoints.
paths:
  /social-accounts/authorization-url:
    post:
      tags:
        - Social Accounts
      summary: Generate OAuth URL
      description: >
        Generates a browser authorization URL for connecting a new social
        account to a project.


        This endpoint is useful for multi-user integrations where your
        application lets

        your own users, clients, or brands connect their social accounts to
        WoopSocial

        without giving them access to your WoopSocial account.


        A common flow is:

        1. Create or select a WoopSocial project for your user, client, or
        brand.

        2. Call this endpoint from your backend with that `projectId`, the
        target `platform`,
           and a `redirectUrl` in your application.
        3. Open the returned `url` in your user's browser.

        4. After OAuth completes, WoopSocial redirects the browser back to
        `redirectUrl`
           with result query parameters.
        5. Use `projectId` and `socialAccountIds` from the redirect, or call
           `GET /social-accounts?projectId=...`, to store or confirm the connected account
           in your application.

        When `redirectUrl` is provided, the browser is redirected back to that
        URL after

        the OAuth callback is handled.


        For Facebook, WoopSocial shows a page-selection screen after
        authorization

        because Facebook may return more pages than the user appeared to select
        in

        the Facebook dialog in cases where the user has authorized with
        WoopSocial previously. The selected pages are connected to the single

        `projectId` from this request, then WoopSocial redirects back to

        `redirectUrl` when one was provided.


        When `redirectUrl` is provided, WoopSocial appends these query
        parameters on success:

        - `status=success`

        - `projectId`: the project identifier from the request

        - `platform`: the connected social platform

        - `socialAccountIds`: comma-separated connected social account
        identifiers. This may contain one or more IDs depending on the platform
        OAuth flow.


        When `redirectUrl` is provided, WoopSocial appends these query
        parameters on failure:

        - `status=error`

        - `projectId`: the project identifier from the request

        - `platform`: the requested social platform

        - `error`: an OAuth callback error code


        If the OAuth callback state is missing or expired, WoopSocial cannot
        safely

        determine the original `redirectUrl`, so the callback returns an HTTP
        error

        instead of redirecting.


        The redirect never includes OAuth tokens or credentials.
      operationId: createOAuthAuthorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOAuthAuthorizationRequest'
      responses:
        '200':
          description: OAuth authorization URL created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOAuthAuthorizationResponse'
      security:
        - ApiKey: []
components:
  schemas:
    CreateOAuthAuthorizationRequest:
      type: object
      additionalProperties: false
      required:
        - projectId
        - platform
      properties:
        projectId:
          type: string
          description: Project identifier.
        platform:
          $ref: '#/components/schemas/SocialPlatform'
        redirectUrl:
          type: string
          format: uri
          example: https://app.example.com/oauth/complete
          description: >
            Optional URL in your application to return the browser to after
            OAuth completes.


            Use this for multi-user integrations where your users connect their
            own social

            accounts through your app. WoopSocial appends OAuth result query
            parameters to

            this URL so your app can finish the connection flow.


            The redirect does not include tokens or credentials.
    CreateOAuthAuthorizationResponse:
      type: object
      additionalProperties: false
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: Browser URL that starts the OAuth authorization flow.
    SocialPlatform:
      type: string
      enum:
        - PINTEREST
        - LINKEDIN
        - LINKEDIN_PAGES
        - INSTAGRAM
        - FACEBOOK
        - THREADS
        - TIKTOK
        - X
        - YOUTUBE
        - WOOPTEST
      description: |
        Identifies which social media platform this data structure targets.
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: API key

````