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

# Create a connect link

> Get a link where someone connects social accounts to a workspace without a PostSyncer login.

> [!NOTE]
>
> Needs `accounts:create`, and a role in the workspace that can add accounts (owner or manager). See [Permissions](/docs/essentials/authentication.md#permissions).

Makes a link where a person connects accounts of one network to the workspace. They don't need a PostSyncer login: they open the link, sign in to the network and pick the accounts to add. Use it for your own account on another device, or send it to a client who owns the account. It is the same link as **Accounts → Invite** in the app.

A link is for one network and works for one connect (one sign-in, any of its accounts), then stops. It expires after 7 days (`expires_at`). Once the person has connected, the accounts show up in [List accounts](/docs/api-reference/accounts/list.md), and an [`account.connected`](/docs/api-reference/webhooks/overview#other-events) event is sent.

For `telegram`, the page has an **Open Telegram** button: the person taps Start in the chat with @PostSyncerOfficialBot, then **Choose a channel**, and picks one. Telegram adds the bot to it as an admin that can post, and the channel is connected. Public and private channels both work. A public channel the bot is already an admin of can also be connected by typing its @username on the page.

At the plan's account limit no link is made: the answer is `403` `plan_limit_reached`, `limit: accounts`, so nobody signs in for nothing. On the Free plan the limit is 2 accounts. The workspace owner gets `upgrade_url` and `upgrade_plan` (the smallest plan with room for more accounts); a member is told to ask the owner (`owner_plan: true`, no `upgrade_url`). The MCP tool `create-account-connect-link` does the same; at the limit it gives the reason in words, with a link to the pricing page and no prices. When the workspace owner's own key or connector reaches the Free plan's 2 accounts, the link is `https://postsyncer.com/pricing?limit=accounts`, a page that says what was reached and opens the plan that lifts it in the app. In someone else's workspace, or at a paid plan's limit, it is the plain `https://postsyncer.com/pricing`. A key with `billing:create`, used by the workspace owner, gets a line offering a pay link with `create-billing-link` in place of the pricing link.

## Errors

| Status | `error` | When | Retry? |
| - | - | - | - |
| 401 | | No API key, or not a valid one. | No: fix the key. |
| 403 | | The key lacks `accounts:create`, or its user is inactive. | No: grant it in Settings → API. |
| 403 | | Your role in the workspace can't add accounts. | No. |
| 403 | `plan_limit_reached` | The plan's accounts are all connected (`limit: accounts`). | After an upgrade, or after disconnecting an account. |
| 422 | | The workspace isn't one the key can reach, the network can't be connected with a link, or Mastodon has no `mastodon_instance`. | No: fix the request. |
| 429 | | More than 60 requests a minute. | Yes, after `Retry-After` seconds. |

## Related

* [List accounts](/docs/api-reference/accounts/list.md): the accounts once they are connected.
* [List workspaces](/docs/api-reference/workspaces/list.md): the `workspace_id` to send.


## OpenAPI

````yaml POST /accounts/connect-links
openapi: 3.0.3
info:
  title: PostSyncer API
  description: >-
    Post to 12 social networks from your code: posts, media, comments,
    analytics, webhooks and more.
  version: 1.0.0
servers:
  - url: https://postsyncer.com/api/v1
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: The workspaces the key can reach.
  - name: Accounts
    description: Connected social accounts, links to connect more, and disconnecting them.
  - name: Posts
    description: Drafts, scheduled and published posts, approvals and a post's history.
  - name: Post settings
    description: A post's auto-plug, comment moderation and contact collection.
  - name: Media
    description: >-
      The media library: file uploads, URL imports, and reading videos and
      social posts' files.
  - name: Folders
    description: Folders that organise the media library.
  - name: Comments
    description: >-
      Comments on your posts: reading, replying, editing, hiding, deleting and
      syncing them.
  - name: Reviews
    description: Google Business Profile reviews and your replies to them.
  - name: Analytics
    description: Workspace, account and post performance.
  - name: Brand
    description: >-
      A workspace's brand: identity, voice, look, accounts, competitors,
      learnings and rules.
  - name: Labels
    description: Labels used to tag posts.
  - name: Campaigns
    description: Campaigns used to group posts.
  - name: Snippets
    description: Saved snippets and hashtag groups to drop into posts.
  - name: Webhooks
    description: Signed webhook endpoints that get your notification events.
  - name: Billing
    description: >-
      The owner's plan, invoices and the links that pay for, change or cancel
      it.
  - name: Team
    description: A workspace's teammates and invitations, and their roles.
  - name: Notifications
    description: >-
      Your bell and notification settings, and the workspace's Slack, Discord
      and Telegram channels.
  - name: Blog-to-social
    description: Blog feeds that turn a workspace's new articles into posts.
  - name: Products
    description: Products the workspace's posts can promote.
  - name: Contacts
    description: People who commented on the workspace's posts, and the lists they are on.
  - name: Profile
    description: 'The key''s user: their name and sign-in email.'
  - name: API keys
    description: 'Your API keys: listing and deleting them.'
  - name: Agent sign-up
    description: >-
      An AI agent signs a person up with a code emailed to them, and gets their
      first key. No key needed.
paths:
  /accounts/connect-links:
    post:
      tags:
        - Accounts
      summary: Create a connect link
      description: >-
        Needs `accounts:create`. Your role in the workspace must also let you
        add accounts. Makes a link where someone connects accounts of one
        network to the workspace without a PostSyncer login: you on another
        device, or a client who owns the account. They sign in to the network on
        the link's page. A link is for one network, works for one connect and
        expires after 7 days. At the plan's account limit no link is made: the
        answer is `403` `plan_limit_reached` with `limit: accounts`. On the Free
        plan the limit is 2 accounts in all.
      operationId: createAccountConnectLink
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workspace_id
                - provider
              properties:
                workspace_id:
                  type: integer
                  description: The workspace the accounts are added to.
                provider:
                  type: string
                  enum:
                    - twitter
                    - linkedin
                    - instagram
                    - facebook
                    - tiktok
                    - youtube
                    - threads
                    - pinterest
                    - bluesky
                    - telegram
                    - mastodon
                    - google_business
                  description: The network to connect.
                mastodon_instance:
                  type: string
                  nullable: true
                  maxLength: 255
                  description: >-
                    Mastodon only, and needed for it: the server the account is
                    on, like `mastodon.social`.
            examples:
              default:
                summary: A TikTok link
                value:
                  workspace_id: 12
                  provider: tiktok
              mastodon:
                summary: A Mastodon link
                value:
                  workspace_id: 12
                  provider: mastodon
                  mastodon_instance: mastodon.social
      responses:
        '201':
          description: The link.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConnectLink'
              examples:
                default:
                  summary: A TikTok link
                  value:
                    url: >-
                      https://app.postsyncer.com/connect/invite?token=CONNECT_TOKEN&provider=tiktok
                    provider: tiktok
                    workspace_id: 12
                    mastodon_instance: null
                    expires_at: '2030-03-22T09:00:00+00:00'
                mastodon:
                  summary: A Mastodon link
                  value:
                    url: >-
                      https://app.postsyncer.com/connect/invite?token=CONNECT_TOKEN&provider=mastodon
                    provider: mastodon
                    workspace_id: 12
                    mastodon_instance: mastodon.social
                    expires_at: '2030-03-22T09:00:00+00:00'
        '401':
          $ref: '#/components/responses/Unauthorized401'
        '403':
          description: >-
            The key lacks `accounts:create`, its user is inactive, your role in
            the workspace can't add accounts, or the plan's account limit is
            reached (`plan_limit_reached`). No link was made.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/PlanLimitError'
                  - $ref: '#/components/schemas/Error'
              examples:
                missing_permission:
                  summary: The key lacks accounts:create
                  value:
                    message: >-
                      This API key does not have the "accounts:create"
                      permission. Edit the key in PostSyncer under Settings →
                      API to grant it.
                role:
                  summary: The role can't add accounts
                  value:
                    message: >-
                      Your role in the workspace "Halden Coffee" does not allow
                      you to create accounts. Ask the workspace owner or a
                      manager to do it, or to change your role.
                accounts_full:
                  summary: 'Free: the 2 accounts are connected'
                  value:
                    message: >-
                      You've connected 2 of 2 accounts on the free plan. Upgrade
                      to connect more.
                    owner_plan: false
                    error: plan_limit_reached
                    limit: accounts
                    used: 2
                    allowed: 2
                    plan: free
                    resets_at: null
                    upgrade_url: >-
                      https://app.postsyncer.com/dashboard?action=settings&section=billing
                    upgrade_plan:
                      plan: starter-v2
                      name: Starter
                      monthly_price: 29
                      yearly_price: 24
                      accounts: 10
                      accounts_per_workspace: false
                accounts_full_member:
                  summary: 'Free, asked by a member: the owner must upgrade'
                  value:
                    message: >-
                      This workspace's owner has connected 2 of 2 accounts on
                      the free plan. Only the workspace owner can upgrade, so
                      ask them to.
                    owner_plan: true
                    error: plan_limit_reached
                    limit: accounts
                    used: 2
                    allowed: 2
                    plan: free
                    resets_at: null
                    upgrade_url: null
                    upgrade_plan: null
                inactive_account:
                  summary: The key's user is inactive
                  value:
                    message: Your account is inactive.
        '422':
          description: >-
            A field is missing or wrong, the workspace isn't one the key can
            reach, the network can't be connected with a link, or Mastodon has
            no `mastodon_instance`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
              examples:
                workspace_id:
                  summary: Not a workspace the key can reach
                  value:
                    message: Invalid workspace ID.
                    errors:
                      workspace_id:
                        - Invalid workspace ID.
                provider:
                  summary: A network a link can't connect
                  value:
                    message: >-
                      This platform cannot be connected with a link. Use one of:
                      twitter, mastodon, tiktok, facebook, instagram, youtube,
                      google_business, pinterest, threads, telegram, linkedin,
                      bluesky.
                    errors:
                      provider:
                        - >-
                          This platform cannot be connected with a link. Use one
                          of: twitter, mastodon, tiktok, facebook, instagram,
                          youtube, google_business, pinterest, threads,
                          telegram, linkedin, bluesky.
                mastodon_instance:
                  summary: Mastodon without its server
                  value:
                    message: >-
                      Mastodon needs the server the account is on, e.g.
                      mastodon.social.
                    errors:
                      mastodon_instance:
                        - >-
                          Mastodon needs the server the account is on, e.g.
                          mastodon.social.
                missing:
                  summary: Nothing sent
                  value:
                    message: The workspace id field is required. (and 1 more error)
                    errors:
                      workspace_id:
                        - The workspace id field is required.
                      provider:
                        - The provider field is required.
        '429':
          $ref: '#/components/responses/RateLimited429'
components:
  schemas:
    ConnectLink:
      type: object
      description: A link where someone connects accounts of one network to the workspace.
      required:
        - url
        - provider
        - workspace_id
        - mastodon_instance
        - expires_at
      properties:
        url:
          type: string
          description: >-
            The page the person opens. They sign in to the network there; no
            PostSyncer login is needed.
        provider:
          type: string
          enum:
            - twitter
            - linkedin
            - instagram
            - facebook
            - tiktok
            - youtube
            - threads
            - pinterest
            - bluesky
            - telegram
            - mastodon
            - google_business
        workspace_id:
          type: integer
        mastodon_instance:
          type: string
          nullable: true
          description: The Mastodon server; null for other networks.
        expires_at:
          type: string
          format: date-time
          description: 'When the link stops working: 7 days after it was made.'
    PlanLimitError:
      type: object
      description: >-
        403: the workspace owner's plan doesn't include this, or its limit is
        used up. Nothing was saved. `limit` says which.
      required:
        - message
        - owner_plan
        - error
        - limit
        - used
        - allowed
        - plan
        - resets_at
        - upgrade_url
        - upgrade_plan
      properties:
        message:
          type: string
          description: What the plan doesn't allow, and what to do.
        owner_plan:
          type: boolean
          description: >-
            True when the plan is someone else's (the key's user isn't the
            workspace owner): only the owner can change it, and `message` says
            to ask them.
        error:
          type: string
          enum:
            - plan_limit_reached
        limit:
          type: string
          enum:
            - accounts
            - posts
            - workspaces
            - team
            - labels
            - campaigns
            - ai
            - moderation
            - contacts
            - crm
            - products
            - analytics
            - free_accounts
          description: >-
            What ran out: `accounts`, `posts` (this month's posts) and
            `workspaces` are counted; `free_accounts` is a post to an account
            other than the 2 a Free owner posts to outside a first week (the
            account's `plan_allows_posting` is `false`); `team`, `labels`,
            `campaigns`, `ai`, `moderation` (comment moderation), `contacts`
            (contact collection), `crm` (contacts and contact lists) and
            `products` are on paid plans only. `analytics` (more than the last 7
            days) comes from the app only: API v1 and MCP don't refuse analytics
            on Free, they keep the numbers to the last 7 days, outside an
            owner's first week, and say so in `range_limited`.
        used:
          type: integer
          description: How much of the limit is used; 0 for a paid-plan feature.
        allowed:
          type: integer
          description: What the plan allows; 0 for a paid-plan feature.
        plan:
          type: string
          description: The owner's plan, like `free`.
        resets_at:
          type: string
          format: date-time
          nullable: true
          description: When a monthly limit starts again; null for the others.
        upgrade_url:
          type: string
          nullable: true
          description: Where the owner picks a plan; null when the plan is someone else's.
        upgrade_plan:
          type: object
          nullable: true
          description: >-
            The smallest plan that lifts the limit; null when the plan is
            someone else's or no plan lifts it.
          required:
            - plan
            - name
            - monthly_price
            - yearly_price
            - accounts
            - accounts_per_workspace
          properties:
            plan:
              type: string
              description: The plan's key.
            name:
              type: string
              description: The plan's name.
            monthly_price:
              type: integer
            yearly_price:
              type: integer
            accounts:
              type: integer
              description: The social accounts the plan includes.
            accounts_per_workspace:
              type: boolean
              description: True when `accounts` counts per workspace rather than in all.
    Error:
      type: object
      description: >-
        An error answer. Every one has `message`, in plain words; some add an
        `error` code and fields of their own.
      required:
        - message
      properties:
        message:
          type: string
          description: What went wrong and what to do about it.
        error:
          type: string
          description: >-
            A code a few errors add, such as `rate_limited`. See [Handle
            errors](/essentials/error-handling#answers-with-an-error-code).
    ValidationError:
      type: object
      description: '422: the request didn''t pass validation, and nothing changed.'
      required:
        - message
        - errors
      properties:
        message:
          type: string
          description: >-
            The first error and, when there are more, how many: `(and 1 more
            error)`, `(and 2 more errors)`.
        errors:
          type: object
          description: >-
            The messages, by field. A field inside a list is named with dots:
            `accounts.0.id`.
          additionalProperties:
            type: array
            items:
              type: string
  responses:
    Unauthorized401:
      description: No API key, or not a valid one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            unauthenticated:
              summary: No valid API key
              value:
                message: Unauthenticated.
    RateLimited429:
      description: >-
        More than 60 requests in a minute from this key's user (the API and the
        MCP server share the count). Wait `Retry-After` seconds.
      headers:
        Retry-After:
          description: Seconds until requests are allowed again.
          schema:
            type: integer
        X-RateLimit-Limit:
          description: Requests allowed a minute.
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: Requests left this minute.
          schema:
            type: integer
        X-RateLimit-Reset:
          description: When requests are allowed again, as a Unix timestamp.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            too_many_attempts:
              summary: Too many requests
              value:
                message: Too Many Attempts.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.