Skip to content

Public API: Users

Isaiah Fisher edited this page Dec 17, 2024 · 1 revision

Getting a list of users

Getting a list of users in your account makes sense in scenarios where you want to use the API to complete tasks or launch workflows that have user fields.

The endpoint for getting a list of users is GET https://api.pneumatic.app/accounts/users

There's a bunch of parameters you can pass in for how you want the result to be ordered, what type of users you want to get a list of, their status, whether or not they're to be filtered by group etc.

Param Description
ordering the field to order the results by
type the type of users you want a list of
status the user status you're interested in
groups filter by group
limit how many users you want in the result
offset how many users to skip

Odering specifies the field the results are to be ordered by, several values can be passed in separated by a comma. Use a '-' to invert the order. Possible fields users can be ordered by:

last_name(default), first_name, status

The type parameter lets you filter users by user type. Several comma separated values can be passed in to get several types of users in the response. The available values are:

guest user

The status parameter filters users by status. Several comma separated values can be passed in to get users with several different statuses. The available values are:

active(default) inactive (this refers to deleted users) invited (users that have been sent invites but haven't accepted them yet)

The groups parameter lets you to only select users that belong to a specific group identified by its id. Several group ids can be passed in as a comma separated list.

Response options

200 means the request has been processed successfully return a response in the format show above.

400 means there was a validation error

Python example:

import requests

api_key = 'your_api_key'
headers = {
  'Authorization': f'Bearer {api_key}'
}

r = requests.get(
  'https://api.pneumatic.app/accounts/users?offset=0&limit=20',
  headers=headers,
)

The response looks like this:

{
  "count": int,
  "next": str, // nullable
  "previous": str, // nullable
  "results": [
    {
      "id": int,
      "email": str,
      "first_name": str,
      "last_name": str,
      "phone": str, // nullable
      "photo": str, // nullable
      "status": UserStatusEnum,
      "is_staff": bool,
      "is_admin": bool,
      "is_account_owner": bool,
      "invite": {
        "id": str,
        "by_username": str,
        "date_created": str, // format ISO 8601: YYYY-MM-DDThh:mm:ss[.SSS]
        "invited_by": int,
        "invited_from": InvitedFromEnum
      }
    }
  ]
}