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

# Draft replies with AI for many items

> Have PostSyncer AI draft replies for up to 50 inbox items at once, in the background.

> [!NOTE]
>
> Needs `comments:update`. Your role in the workspace must also let you edit public comments and use the workspace's AI; a Client's doesn't. See [Permissions](/docs/essentials/authentication.md#permissions).

Asks PostSyncer AI for a draft on each item in `ids`, 1 to 50 of the workspace in `workspace_id`'s items, as **Draft replies** does in the app. An id sent twice counts once.

Only an open item with no draft is drafted. The answer sorts the ids:

| Key | What's in it |
| - | - |
| `data.drafting` | The items a draft is being written for, in the order sent. |
| `data.skipped` | The workspace's items left alone, and not charged: done, drafted already, nobody can answer it from PostSyncer (a comment hidden or deleted on its network, a mention the network takes no reply to from apps), or a review on the Free plan. |
| `data.not_found` | Ids that aren't the workspace's items, or whose comment, mention or review is gone. |

The drafts are written in the background, one after another, each the way [Draft a reply with AI](/docs/api-reference/inbox/draft.md) writes one (`draft.by` `ai`), and each spends 1 of the workspace owner's AI credits. It answers `402` when no credit is left, and the drafts stop when the credits run out. An item that gets a draft or an answer meanwhile keeps it, and isn't charged. Nothing is sent.

It answers `202` with `Writing 2 drafts.` (or `Writing 1 draft.`), or `200` with `Nothing to draft.` when nothing is left to draft, and then nothing is asked for. To see the drafts, [list the inbox](/docs/api-reference/inbox/list.md) with `ready=true` after a minute.

On the Free plan, reviews are skipped while other items are drafted. When every item it would draft is a review, it answers `403` (`plan_limit_reached`, `limit: ai`): `AI review replies are part of the paid plans. Upgrade to use them.`

## Errors

| Status | `error` | When | Retry? |
| - | - | - | - |
| 401 | | No API key, or not a valid one. | No: fix the key. |
| 402 | `insufficient_credits` | The workspace owner has no AI credit left. Nothing was asked for. | After credits are added, or they come back on Free. |
| 403 | | The key lacks `comments:update`, its user is inactive, or your role can't edit public comments or use the workspace's AI. | No: grant it in Settings → API. |
| 403 | `plan_limit_reached` | On the Free plan, every item it would draft is a review (`limit: ai`). | After an upgrade. |
| 422 | | `workspace_id` is missing or not one the key can reach, or `ids` is missing, empty, over 50 or holds something that isn't a whole number. | No: fix the request. |
| 429 | | More than 60 requests a minute. | Yes, after `Retry-After` seconds. |

## Related

* [Draft a reply with AI](/docs/api-reference/inbox/draft.md): one item, answered with its draft.
* [Work through the Inbox](/docs/guides/inbox.md): the routine.


## OpenAPI

````yaml POST /inbox/draft
openapi: 3.0.3
info:
  title: PostSyncer API
  description: >-
    Post to 14 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: Inbox
    description: >-
      Comments, mentions and Google reviews in one list: what needs a reply,
      drafts, who answers what, team notes, and replies to mentions.
  - 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:
  /inbox/draft:
    post:
      tags:
        - Inbox
      summary: Draft replies with AI for many items
      description: >-
        Needs `comments:update`. Your role in the workspace must also let you
        edit public comments and use the workspace's AI; a Client's doesn't.
        Asks PostSyncer AI for a draft on up to 50 of the workspace's items at
        once, as Draft replies does in the app. Only an open item with no draft
        is drafted. The rest are listed in `skipped`: done, drafted already,
        nobody can answer it from PostSyncer (a comment hidden or deleted on its
        network, a mention the network takes no reply to from apps), or, on the
        Free plan, a review. An id that isn't one of the workspace's items is
        listed in `not_found`. The drafts are written in the background, one
        after another in the order sent, each as [Draft a reply with
        AI](/api-reference/inbox/draft) writes one (`by: ai`), and each spends 1
        of the workspace owner's AI credits. It answers `402` when no credit is
        left, and the drafts stop when the credits run out. An item that gets a
        draft or an answer meanwhile keeps it, and is not charged. Nothing is
        sent. With nothing to draft it answers `200` and asks for nothing. To
        see the drafts, list the inbox with `ready=true` after a minute. On the
        Free plan, when every item it would draft is a review, it answers `403`
        (`plan_limit_reached`, `limit: ai`).
      operationId: draftInboxItems
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workspace_id
                - ids
              properties:
                workspace_id:
                  type: integer
                  description: The workspace. It must be one the key can reach.
                ids:
                  type: array
                  minItems: 1
                  maxItems: 50
                  items:
                    type: integer
                  description: >-
                    1 to 50 items' ids, in the order to draft them. An id sent
                    twice counts once.
            examples:
              default:
                summary: Three items
                value:
                  workspace_id: 12
                  ids:
                    - 8812
                    - 8815
                    - 8820
      responses:
        '200':
          description: >-
            Nothing to draft: every item was skipped or not found. Nothing was
            asked for or charged.
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - data
                properties:
                  message:
                    type: string
                    description: >-
                      `Writing 2 drafts.`, `Writing 1 draft.`, or `Nothing to
                      draft.`
                  data:
                    type: object
                    required:
                      - drafting
                      - skipped
                      - not_found
                    properties:
                      drafting:
                        type: array
                        items:
                          type: integer
                        description: >-
                          The items a draft is being written for, in the order
                          sent.
                      skipped:
                        type: array
                        items:
                          type: integer
                        description: >-
                          The workspace's items left alone and not charged:
                          done, drafted already, nobody can answer it from
                          PostSyncer, or a review on the Free plan.
                      not_found:
                        type: array
                        items:
                          type: integer
                        description: >-
                          The ids that aren't the workspace's items, or whose
                          comment, mention or review is gone.
              examples:
                default:
                  summary: Nothing left to draft
                  value:
                    message: Nothing to draft.
                    data:
                      drafting: []
                      skipped:
                        - 8812
                      not_found: []
        '202':
          description: The drafts are on their way.
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - data
                properties:
                  message:
                    type: string
                    description: >-
                      `Writing 2 drafts.`, `Writing 1 draft.`, or `Nothing to
                      draft.`
                  data:
                    type: object
                    required:
                      - drafting
                      - skipped
                      - not_found
                    properties:
                      drafting:
                        type: array
                        items:
                          type: integer
                        description: >-
                          The items a draft is being written for, in the order
                          sent.
                      skipped:
                        type: array
                        items:
                          type: integer
                        description: >-
                          The workspace's items left alone and not charged:
                          done, drafted already, nobody can answer it from
                          PostSyncer, or a review on the Free plan.
                      not_found:
                        type: array
                        items:
                          type: integer
                        description: >-
                          The ids that aren't the workspace's items, or whose
                          comment, mention or review is gone.
              examples:
                default:
                  summary: Two drafts on their way
                  value:
                    message: Writing 2 drafts.
                    data:
                      drafting:
                        - 8815
                        - 8820
                      skipped:
                        - 8812
                      not_found: []
        '401':
          $ref: '#/components/responses/Unauthorized401'
        '402':
          description: >-
            No AI credit is left for the workspace owner. Nothing was asked for
            or charged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InsufficientCreditsError'
              examples:
                insufficient_credits:
                  summary: Not enough credits
                  value:
                    message: >-
                      Not enough AI credits: this needs 1 and you have 0. Top up
                      your credits or upgrade your plan to continue.
                    error: insufficient_credits
                    credits_required: 1
                    credits_available: 0
        '403':
          description: >-
            The key lacks `comments:update`, its user is inactive, your role in
            the workspace can't edit public comments or use its AI, or on the
            Free plan every item it would draft is a review
            (`plan_limit_reached`, `limit: ai`).
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/PlanLimitError'
                  - $ref: '#/components/schemas/Error'
              examples:
                missing_permission:
                  summary: The key lacks comments:update
                  value:
                    message: >-
                      This API key does not have the "comments:update"
                      permission. Edit the key in PostSyncer under Settings →
                      API to grant it.
                inactive_account:
                  summary: The key's user is inactive
                  value:
                    message: Your account is inactive.
                role:
                  summary: Your role can't edit public comments
                  value:
                    message: >-
                      Your role in the workspace "Halden Coffee" does not allow
                      you to edit public comments. Ask the workspace owner or an
                      admin to do it, or to change your role.
                role_ai:
                  summary: Your role can't use the workspace's AI
                  value:
                    message: >-
                      Your role in the workspace "Halden Coffee" does not allow
                      you to use AI. Ask the workspace owner or an admin to do
                      it, or to change your role.
                ai_paid:
                  summary: 'Free: AI review replies are on paid plans'
                  value:
                    message: >-
                      AI review replies are part of the paid plans. Upgrade to
                      use them.
                    owner_plan: false
                    error: plan_limit_reached
                    limit: ai
                    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
        '422':
          description: >-
            `workspace_id` is missing or not one the key can reach, or `ids` is
            missing, empty, over 50 or holds something that isn't a whole
            number.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
              examples:
                workspace_id_missing:
                  summary: No workspace_id
                  value:
                    message: The workspace id field is required.
                    errors:
                      workspace_id:
                        - The workspace id field is required.
                workspace_id_invalid:
                  summary: A workspace the key can’t reach
                  value:
                    message: Invalid workspace ID.
                    errors:
                      workspace_id:
                        - Invalid workspace ID.
                too_many:
                  summary: Over 50 ids
                  value:
                    message: The ids field must not have more than 50 items.
                    errors:
                      ids:
                        - The ids field must not have more than 50 items.
                not_a_number:
                  summary: An id that isn't a number
                  value:
                    message: The ids.0 field must be an integer.
                    errors:
                      ids.0:
                        - The ids.0 field must be an integer.
        '429':
          $ref: '#/components/responses/RateLimited429'
components:
  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.
  schemas:
    InsufficientCreditsError:
      type: object
      description: '402: the AI credits left don''t cover this.'
      required:
        - message
        - error
        - credits_required
        - credits_available
      properties:
        message:
          type: string
          description: What it needs, what is left, and what to do.
        error:
          type: string
          enum:
            - insufficient_credits
        credits_required:
          type: integer
          description: The credits this needs.
        credits_available:
          type: integer
          description: The credits left.
        free_plan:
          type: boolean
          enum:
            - true
          description: Only on the Free plan, whose credits come back each month.
        resets_at:
          type: string
          format: date-time
          description: 'Only on the Free plan: when its credits come back.'
    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
            - client_signoff
          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` and `client_signoff` (client sign-off and client
            reviewers) 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
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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