---
title: "List roles"
method: GET
path: "/organizations/{organization}/databases/{database}/branches/{branch}/roles"
tags: ["Roles"]
---

# List roles

`GET /organizations/{organization}/databases/{database}/branches/{branch}/roles`

### Authorization
A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**
 `read_branch`, `delete_branch`, `create_branch`, `connect_production_branch`, `connect_production_read_only_branch`, `connect_branch`

**OAuth Scopes**

 | Resource | Scopes |
| :------- | :---------- |
| Organization | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` |
| Database | `manage_passwords`, `manage_production_branch_passwords`, `manage_read_only_passwords`, `manage_production_read_only_passwords` |
| Branch | `manage_passwords`, `manage_read_only_passwords` |

## Path parameters

- `organization` string, required
- `database` string, required
- `branch` string, required

## Query parameters

- `page` integer
- `per_page` integer
- `status` string
- `q` string

## Response `200`

Returns roles

- object
  - `type` string, required — The response type. Always "list" for paginated responses.
  - `current_page` integer, required — The current page number
  - `per_page` integer, required — The maximum number of results per page
  - `next_page` integer, nullable, required — The next page number, or null when this is the last page
  - `next_page_url` string, nullable, required — The next page of results, or null when this is the last page
  - `prev_page` integer, nullable, required — The previous page number, or null when this is the first page
  - `prev_page_url` string, nullable, required — The previous page of results, or null when this is the first page
  - `total_count` integer, required — The total number of matching results
  - `total_pages` integer, required — The total number of pages of matching results
  - `data` object[], required
    - `id` string, required — The ID of the role
    - `name` string, required — The name of the role
    - `access_host_url` string, required — The database connection string
    - `private_access_host_url` string, required — The database connection string for private connections
    - `private_connection_service_name` string, required — The service name to set up private connectivity
    - `username` string, required — The database user name
    - `base_username` string, required — The base username without branch routing suffix
    - `password` string, required — The plaintext password, available only after create
    - `database_name` string, required — The database name
    - `created_at` string, required — When the role was created
    - `updated_at` string, required — When the role was updated
    - `deleted_at` string, nullable, required — When the role was deleted
    - `expires_at` string, nullable, required — When the role expires
    - `dropped_at` string, nullable, required — When the role was dropped
    - `disabled_at` string, nullable, required — When the role was disabled
    - `drop_failed` string, required — Error message available when dropping the role fails
    - `ready` boolean, required — Whether the role is ready to accept connections
    - `expired` boolean, required — True if the credentials are expired
    - `default` boolean, required — Whether the role is the default postgres user
    - `ttl` integer, required — Number of seconds before the credentials expire
    - `inherited_roles` string[], required — Database roles these credentials inherit
    - `with_replication` boolean, required — Whether the role has the REPLICATION attribute
    - `branch` object, required
      - `id` string, required — The ID for the resource
      - `name` string, required — The name for the resource
      - `created_at` string, required — When the resource was created
      - `updated_at` string, required — When the resource was last updated
      - `deleted_at` string, nullable, required — When the resource was deleted, if deleted
    - `actor` object, required
      - `id` string, required — The ID of the actor
      - `display_name` string, required — The name of the actor
      - `avatar_url` string, required — The URL of the actor's avatar
    - `query_safety_settings` object, required
      - `require_where_on_delete` 'off' | 'warn' | 'on', required — Require WHERE clause on DELETE statements
      - `require_where_on_update` 'off' | 'warn' | 'on', required — Require WHERE clause on UPDATE statements

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `500` — Internal Server Error

## Changes

- **2026-08-18** `249942995489` — 3 info
  - added the required property `data/items/ready` to the response with the `200` status
  - added the required property `total_count` to the response with the `200` status
  - added the required property `total_pages` to the response with the `200` status
- **2026-08-12** `fd4480152110` — 1 info
  - removed the `pscale_managed` enum value from the `data/items/inherited_roles/items/` response property for the response status `200`
- **2026-08-11** `4b2e4f05bda2` — 1 info
  - added the required property `per_page` to the response with the `200` status
- **2026-07-08** `fa19f3305241` — 1 info
  - added the required property `data/items/with_replication` to the response with the `200` status
- **2026-06-15** `ce1af9e1cdfa` — 2 info
  - added the new optional `query` request parameter `q`
  - added the new optional `query` request parameter `status`

[Full history](https://skmtc.dev/planetscale/apis/planetscale-api/changes/organizations/:organization/databases/:database/branches/:branch/roles/get.md)

---

[API](https://skmtc.dev/planetscale/apis/planetscale-api.md) · [All operations](https://skmtc.dev/planetscale/apis/planetscale-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/planetscale/planetscale-api/revisions/6d28c038c4fd/schema)
