# Teams and users API reference

> pushq Teams & users API reference: manage your profile, password, teams, team members and roles, password-reset links and invites, hosted or self-hosted.

Source: https://pushqueue.dev/docs/reference/rest/teams-and-users/

The teams and users API manages people rather than queues: your own profile (`/v1/me`), the teams you belong to (`/v1/teams`), the members of a team (`/v1/users`) and pending invitations (`/v1/invites`). The dashboard uses all of them; you only need them directly if you are automating member management. For a walkthrough, see [managing team members](https://pushqueue.dev/docs/guides/team-members/).

The SDKs don't wrap these endpoints; call them over HTTP. Examples use the hosted API at `https://api.pushqueue.dev`.

## Self-hosted vs hosted accounts

pushq runs in one of two account modes, and some endpoints behave differently or exist in only one of them:

- **Self-hosted** (no WorkOS configured): the server has one set of users with email/password sign-in. `/v1/users` lists every account on the server. Invites are single-use links you send yourself.
- **Hosted / SaaS mode** (WorkOS configured, as on `api.pushqueue.dev`): people sign in with an emailed code or GitHub, and belong to one or more **teams**. Every request acts inside the session's current team; `/v1/users` lists that team's members, and WorkOS emails the invitations.

Endpoints marked *self-hosted only* return `404 not_found` in SaaS mode, and endpoints marked *SaaS only* return `404 not_found` on a self-hosted server. All of them return `404 not_found` when dashboard accounts are disabled on a self-hosted server.

## Who can call the account endpoints

| Endpoints | Who can call |
|---|---|
| `/v1/me`, `/v1/me/password`, `GET`/`POST /v1/teams`, `POST /v1/teams/{id}:switch` | A signed-in dashboard user only (session cookie). API keys get `401 unauthenticated`. |
| `PATCH /v1/teams/current`, `/v1/users*`, `/v1/invites*` | The **manage** permission: an `admin` API key or a dashboard `admin`. Others get `403 permission_denied`. |

Session requests send the `pushq_session` cookie that [sign-in](https://pushqueue.dev/docs/reference/rest/auth/) sets. Any session request that changes something (`POST`, `PATCH`, `DELETE`) must also send an `X-Requested-With` header with any non-empty value, or it fails with `403 permission_denied`; this blocks cross-site request forgery. Requests with an `Authorization` header don't need it. The session examples below use `$PUSHQ_SESSION` for the cookie value.

## Dashboard roles: viewer, member and admin

| Role | Can do |
|---|---|
| `viewer` | See queues, stats, tasks and attempts, list queues. |
| `member` | Everything a viewer can, plus create, change, pause, purge and delete queues and enqueue, run and delete tasks. |
| `admin` | Everything a member can, plus manage members, invites and API keys. |

## The user object

```json
{
  "id": 3,
  "email": "ana@example.com",
  "name": "Ana Lima",
  "role": "admin",
  "created_at": "2026-09-14T08:12:00Z",
  "last_login_at": "2026-11-28T09:01:12Z"
}
```

| Field | Type | Description |
|---|---|---|
| `id` | integer | User ID; use it in `/v1/users/{id}`. |
| `email` | string | Email address (lowercase). |
| `name` | string | Display name; may be empty. |
| `role` | string | `admin`, `member` or `viewer`. In SaaS mode, the role in the current team. |
| `created_at` | string (RFC 3339) | When the account was created. |
| `last_login_at` | string (RFC 3339) | Last sign-in. Omitted if the user never signed in. |

## The invite object

```json
{
  "id": 9,
  "kind": "invite",
  "email": "sam@example.com",
  "role": "member",
  "created_at": "2026-11-28T10:00:00Z",
  "expires_at": "2026-12-05T10:00:00Z"
}
```

| Field | Type | Description |
|---|---|---|
| `id` | integer | Invite ID; use it to revoke the invite. |
| `kind` | string | `invite` (a new member) or `reset` (a password-reset link). |
| `email` | string | Who it is for. |
| `role` | string | Role the new member gets. Omitted for `reset` links. |
| `created_at` | string (RFC 3339) | When it was created. |
| `expires_at` | string (RFC 3339) | When it stops working. |

## Change your name

`PATCH /v1/me`

Updates the signed-in user's display name. The dashboard's profile page uses it.

**Who can call it:** a signed-in dashboard user (session only).

**Request body**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `name` | string | no | unchanged | New display name, at most 100 characters after trimming spaces. Omit to leave it as is. |

**Example**

```bash
curl -X PATCH https://api.pushqueue.dev/v1/me \
  --cookie "pushq_session=$PUSHQ_SESSION" \
  -H "X-Requested-With: pushq" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Ana Lima" }'
```

**Response**

`200 OK` with the updated [user object](#the-user-object):

```json
{
  "id": 3,
  "email": "ana@example.com",
  "name": "Ana Lima",
  "role": "admin",
  "created_at": "2026-09-14T08:12:00Z",
  "last_login_at": "2026-11-28T09:01:12Z"
}
```

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | Invalid JSON or a name longer than 100 characters. |
| 401 | `unauthenticated` | No session (API keys can't call this). |
| 403 | `permission_denied` | Missing `X-Requested-With` header. |

See [API error codes](https://pushqueue.dev/docs/reference/errors/) for the error format.

## Change your password

`POST /v1/me/password`

Sets a new password for the signed-in user after checking the current one, and signs them out on every other device (the current session stays valid). *Self-hosted only*: in SaaS mode there are no passwords.

**Who can call it:** a signed-in dashboard user (session only). Rate-limited per client IP (10 attempts, then one every 6 seconds).

**Request body**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `current_password` | string | yes | — | The user's current password. |
| `new_password` | string | yes | — | At least 8 characters and at most 256 bytes. |

**Example**

```bash
curl -X POST https://pushq.example.com/v1/me/password \
  --cookie "pushq_session=$PUSHQ_SESSION" \
  -H "X-Requested-With: pushq" \
  -H "Content-Type: application/json" \
  -d '{ "current_password": "old-password", "new_password": "a-much-longer-passphrase" }'
```

**Response**

`204 No Content` with an empty body.

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | Current password wrong, or the new one too short or too long. |
| 401 | `unauthenticated` | No session. |
| 403 | `permission_denied` | Missing `X-Requested-With` header. |
| 404 | `not_found` | SaaS mode. |
| 429 | `rate_limited` | Too many attempts; retry after the `Retry-After` seconds. |

## List your teams

`GET /v1/teams`

Lists the teams the signed-in user belongs to, with their role in each, oldest membership first. The dashboard's team switcher uses it. *SaaS only.*

**Who can call it:** a signed-in dashboard user (session only).

**Example**

```bash
curl https://api.pushqueue.dev/v1/teams \
  --cookie "pushq_session=$PUSHQ_SESSION"
```

**Response**

`200 OK`:

```json
{
  "teams": [
    { "id": 4, "name": "Acme", "role": "admin" },
    { "id": 11, "name": "Side project", "role": "viewer" }
  ]
}
```

| Field | Type | Description |
|---|---|---|
| `teams[].id` | integer | Team ID. |
| `teams[].name` | string | Team name. |
| `teams[].role` | string | Your role in that team: `admin`, `member` or `viewer`. |

**Errors**

| Status | Code | When |
|---|---|---|
| 401 | `unauthenticated` | No session. |
| 404 | `not_found` | Not in SaaS mode. |

## Create a team

`POST /v1/teams`

Creates a new team with the caller as its admin and switches the caller's session to it. Use it to separate environments or projects: each team has its own queues, API keys and members. *SaaS only.* Behind the scenes this creates a WorkOS Organization.

**Who can call it:** a signed-in dashboard user (session only).

**Request body**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `name` | string | yes | — | Team name, 1–100 characters. |

**Example**

```bash
curl -X POST https://api.pushqueue.dev/v1/teams \
  --cookie "pushq_session=$PUSHQ_SESSION" \
  -H "X-Requested-With: pushq" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Acme staging" }'
```

**Response**

`201 Created`:

```json
{ "id": 15, "name": "Acme staging", "role": "admin" }
```

| Field | Type | Description |
|---|---|---|
| `id` | integer | New team ID. |
| `name` | string | Team name. |
| `role` | string | Always `admin` for the creator. |

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | Name empty or longer than 100 characters, or the account isn't linked to WorkOS. |
| 400 | `failed_precondition` | WorkOS rejected the request; `detail` explains why. |
| 401 | `unauthenticated` | No session. |
| 403 | `permission_denied` | Missing `X-Requested-With` header. |
| 404 | `not_found` | Not in SaaS mode. |
| 502 | `internal` | WorkOS is unavailable; try again. |

## Switch teams

`POST /v1/teams/{id}:switch`

Makes another of your teams the current team for this session. Every later request on the session (queues, keys, members) acts in that team, and it becomes the team you start in next time you sign in. *SaaS only.*

**Who can call it:** a signed-in dashboard user (session only) who is a member of the target team.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `id` | integer | yes | — | ID of a team you belong to. |

No request body.

**Example**

```bash
curl -X POST https://api.pushqueue.dev/v1/teams/11:switch \
  --cookie "pushq_session=$PUSHQ_SESSION" \
  -H "X-Requested-With: pushq"
```

**Response**

`204 No Content` with an empty body.

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | `id` is not an integer. |
| 401 | `unauthenticated` | No session. |
| 403 | `permission_denied` | Missing `X-Requested-With` header. |
| 404 | `not_found` | You aren't a member of that team, or not in SaaS mode. |

## Rename the current team

`PATCH /v1/teams/current`

Renames the team the caller is acting in (the session's current team, or the team an API key belongs to). The new name is also pushed to WorkOS. *SaaS only.*

**Who can call it:** an `admin` API key of the team, or a dashboard admin of the team.

**Request body**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `name` | string | yes | — | New team name, 1–100 characters after trimming spaces. |

**Example**

```bash
curl -X PATCH https://api.pushqueue.dev/v1/teams/current \
  -H "Authorization: Bearer $PUSHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Acme production" }'
```

**Response**

`200 OK`:

```json
{ "id": 4, "name": "Acme production", "role": "admin" }
```

| Field | Type | Description |
|---|---|---|
| `id` | integer | Team ID. |
| `name` | string | The new name. |
| `role` | string | The caller's role (for an API key, the key's role). |

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | Name empty or longer than 100 characters. |
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | Not an admin of the team. |
| 404 | `not_found` | Not in SaaS mode. |

## List members

`GET /v1/users`

Self-hosted: lists every account on the server. SaaS mode: lists the current team's members, re-synced from WorkOS first (so people who accepted an invite show up), with `role` set to their role in the team. Both are ordered by email. Use it to audit who has access.

**Who can call it:** admin API key; dashboard admin.

**Example**

```bash
curl https://api.pushqueue.dev/v1/users \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`200 OK`:

```json
{
  "users": [
    {
      "id": 3,
      "email": "ana@example.com",
      "name": "Ana Lima",
      "role": "admin",
      "created_at": "2026-09-14T08:12:00Z",
      "last_login_at": "2026-11-28T09:01:12Z"
    },
    {
      "id": 8,
      "email": "sam@example.com",
      "name": "",
      "role": "viewer",
      "created_at": "2026-11-20T16:40:00Z"
    }
  ]
}
```

| Field | Type | Description |
|---|---|---|
| `users` | array of [user objects](#the-user-object) | The members. |

**Errors**

| Status | Code | When |
|---|---|---|
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | Not an admin. |
| 404 | `not_found` | Dashboard accounts are not enabled. |

## Change a member

`PATCH /v1/users/{id}`

Changes a member's role (and, on a self-hosted server, their name). Use it to promote someone to admin or reduce someone to read-only. The last admin can't be demoted, so a team always keeps at least one admin. In SaaS mode only the role can change; names come from WorkOS.

**Who can call it:** admin API key; dashboard admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `id` | integer | yes | — | The member's user ID. |

**Request body**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `role` | string | no (yes in SaaS mode) | unchanged | `admin`, `member` or `viewer`. |
| `name` | string | no | unchanged | Self-hosted only: new display name, at most 100 characters. Ignored in SaaS mode. |

**Example**

```bash
curl -X PATCH https://api.pushqueue.dev/v1/users/8 \
  -H "Authorization: Bearer $PUSHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "role": "member" }'
```

**Response**

`200 OK` with the updated [user object](#the-user-object):

```json
{
  "id": 8,
  "email": "sam@example.com",
  "name": "",
  "role": "member",
  "created_at": "2026-11-20T16:40:00Z"
}
```

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | Invalid `id` or JSON, unknown role, name too long, or (SaaS mode) no `role` given. |
| 400 | `failed_precondition` | The change would leave the team without an admin. |
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | Not an admin. |
| 404 | `not_found` | No such user, or not a member of the current team. |

## Remove a member

`DELETE /v1/users/{id}`

Removes someone's access immediately. Self-hosted: deletes the account and all its sessions. SaaS mode: removes them from the current team (their sessions in that team lose access at once, and the WorkOS membership is deleted); their account and other teams are untouched. The last admin can't be removed.

**Who can call it:** admin API key; dashboard admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `id` | integer | yes | — | The member's user ID. |

**Example**

```bash
curl -X DELETE https://api.pushqueue.dev/v1/users/8 \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`204 No Content` with an empty body.

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | `id` is not a positive integer. |
| 400 | `failed_precondition` | They are the last admin. |
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | Not an admin. |
| 404 | `not_found` | No such user, or not a member of the current team. |

## Create a password-reset link

`POST /v1/users/{id}/reset-link`

Creates a single-use link that lets a user set a new password, for when someone is locked out. Send them the link; opening it in the dashboard and choosing a password signs them out everywhere else. The link is valid for 24 hours and replaces any earlier reset link for that user. *Self-hosted only.*

**Who can call it:** admin API key; dashboard admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `id` | integer | yes | — | The user's ID. |

No request body.

**Example**

```bash
curl -X POST https://pushq.example.com/v1/users/8/reset-link \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`201 Created`:

```json
{
  "link": {
    "id": 21,
    "kind": "reset",
    "email": "sam@example.com",
    "created_at": "2026-11-28T12:30:00Z",
    "expires_at": "2026-11-29T12:30:00Z"
  },
  "path": "/invite#token=pqi_4p0yN8cJ2wqZbX1sRk7mT3vLhD9eF6aGuQ5iW0oYcEs"
}
```

| Field | Type | Description |
|---|---|---|
| `link` | [invite object](#the-invite-object) | The reset link's metadata (`kind` is `reset`, no `role`). |
| `path` | string | The single-use link, relative to your server. Prepend your server's URL before sending it. |

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | `id` is not a positive integer. |
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | Not an admin. |
| 404 | `not_found` | No such user, SaaS mode, or dashboard accounts disabled. |

## List pending invites

`GET /v1/invites`

Lists invitations that haven't been accepted or expired yet. Self-hosted: invite links created with [Invite someone](#invite-someone), newest first. SaaS mode: the current team's pending WorkOS invitations.

**Who can call it:** admin API key; dashboard admin.

**Example**

```bash
curl https://api.pushqueue.dev/v1/invites \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`200 OK`:

```json
{
  "invites": [
    {
      "id": 9,
      "kind": "invite",
      "email": "sam@example.com",
      "role": "member",
      "created_at": "2026-11-28T10:00:00Z",
      "expires_at": "2026-12-05T10:00:00Z"
    }
  ]
}
```

| Field | Type | Description |
|---|---|---|
| `invites` | array of [invite objects](#the-invite-object) | Pending invites. |

**Errors**

| Status | Code | When |
|---|---|---|
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | Not an admin. |
| 404 | `not_found` | Dashboard accounts are not enabled. |
| 502 | `internal` | SaaS mode: WorkOS is unavailable. |

## Invite someone

`POST /v1/invites`

Invites a person to join with a given role. Self-hosted: returns a single-use link (valid 7 days) that you send them yourself; opening it lets them pick a name and password. Inviting the same email again replaces the earlier invite. SaaS mode: WorkOS emails the invitation, and the role is applied when they join.

**Who can call it:** admin API key; dashboard admin.

**Request body**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `email` | string | yes | — | Email address to invite. |
| `role` | string | yes | — | `admin`, `member` or `viewer`. |

**Example**

```bash
curl -X POST https://api.pushqueue.dev/v1/invites \
  -H "Authorization: Bearer $PUSHQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "email": "sam@example.com", "role": "member" }'
```

**Response**

`201 Created`. On a self-hosted server:

```json
{
  "invite": {
    "id": 9,
    "kind": "invite",
    "email": "sam@example.com",
    "role": "member",
    "created_at": "2026-11-28T10:00:00Z",
    "expires_at": "2026-12-05T10:00:00Z"
  },
  "path": "/invite#token=pqi_Zr8wK1nQ3yT0vB6xM2cL9pH4dF7aJ5sE1uG8iO3kYqA"
}
```

In SaaS mode:

```json
{
  "invite": {
    "id": 9,
    "kind": "invite",
    "email": "sam@example.com",
    "role": "member",
    "created_at": "2026-11-28T10:00:00Z",
    "expires_at": "2026-12-05T10:00:00Z"
  },
  "emailed": true
}
```

| Field | Type | Description |
|---|---|---|
| `invite` | [invite object](#the-invite-object) | The new invite. |
| `path` | string | Self-hosted only: the single-use invite link, relative to your server. |
| `emailed` | boolean | SaaS mode only: `true`, WorkOS emailed the invitation. |

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | Invalid email or role. |
| 400 | `failed_precondition` | SaaS mode: WorkOS rejected the invitation; `detail` explains why. |
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | Not an admin. |
| 404 | `not_found` | Dashboard accounts are not enabled. |
| 409 | `already_exists` | Self-hosted: a user with that email already exists. |
| 502 | `internal` | SaaS mode: WorkOS is unavailable. |

## Revoke an invite

`DELETE /v1/invites/{id}`

Cancels a pending invite so its link (or emailed invitation) no longer works.

**Who can call it:** admin API key; dashboard admin.

**Path parameters**

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| `id` | integer | yes | — | The invite's `id`. |

**Example**

```bash
curl -X DELETE https://api.pushqueue.dev/v1/invites/9 \
  -H "Authorization: Bearer $PUSHQ_API_KEY"
```

**Response**

`204 No Content` with an empty body.

**Errors**

| Status | Code | When |
|---|---|---|
| 400 | `invalid_argument` | `id` is not a positive integer. |
| 401 | `unauthenticated` | No valid credentials. |
| 403 | `permission_denied` | Not an admin. |
| 404 | `not_found` | No such pending invite. |
| 502 | `internal` | SaaS mode: WorkOS is unavailable. |

## Read more

- [Managing team members](https://pushqueue.dev/docs/guides/team-members/): invite people and choose roles in the dashboard.
- [Auth API reference](https://pushqueue.dev/docs/reference/rest/auth/): sign-in, setup and invite-link endpoints.
- [API keys API reference](https://pushqueue.dev/docs/reference/rest/api-keys/): keys for programs instead of people.
- [Running pushq in SaaS mode](https://pushqueue.dev/docs/self-hosting/saas-mode/): WorkOS teams on your own server.
