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

# Invite a team member

> Invite a person to a workspace's team by email, with a role.

> [!NOTE]
>
> Needs `team:create`, and a role in the workspace that can invite: owners and managers can. See [Permissions](https://docs.postsyncer.com/essentials/authentication.md#permissions).

Invites the person at `email` to the workspace as `role`, a `name` from `roles` in [the team list](https://docs.postsyncer.com/api-reference/team/list.md). PostSyncer keeps the email address, makes an account for it when there is none, and sends that person one invitation email with a link that works for 7 days. Until they accept, they are in the team with `is_active: false`. It is what the team page in the app does.

To take the invitation back, [remove them](https://docs.postsyncer.com/api-reference/team/remove.md): the link stops working, and an account made for the invitation stays. To send it again, [update them](https://docs.postsyncer.com/api-reference/team/update.md) with `resend_invitation: true`.

Team members are on paid plans: on Free the team is one person. When the workspace owner is on Free, nothing is saved, no email goes out, and the answer is `403` with `error: plan_limit_reached` and `limit: team`. The owner's key gets `upgrade_url` and `upgrade_plan`; anyone else's is told to ask the owner (`owner_plan: true`, no `upgrade_url`).

The workspace is checked first, then your role, then the plan, then the body, then the day's invitations.

One invitation goes to an address for each workspace a day, new or sent again, and taking one back doesn't give it back. A workspace sends 50 new invitations a day. Invitations sent from the app's Team page count toward the same limits. Past either, nothing is saved or sent, and the answer is `429` with `error: rate_limited`, a `Retry-After` header and the wait in the message.

## Errors

| Status | `error` | When | Retry? |
| - | - | - | - |
| 401 | | No API key, or not a valid one. | No: fix the key. |
| 403 | | The key lacks `team:create`, or its user is inactive. | No: grant it in Settings → API. |
| 403 | | Your role in the workspace can't invite. | No. |
| 403 | `plan_limit_reached` | The workspace owner is on Free (`limit: team`). | After the owner upgrades. |
| 422 | | No `email` or `role`, an address that is in the team already, a role that isn't one of `roles`, or a workspace the key can't reach. | No: fix the request. |
| 429 | `rate_limited` | An invitation to this workspace already went to this address today, or the workspace sent 50 today, from the API or the app's Team page. Nothing was saved or sent. | Yes, after `Retry-After` seconds. |
| 429 | | More than 60 requests a minute. | Yes, after `Retry-After` seconds. |

## Related

* [List team members](https://docs.postsyncer.com/api-reference/team/list.md): the team and the roles.
* [Remove a team member](https://docs.postsyncer.com/api-reference/team/remove.md): cancel the invitation.


## OpenAPI

````yaml POST /team-members
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:
  /team-members:
    post:
      tags:
        - Team
      summary: Invite a team member
      description: >-
        Needs `team:create`. Your role in the workspace must also let you
        invite: owners and managers can. Invites a person to the workspace by
        email with a role, on paid plans. PostSyncer keeps the email address,
        makes an account for it when there is none, and sends that person one
        invitation email with a link that works for 7 days. They are in the team
        with `is_active: false` until they accept. [Remove a team
        member](/api-reference/team/remove) cancels the invitation, and an
        account made for it stays. On Free the team is one person, so an
        invitation is refused with `403` (`plan_limit_reached`, `limit: team`).
        One invitation goes to an address for each workspace a day, new or sent
        again, and a workspace sends 50 new ones a day. Invitations sent from
        the app's Team page count toward the same limits. Past either, nothing
        is sent and the answer is `429` with `error: rate_limited`.
      operationId: inviteTeamMember
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workspace_id
                - email
                - role
              properties:
                workspace_id:
                  type: integer
                  description: The workspace. It must be one the key can reach.
                email:
                  type: string
                  format: email
                  maxLength: 255
                  description: >-
                    The person's email address. It must not be in the
                    workspace's team already.
                role:
                  type: string
                  enum:
                    - APP_MANAGER
                    - APP_CONTENT_MANAGER
                    - APP_CONTENT_CREATOR
                    - APP_CLIENT
                  description: >-
                    Their role: a `name` from `roles` in the team list. Owner is
                    not one of them: a workspace has one owner.
            examples:
              default:
                summary: A content creator
                value:
                  workspace_id: 12
                  email: mara@haldencoffee.com
                  role: APP_CONTENT_CREATOR
      responses:
        '201':
          description: >-
            The invitation: the person, with `is_active: false` until they
            accept.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TeamMember'
              examples:
                default:
                  summary: Invited
                  value:
                    id: 58
                    workspace_id: 12
                    name: mara
                    email: mara@haldencoffee.com
                    avatar_url: >-
                      https://ui-avatars.com/api/?name=mara&color=FFFFFF&background=6366F1
                    role:
                      name: APP_CONTENT_CREATOR
                      label: Content Creator
                      description: >-
                        Can create and edit posts, products, campaigns, labels,
                        snippets, comments, and manage media library. Can view
                        analytics and calendar. Has view access to accounts but
                        cannot manage them. Posts require approval before
                        publishing.
                      has_approval_permission: false
                      has_publishing_permission: false
                    is_active: false
        '401':
          $ref: '#/components/responses/Unauthorized401'
        '403':
          description: >-
            The key lacks `team:create`, its user is inactive, your role in the
            workspace can't invite, or the workspace owner is on Free
            (`plan_limit_reached`, `limit: team`).
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/PlanLimitError'
                  - $ref: '#/components/schemas/Error'
              examples:
                missing_permission:
                  summary: The key lacks team:create
                  value:
                    message: >-
                      This API key does not have the "team:create" permission.
                      Edit the key in PostSyncer under Settings → API to grant
                      it.
                role:
                  summary: The role can't create team members
                  value:
                    message: >-
                      Your role in the workspace "Halden Coffee" does not allow
                      you to create team members. Ask the workspace owner or a
                      manager to do it, or to change your role.
                team_paid:
                  summary: 'Free: the team is one person'
                  value:
                    message: >-
                      Team members are on paid plans. Upgrade to invite your
                      team.
                    owner_plan: false
                    error: plan_limit_reached
                    limit: team
                    used: 0
                    allowed: 0
                    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
                team_paid_member:
                  summary: 'Free, asked by a manager: the owner must upgrade'
                  value:
                    message: >-
                      Team members are on paid plans, and this workspace's owner
                      is on the free plan. Only the workspace owner can upgrade,
                      so ask them to.
                    owner_plan: true
                    error: plan_limit_reached
                    limit: team
                    used: 0
                    allowed: 0
                    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 email address is in the team
            already, or the workspace isn't one the key can reach.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
              examples:
                email:
                  summary: No email
                  value:
                    message: The email field is required.
                    errors:
                      email:
                        - The email field is required.
                email_taken:
                  summary: In the team already
                  value:
                    message: >-
                      This email address is already in use in this workspace.
                      Please choose a different email address.
                    errors:
                      email:
                        - >-
                          This email address is already in use in this
                          workspace. Please choose a different email address.
                role:
                  summary: Not a role someone can be invited as
                  value:
                    message: The selected role is invalid.
                    errors:
                      role:
                        - The selected role is invalid.
                workspace_id:
                  summary: Not a workspace the key can reach
                  value:
                    message: Invalid workspace ID.
                    errors:
                      workspace_id:
                        - Invalid workspace ID.
        '429':
          description: >-
            An invitation to this workspace already went to this address today,
            new or sent again, or the workspace sent 50 today, from the API or
            the app's Team page (`error: rate_limited`): nothing was saved or
            sent. Or more than 60 requests in a minute from this key's user
            (`Too Many Attempts.`, with the `X-RateLimit-*` headers). Nothing
            was done. 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:
                address:
                  summary: This address was invited today
                  value:
                    error: rate_limited
                    message: >-
                      An invitation to this workspace already went to this
                      address today. You can send another in 24 hours.
                workspace:
                  summary: 50 invitations today
                  value:
                    error: rate_limited
                    message: >-
                      This workspace sent 50 invitations today. You can send
                      more in 6 hours.
                too_many_attempts:
                  summary: Too many requests
                  value:
                    message: Too Many Attempts.
components:
  schemas:
    TeamMember:
      type: object
      description: A teammate, or someone invited who hasn't accepted yet.
      required:
        - id
        - workspace_id
        - name
        - email
        - avatar_url
        - role
        - is_active
      properties:
        id:
          type: integer
          description: 'The person''s account id: the `{id}` to update or remove them.'
        workspace_id:
          type: integer
        name:
          type: string
          description: >-
            Their name. Until they set one, it is the email address's part
            before the @.
        email:
          type: string
          format: email
        avatar_url:
          type: string
          description: Their photo, or a picture of their initials.
        role:
          $ref: '#/components/schemas/TeamRole'
        is_active:
          type: boolean
          description: False while the invitation isn't accepted yet.
    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 after their 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
    TeamRole:
      type: object
      description: A role in a workspace.
      required:
        - name
        - label
        - description
        - has_approval_permission
        - has_publishing_permission
      properties:
        name:
          type: string
          enum:
            - APP_OWNER
            - APP_MANAGER
            - APP_CONTENT_MANAGER
            - APP_CONTENT_CREATOR
            - APP_CLIENT
          description: >-
            The role to send as `role`. `APP_OWNER` is the workspace owner's,
            and is never given.
        label:
          type: string
          description: The role as the app names it.
        description:
          type: string
          description: What the role can do.
        has_approval_permission:
          type: boolean
          description: Whether the role can approve posts.
        has_publishing_permission:
          type: boolean
          description: Whether the role can publish without approval.
  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.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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