Skip to content
Swingback, home

API reference

Stats

Lists don't return totals: the stats do. They count your workspace's posts, its posts in each status, its votes, its boards and its end users: each field says what it counts.

The examples read your API key and your workspace's base URL from two shell variables. Set them once, with your workspace's id in place of ws_... (API keys says where to find both):

Terminal
export SWINGBACK_API_KEY="s_live_..."
export SWINGBACK_API="https://api.swingback.dev/v1/workspaces/ws_..."
Download the OpenAPI specJSON

Retrieve workspace stats#

GET/v1/workspaces/{workspace_id}/stats

Any API key: Read or Read and write

Returns the totals that lists don't give: posts, posts by status, votes, boards and end users. Each field says what it counts.

Path parameters

  • workspace_idstringrequired

    Your workspace's id, shown under Settings → Sign-in.

    Starts with ws_

Responses

  • 200
    OKThe counts. Returns a stats object.
  • 4xxErrorProblem details with a stable code: see Errors.

Example

Request
curl "$SWINGBACK_API/stats" \
  -H "Authorization: Bearer $SWINGBACK_API_KEY"
Response · 200 OK
{
  "boards": 4,
  "end_users": 512,
  "posts": 128,
  "posts_by_status": {
    "pending": 6,
    "review": 12,
    "planned": 9,
    "in_progress": 4,
    "completed": 85,
    "closed": 12
  },
  "votes": 1024
}

The stats object#

Fields

  • boardsinteger

    The boards not in the trash.

  • end_usersinteger

    Every end user: customers, guests and your team members' own, erased ones included.

  • postsinteger

    The posts, without those in the trash, on a board in the trash, or merged into another.

  • posts_by_statusobject

    The same posts, counted by status.

    Child fields (6)
    • closedinteger
    • completedinteger
    • in_progressinteger
    • pendinginteger
    • plannedinteger
    • reviewinteger
  • votesinteger

    The votes on posts not in the trash, those on a board in the trash included. A merged post's votes count on the post it went into, once per customer.

Example

The stats object
{
  "boards": 4,
  "end_users": 512,
  "posts": 128,
  "posts_by_status": {
    "pending": 6,
    "review": 12,
    "planned": 9,
    "in_progress": 4,
    "completed": 85,
    "closed": 12
  },
  "votes": 1024
}

Search pages, sections and code: a setting, an event, a method.