Autoposting.ai Platform OAuth API

Connect social media accounts via OAuth and manage platform tokens for X, LinkedIn, Instagram, Threads, and YouTube.

Operations 9

GET /oauth/{platform}/authorize Get OAuth authorization URL #
POST /oauth/exchange Exchange OAuth code for tokens #
GET /brands/{slug}/auth/status Get token status for all platforms #
GET /brands/{slug}/tokens/{platform} Get token details for a platform #
PATCH /brands/{slug}/tokens/{platform} Refresh a platform token #
POST /brands/{slug}/tokens Store a platform token #
DELETE /brands/{slug}/tokens/{platform}/{platformUserId} Delete a platform token #
POST /brands/{slug}/tokens/{platform}/{platformUserId}/move Move token to another brand #
PUT /tokens/{tokenId}/settings Update platform account settings #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/autoposting-ai:autoposting-ai-platform-oauth-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

autoposting-ai-platform-oauth-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Autoposting Platform OAuth API
  description: 'Schedule, publish, and AI-enhance social content across X, LinkedIn, Instagram, Threads, and YouTube. All responses use the `{ "success": boolean, "data": ... }` envelope. Authenticate with an API key (`Authorization: Bearer sk-social-...` or `x-api-key: sk-social-...`).'
  version: 1.0.0
servers:
- url: https://app.autoposting.ai/api-proxy
  description: Production
security:
- bearerAuth: []
- apiKeyHeader: []
tags:
- name: Platform OAuth
  description: Connect social media accounts via OAuth and manage platform tokens for X, LinkedIn, Instagram, Threads, and YouTube.
paths:
  /oauth/{platform}/authorize:
    get:
      tags:
      - Platform OAuth
      summary: Get OAuth authorization URL
      description: Returns the platform authorization URL to redirect the user to for connecting a social account.
      operationId: getOauthAuthorizationUrl
      parameters:
      - name: platform
        in: path
        required: true
        description: Platform to authorize.
        schema:
          type: string
          enum:
          - x
          - linkedin
          - instagram
          - threads
          - youtube
          - facebook
          example: linkedin
      - name: brandSlug
        in: query
        required: true
        description: Brand to associate the connected account with.
        schema:
          type: string
          example: acme-corp
      - name: redirectUri
        in: query
        required: true
        description: Your application's OAuth callback URL. Must be registered in the platform's developer settings.
        schema:
          type: string
          example: https://app.acme.com/oauth/callback
      responses:
        '200':
          description: Authorization URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/OAuthRedirect'
              example:
                success: true
                data:
                  authorizationUrl: https://www.linkedin.com/oauth/v2/authorization?client_id=...&state=abc123
                  state: abc123
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformOAuthError'
              example:
                success: false
                error: unauthorized
                message: Missing or invalid API key.
  /oauth/exchange:
    post:
      tags:
      - Platform OAuth
      summary: Exchange OAuth code for tokens
      description: Exchanges the authorization code from the OAuth redirect for platform tokens and stores them on the brand.
      operationId: exchangeOauthCode
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - platform
              - code
              - brandSlug
              - redirectUri
              properties:
                platform:
                  type: string
                  enum:
                  - x
                  - linkedin
                  - instagram
                  - threads
                  - youtube
                  - facebook
                  example: linkedin
                code:
                  type: string
                  description: Authorization code from the OAuth redirect callback.
                  example: AQT...
                brandSlug:
                  type: string
                  description: Brand to attach the token to.
                  example: acme-corp
                redirectUri:
                  type: string
                  description: Must match the redirectUri used in the authorization step.
                  example: https://app.acme.com/oauth/callback
                state:
                  type: string
                  description: State parameter from the authorization URL (for CSRF validation).
                  example: abc123
      responses:
        '200':
          description: Token stored.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/OAuthConnection'
              example:
                success: true
                data:
                  tokenId: tok_01HXYZ
                  platform: linkedin
                  platformUserId: lin_abc123
                  platformUsername: Jane Doe
                  brandSlug: acme-corp
                  scopes:
                  - r_liteprofile
                  - w_member_social
                  expiresAt: '2025-01-01T00:00:00Z'
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformOAuthError'
              example:
                success: false
                error: unauthorized
                message: Missing or invalid API key.
  /brands/{slug}/auth/status:
    get:
      tags:
      - Platform OAuth
      summary: Get token status for all platforms
      description: Returns connection status for all platforms on a brand — which are connected and which have expired tokens.
      operationId: getBrandAuthStatus
      parameters:
      - name: slug
        in: path
        required: true
        description: Brand slug.
        schema:
          type: string
          example: acme-corp
      responses:
        '200':
          description: Per-platform auth status.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      x:
                        $ref: '#/components/schemas/PlatformAuthStatus'
                      linkedin:
                        $ref: '#/components/schemas/PlatformAuthStatus'
                      instagram:
                        $ref: '#/components/schemas/PlatformAuthStatus'
                      threads:
                        $ref: '#/components/schemas/PlatformAuthStatus'
                      youtube:
                        $ref: '#/components/schemas/PlatformAuthStatus'
              example:
                success: true
                data:
                  x:
                    connected: true
                    tokenExpired: false
                    accounts:
                    - platformUserId: x_12345
                      username: '@acmecorp'
                      tokenId: tok_01HXYZ
                  linkedin:
                    connected: true
                    tokenExpired: false
                    accounts:
                    - platformUserId: lin_abc123
                      username: Acme Corp
                      tokenId: tok_02HXYZ
                  instagram:
                    connected: false
                    tokenExpired: false
                    accounts: []
                  threads:
                    connected: false
                    tokenExpired: false
                    accounts: []
                  youtube:
                    connected: false
                    tokenExpired: false
                    accounts: []
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformOAuthError'
              example:
                success: false
                error: unauthorized
                message: Missing or invalid API key.
  /brands/{slug}/tokens/{platform}:
    get:
      tags:
      - Platform OAuth
      summary: Get token details for a platform
      description: Returns stored token details for the given platform on a brand.
      operationId: getPlatformTokenDetails
      parameters:
      - name: slug
        in: path
        required: true
        description: Brand slug.
        schema:
          type: string
          example: acme-corp
      - name: platform
        in: path
        required: true
        description: Platform identifier.
        schema:
          type: string
          enum:
          - x
          - linkedin
          - instagram
          - threads
          - youtube
          - facebook
          example: x
      responses:
        '200':
          description: Platform token details.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/PlatformToken'
              example:
                success: true
                data:
                - tokenId: tok_01HXYZ
                  platformUserId: x_12345
                  username: '@acmecorp'
                  scopes:
                  - tweet.read
                  - tweet.write
                  expiresAt: '2025-01-01T00:00:00Z'
                  lastUsedAt: '2024-01-10T09:05:00Z'
                  status: active
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformOAuthError'
              example:
                success: false
                error: unauthorized
                message: Missing or invalid API key.
    patch:
      tags:
      - Platform OAuth
      summary: Refresh a platform token
      description: Triggers a token refresh using the stored refresh token.
      operationId: refreshPlatformToken
      parameters:
      - name: slug
        in: path
        required: true
        description: Brand slug.
        schema:
          type: string
          example: acme-corp
      - name: platform
        in: path
        required: true
        description: Platform identifier.
        schema:
          type: string
          enum:
          - x
          - linkedin
          - instagram
          - threads
          - youtube
          - facebook
          example: x
      responses:
        '200':
          description: Token refreshed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      tokenId:
                        type: string
                        example: tok_01HXYZ
                      expiresAt:
                        type: string
                        format: date-time
                        example: '2025-07-01T00:00:00Z'
                      refreshedAt:
                        type: string
                        format: date-time
                        example: '2024-01-10T00:00:00Z'
              example:
                success: true
                data:
                  tokenId: tok_01HXYZ
                  expiresAt: '2025-07-01T00:00:00Z'
                  refreshedAt: '2024-01-10T00:00:00Z'
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformOAuthError'
              example:
                success: false
                error: unauthorized
                message: Missing or invalid API key.
  /brands/{slug}/tokens:
    post:
      tags:
      - Platform OAuth
      summary: Store a platform token
      description: Manually store a platform token, for advanced integrations where the OAuth flow is handled externally.
      operationId: storePlatformToken
      parameters:
      - name: slug
        in: path
        required: true
        description: Brand slug.
        schema:
          type: string
          example: acme-corp
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - platform
              - accessToken
              - platformUserId
              properties:
                platform:
                  type: string
                  description: Platform identifier.
                  enum:
                  - x
                  - linkedin
                  - instagram
                  - threads
                  - youtube
                  - facebook
                  example: x
                accessToken:
                  type: string
                  description: Platform access token.
                  example: ya29.a0...
                refreshToken:
                  type: string
                  description: Platform refresh token (if applicable).
                platformUserId:
                  type: string
                  description: User/page ID on the platform.
                  example: x_12345
                expiresAt:
                  type: string
                  format: date-time
                  description: Token expiry datetime.
                  example: '2025-01-01T00:00:00Z'
      responses:
        '200':
          description: Token stored.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/PlatformToken'
              example:
                success: true
                data:
                  tokenId: tok_01HXYZ
                  platformUserId: x_12345
                  username: '@acmecorp'
                  scopes:
                  - tweet.read
                  - tweet.write
                  expiresAt: '2025-01-01T00:00:00Z'
                  lastUsedAt: null
                  status: active
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformOAuthError'
              example:
                success: false
                error: unauthorized
                message: Missing or invalid API key.
  /brands/{slug}/tokens/{platform}/{platformUserId}:
    delete:
      tags:
      - Platform OAuth
      summary: Delete a platform token
      description: Disconnects a specific platform account from the brand. Posts scheduled to use this account will fail to publish.
      operationId: deletePlatformToken
      parameters:
      - name: slug
        in: path
        required: true
        description: Brand slug.
        schema:
          type: string
          example: acme-corp
      - name: platform
        in: path
        required: true
        description: Platform identifier.
        schema:
          type: string
          enum:
          - x
          - linkedin
          - instagram
          - threads
          - youtube
          - facebook
          example: x
      - name: platformUserId
        in: path
        required: true
        description: User/page ID on the platform.
        schema:
          type: string
          example: x_12345
      responses:
        '200':
          description: Token deleted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
              example:
                success: true
                data: {}
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformOAuthError'
              example:
                success: false
                error: unauthorized
                message: Missing or invalid API key.
  /brands/{slug}/tokens/{platform}/{platformUserId}/move:
    post:
      tags:
      - Platform OAuth
      summary: Move token to another brand
      description: Transfer a platform account connection from one brand to another.
      operationId: movePlatformToken
      parameters:
      - name: slug
        in: path
        required: true
        description: Source brand slug.
        schema:
          type: string
          example: acme-corp
      - name: platform
        in: path
        required: true
        description: Platform identifier.
        schema:
          type: string
          enum:
          - x
          - linkedin
          - instagram
          - threads
          - youtube
          - facebook
          example: x
      - name: platformUserId
        in: path
        required: true
        description: User/page ID on the platform.
        schema:
          type: string
          example: x_12345
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - targetBrandSlug
              properties:
                targetBrandSlug:
                  type: string
                  description: Slug of the destination brand.
                  example: new-brand
      responses:
        '200':
          description: Token moved.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      tokenId:
                        type: string
                        example: tok_01HXYZ
                      newBrandSlug:
                        type: string
                        example: new-brand
              example:
                success: true
                data:
                  tokenId: tok_01HXYZ
                  newBrandSlug: new-brand
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformOAuthError'
              example:
                success: false
                error: unauthorized
                message: Missing or invalid API key.
  /tokens/{tokenId}/settings:
    put:
      tags:
      - Platform OAuth
      summary: Update platform account settings
      description: Update per-account settings such as posting preferences.
      operationId: updatePlatformAccountSettings
      parameters:
      - name: tokenId
        in: path
        required: true
        description: Identifier of the stored platform token.
        schema:
          type: string
          example: tok_01HXYZ
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                defaultReplyControl:
                  type: string
                  description: Default reply control for Threads posts.
                  enum:
                  - everyone
                  - accounts_you_follow
                  - mentioned_only
                  example: everyone
                autoRepost:
                  type: boolean
                  description: Enable automatic reposting for this account.
                  example: true
      responses:
        '200':
          description: Settings updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    type: object
                    properties:
                      tokenId:
                        type: string
                        example: tok_01HXYZ
                      defaultReplyControl:
                        type: string
                        enum:
                        - everyone
                        - accounts_you_follow
                        - mentioned_only
                        example: everyone
                      autoRepost:
                        type: boolean
                        example: true
              example:
                success: true
                data:
                  tokenId: tok_01HXYZ
                  defaultReplyControl: everyone
                  autoRepost: true
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlatformOAuthError'
              example:
                success: false
                error: unauthorized
                message: Missing or invalid API key.
components:
  schemas:
    PlatformAccount:
      type: object
      description: A single connected account on a platform.
      properties:
        platformUserId:
          type: string
          example: x_12345
        username:
          type: string
          example: '@acmecorp'
        tokenId:
          type: string
          example: tok_01HXYZ
    OAuthConnection:
      type: object
      description: A platform token created from an OAuth code exchange.
      properties:
        tokenId:
          type: string
          example: tok_01HXYZ
        platform:
          type: string
          enum:
          - x
          - linkedin
          - instagram
          - threads
          - youtube
          - facebook
          example: linkedin
        platformUserId:
          type: string
          example: lin_abc123
        platformUsername:
          type: string
          example: Jane Doe
        brandSlug:
          type: string
          example: acme-corp
        scopes:
          type: array
          items:
            type: string
          example:
          - r_liteprofile
          - w_member_social
        expiresAt:
          type:
          - string
          - 'null'
          format: date-time
          example: '2025-01-01T00:00:00Z'
    PlatformOAuthError:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          example: unauthorized
        message:
          type: string
          example: Missing or invalid API key.
    PlatformToken:
      type: object
      description: Stored platform token details.
      properties:
        tokenId:
          type: string
          example: tok_01HXYZ
        platformUserId:
          type: string
          example: x_12345
        username:
          type: string
          example: '@acmecorp'
        scopes:
          type: array
          items:
            type: string
          example:
          - tweet.read
          - tweet.write
        expiresAt:
          type:
          - string
          - 'null'
          format: date-time
          example: '2025-01-01T00:00:00Z'
        lastUsedAt:
          type:
          - string
          - 'null'
          format: date-time
          example: '2024-01-10T09:05:00Z'
        status:
          type: string
          example: active
    OAuthRedirect:
      type: object
      description: Authorization URL and CSRF state for the OAuth redirect flow.
      properties:
        authorizationUrl:
          type: string
          example: https://www.linkedin.com/oauth/v2/authorization?client_id=...&state=abc123
        state:
          type: string
          example: abc123
    PlatformAuthStatus:
      type: object
      description: Connection status for a single platform on a brand.
      properties:
        connected:
          type: boolean
          example: true
        tokenExpired:
          type: boolean
          example: false
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/PlatformAccount'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'API key as `Authorization: Bearer sk-social-...`'
    apiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: 'API key as `x-api-key: sk-social-...`'