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

> ## Agent Instructions
> Postploy's MCP server for posting is https://api.postploy.com/mcp and signs in with OAuth. The REST API base URL is https://api.postploy.com/public/v1 and takes an API key as a Bearer token. The API calls channels accounts.

# Count posts

> How many posts are in each status group, plus how many are blocked by a channel that needs reconnecting.



## OpenAPI

````yaml /openapi.yaml get /posts/counts
openapi: 3.1.0
info:
  title: Postploy API
  version: '1'
  description: Schedule and manage social media posts in your Postploy team.
  contact:
    name: Postploy support
    email: support@postploy.com
servers:
  - url: https://api.postploy.com/public/v1
security:
  - apiKey: []
tags:
  - name: Channels
  - name: Posts
  - name: Approvals
  - name: Media
  - name: Trash
  - name: Webhooks
paths:
  /posts/counts:
    get:
      tags:
        - Posts
      summary: Count posts
      description: >-
        How many posts are in each status group, plus how many are blocked by a
        channel that needs reconnecting.
      operationId: countPosts
      parameters:
        - name: from
          in: query
          description: >-
            Start of a time window, ISO 8601 with an offset. Give `from` and
            `to` together.
          schema:
            type: string
            format: date-time
        - name: to
          in: query
          description: End of the time window.
          schema:
            type: string
            format: date-time
        - name: accountId
          in: query
          description: Only count posts to these channels.
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
              format: uuid
      responses:
        '200':
          description: Counts by status group.
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    $ref: '#/components/schemas/PostCounts'
              example:
                data:
                  draft: 3
                  approval: 2
                  scheduled: 14
                  published: 41
                  failed: 1
                  blocked: 0
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  schemas:
    PostCounts:
      type: object
      required:
        - draft
        - approval
        - scheduled
        - published
        - failed
        - blocked
      properties:
        draft:
          type: integer
        approval:
          type: integer
        scheduled:
          type: integer
        published:
          type: integer
        failed:
          type: integer
        blocked:
          type: integer
          description: Posts waiting on a channel that needs reconnecting.
    Error:
      type: object
      required:
        - statusCode
        - message
        - errors
        - timestamp
        - route
      properties:
        statusCode:
          type: integer
        message:
          type: string
          description: What went wrong, in plain words. Safe to show to people.
        errors:
          type:
            - array
            - 'null'
          description: Every problem, when there's more than one place to look.
          items:
            type: object
            properties:
              message:
                type: string
              path:
                type: array
                description: Where the problem is, such as `["posts", 0, "scheduledAt"]`.
                items:
                  type:
                    - string
                    - integer
              cause:
                type: string
              code:
                type: string
                description: >-
                  On plan limits, `PLATFORM_LIMIT_REACHED` or
                  `TOTAL_LIMIT_REACHED`.
              platform:
                type: string
        timestamp:
          type: string
          format: date-time
        route:
          type: string
  responses:
    BadRequest:
      description: >-
        The request is invalid, or a post breaks its platform's rules. `message`
        gives the first problem, and `errors` lists every one with its `path`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 400
            message: Scheduled date and time must be in the future
            errors:
              - message: Scheduled date and time must be in the future
                path:
                  - posts
                  - 0
                  - scheduledAt
                cause: custom
            timestamp: '2030-01-10T12:00:00.000Z'
            route: /public/v1/posts
    Unauthorized:
      description: The API key is missing, unknown or revoked.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            statusCode: 401
            message: Invalid API key
            errors: null
            timestamp: '2030-01-10T12:00:00.000Z'
            route: /public/v1/accounts
    Forbidden:
      description: Your role in the team doesn't allow this.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: >-
        More than 120 requests a minute to this endpoint. All of a person's keys
        count together. Wait the number of seconds in `Retry-After-caller`, then
        try again.
      headers:
        Retry-After-caller:
          description: Seconds to wait before trying again.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        An API key from **Settings › AI apps & API** in Postploy. Keys start
        with `ppk_`.

````

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