Returning.AIDevelopers
v1

API reference / Legacy / Roles & Permissions

.md

List user roles

List user roles

Last updated 26 Sep 2026API v1

Method
GET
Path
https://api.returning.ai/roles/{userId}

Authentication#

Header
Authorization: Bearer <API_KEY>

Behaviour#

Legacy category

This endpoint is retained for compatibility, historical admin tooling, or test workflows. Do not use it as the default choice for new integrations unless the backend team confirms this exact route is still supported for your community.

What it is for

List user roles.

How to use it

Send a GET request to /roles/{userId} with the documented body, query parameters, headers, or multipart fields. Prefer the newer authenticated /v1/... integration API where available.

Successful response

HTTP 2xx. Older endpoints may return a legacy response envelope or a resource-specific payload rather than the newer { status, message, data } wrapper.

Common error states
  • 400 invalid request body, query, ObjectId, pagination, file format, or missing required field.
  • 401 missing, invalid, expired, or insufficient API key/token.
  • 403 key is valid but cannot access this community/channel/user/resource, where supported by the service.
  • 404 route or target resource was not found. Several legacy root routes return 404 on https://api.returning.ai; confirm with Returning.AI before using them.
  • 409 duplicate or conflicting state for create/update operations, where applicable.
  • 500 unexpected Returning.AI service error.
Legacy status

Compatibility endpoint retained for older integrations. Do not use this endpoint for new integrations unless Returning.AI specifically tells you to maintain a legacy flow. Prefer the current /v1/... endpoint in the matching non-Legacy category when one exists.

Source-backed clarification

These are compatibility endpoints using older server/role terminology. Use them only when maintaining an existing integration. For new public docs and integrations, prefer community/user permission language and scoped API-key permissions.

Request#

Path parameters#

userId#stringREQUIRED
User ID in Returning.AI.

Eg1102

Headers#

Authorization#stringREQUIRED
API key.

RuleBearer <API_KEY>

x-api-key#stringREQUIRED
Legacy server API key header. Prefer Authorization: Bearer <API_KEY> for /v1/... integration APIs.
curl --request GET \
  --url 'https://api.returning.ai/roles/<userId>' \
  --header 'Authorization: Bearer <API_KEY>'

Response#

meta#objectALWAYS

Eg{ ... }

success#booleanALWAYS

Egtrue

message#stringALWAYS

Eg"User roles fetched successfully"

devMessage#stringALWAYS

Eg"User roles fetched successfully"

body#object[]ALWAYS

Eg[ ... ]

_id#string

Eg"{_id}"

order#integer

Eg1

billable#boolean

Egtrue

title#string

Eg"Manager 2"

description#string

Eg"Role with permissions to moderate the server"

serverPermissions#object

Eg{ ... }

allow_dm#booleanALWAYS

Egtrue

create_invite#booleanALWAYS

Egtrue

kick_members#booleanALWAYS

Egtrue

ban_members#booleanALWAYS

Egtrue

manage_roles#booleanALWAYS

Egtrue

manage_channels#booleanALWAYS

Egtrue

server_administrator#booleanALWAYS

Egtrue

warn_members#booleanALWAYS

Egtrue

suspend_members#booleanALWAYS

Egtrue

broadcast_messages#booleanALWAYS

Egtrue

overwrite_language_settings#booleanALWAYS

Egtrue

channelPermissions#object

Eg{ ... }

view_message_history#booleanALWAYS

Egtrue

manage_messages#booleanALWAYS

Egtrue

allow_mentions#booleanALWAYS

Egtrue

post_messages#booleanALWAYS

Egtrue

post_analysis#booleanALWAYS

Egtrue

attach_files#booleanALWAYS

Egtrue

delete_messages#booleanALWAYS

Egtrue

class#string

Eg"red"

serverId#string

Eg"{_id}"

createdAt#string

Eg"2025-04-30T08:48:49.094Z"

updatedAt#string

Eg"2025-04-30T08:48:49.094Z"

__v#integer

Eg0

{
  "meta": {
    "success": true,
    "message": "User roles fetched successfully",
    "devMessage": "User roles fetched successfully"
  },
  "body": [
    {
      "_id": "{_id}",
      "order": 1,
      "billable": true,
      "title": "Manager 2",
      "description": "Role with permissions to moderate the server",
      "serverPermissions": {
        "allow_dm": true,
        "create_invite": true,
        "kick_members": true,
        "ban_members": true,
        "manage_roles": true,
        "manage_channels": true,
        "server_administrator": true,
        "warn_members": true,
        "suspend_members": true,
        "broadcast_messages": true,
        "overwrite_language_settings": true
      },
      "channelPermissions": {
        "view_message_history": true,
        "manage_messages": true,
        "allow_mentions": true,
        "post_messages": true,
        "post_analysis": true,
        "attach_files": true,
        "delete_messages": true
      },
      "class": "red",
      "serverId": "{_id}",
      "createdAt": "2025-04-30T08:48:49.094Z",
      "updatedAt": "2025-04-30T08:48:49.094Z",
      "__v": 0
    }
  ]
}

Errors#

Fix the request03

400Fix the request
Invalid request. Check required parameters, body fields, file format, pagination values, and ObjectId values.
401Fix the request
Missing, invalid, expired, or insufficient API key/token. Older permission middleware may also return 401 for missing permissions.
403Fix the request
The API key is valid but is not allowed to access this community, channel, user, or resource.

Fix the data01

404Fix the data
The requested resource, route, community, channel, user, API key, status, or job was not found.

Retry with backoff01

500Retry with backoff
Unexpected Returning.AI service error.
{
  "status": "fail",
  "message": "Invalid request. Check required parameters, body fields, file format, pagination values, and ObjectId values."
}

Next step#

Add role to userPOST/roles/{userId}/{roleId}/add