Returning.AI
  1. API Keys
Returning.AI
  • Returning.AI
    • Auth
      • register
      • verify email
      • login
      • secure auth
    • Server
      • create new server
      • get my servers
      • update server
      • role list of server
      • channel list of server
    • Role
      • create new role
      • update role
      • delete role
      • add role to a user on a server
      • remove role from a user on a server
      • get role list of user on a server
    • Channel
      • get channels list
      • create new channel
      • update channel
      • delete channel
    • Badge
      • get badges list
      • create new badge
      • update badge
      • delete badge
      • award badge to user
      • remove badge from user
    • Integration
      • users
        • create new user
        • manage user
        • user data
        • gamification stats
        • user bulk update
        • user bulk import
      • Messages
        • Send Message
        • Reply Message
        • React Message
      • Channels
        • Get Channels List
      • User Field Histories
        • Create user field history
        • Get user field histories
      • User Fields
        • Create user field
        • Get all user fields for a community
        • Delete user field
        • Update user field
        • Get specific user field
      • Users
        • Get user
    • Application
      • API Keys
        • Create API key
          POST
        • Read API keys
          GET
        • Delete API key
          DELETE
        • Update API key
          PUT
      • Users
        • Get user
      • Community Users
        • Get community users
        • Get user
      • User Fields
        • Get all user fields for a community
        • Get specific user field
        • Create user field
        • Update user field
        • Delete user field
      • User Field Histories
        • Get all user field histories in a community
        • Get user field histories for a specific field
        • Get user field histories for a specific user
        • Get user field histories of specific user field and user
        • Create user field history for specific user
  1. API Keys

Create API key

POST
/apis/v1/communities/{communityId}/api-keys
API Keys
Creates a new API key for a community. API keys can be used for authentication
and access control to community resources.
Security Requirements:
Bearer token authentication required
Only community owners and administrators can access this endpoint
User must have either COMMUNITY_OWNER or COMMUNITY_ADMIN permissions for the specified community
Key Features:
Generates secure 64-character API key with SHA-256 hash
Supports optional expiration period or specific expiration date
Allows custom permissions assignment for fine-grained access control
Emits real-time event to community members
Validates all input parameters for security

Request

Authorization
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Path Params
communityId
string <objectId>
required
The unique identifier of the community
Example:
675a1234bcde567890123456
Body Params application/json
name
string 
required
The name of the API key for identification
>= 1 characters
Example:
Slack Integration API Key
permissions
array[string]
optional
Array of permissions to assign to the API key
Example:
["sendMessage","replyMessage","createUser","manageUser","getUserData","getUserStats","bulkUpdateUser","userFields"]
expirePeriod
number 
optional
Expiration period in days (0 for no expiration)
>= 0
Example:
365
expireDate
string <date-time>
optional
Specific expiration date for the API key
Example:
2024-12-31T23:59:59Z
Examples
{
    "name": "Slack Integration API Key",
    "permissions": [
        "sendMessage",
        "replyMessage",
        "createUser",
        "manageUser",
        "getUserData",
        "getUserStats",
        "bulkUpdateUser",
        "userFields"
    ],
    "expirePeriod": 0
}

Request samples

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl --location --request POST 'https://application.returning.ai/apis/v1/communities//api-keys' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "Slack Integration API Key",
    "permissions": [
        "sendMessage",
        "replyMessage",
        "createUser",
        "manageUser",
        "getUserData",
        "getUserStats",
        "bulkUpdateUser",
        "userFields"
    ],
    "expirePeriod": 0
}'

Responses

🟢201Created
application/json
Create API key successful
Body
meta
object 
optional
status
string 
optional
Response status
statusCode
number 
optional
HTTP status code
message
string 
optional
Success message for the operation
data
object 
optional
_id
string 
optional
The unique identifier of the API key
name
string 
optional
The name of the API key
key
string 
optional
The generated API key value
permissions
array[string]
optional
Array of permissions assigned to the API key
expirePeriod
number  | null 
optional
Expiration period in days (0 for no expiration)
expireDate
string <date-time> | null 
optional
Specific expiration date for the API key
updatedAt
string <date-time>
optional
When the API key was last updated
createdAt
string <date-time>
optional
When the API key was created
Example
{
    "meta": {
        "status": "success",
        "statusCode": 201
    },
    "message": "Create API key success.",
    "data": {
        "_id": "675b9876fedc432109876543",
        "name": "Slack Integration API Key",
        "key": "8f3e4d5c6b7a9e2f1a4b7c8d5e9f2a6b3c7e8f1a4b5c9d2e6f8a1b4c7e9f2a5b8c",
        "permissions": [
            "sendMessage",
            "replyMessage",
            "createUser",
            "manageUser",
            "getUserData",
            "getUserStats",
            "bulkUpdateUser",
            "userFields"
        ],
        "expirePeriod": 0,
        "expireDate": "",
        "updatedAt": "2024-12-15T10:30:45.123Z",
        "createdAt": "2024-12-15T10:30:45.123Z"
    }
}
🟠400Bad Request
🟠401Unauthorized
🟠403Forbidden
🟠404Record Not Found
🔴500Server Error
Modified at 2025-07-07 16:49:45
Previous
Get user
Next
Read API keys