Skip to main content

APIs

Verify login code

  • Endpoint

    • /users/auth
  • Method

    • GET
  • Parameters

    ParametersTypeDescription
    codeString
    Verify login code
  • Example Value

    {
    "userId": "xxxxxxx",
    "address": "0x44...5674",
    "serverId": "1561616818083545088",
    "channelId": "1562711066578907136",
    "starkKey": "0x00...4c2c"
    }
  • Return Value

    ParametersTypeDescription
    userIdStringUser ID
    addressStringWallet address
    serverIdStringCurrent server ID
    channelIdStringCurrent channel ID
    starkKeyStringCurrent user starkKey

Validate user's channel-level permissions

Validate user's channel-level permissions

  • Endpoint

    • /channels/{channelId}/permissions/validate
  • Method

    • GET
  • Parameters

    ParametersTypeDescription
    userId String
    Opencord User ID
    groupString
    Resource type you want to validate the target user's permission:
    • 1: server
    • 2: channel
    • 3: membership
    • 4: chat channel
    • 5: voice channel
    • 6: announcement channel
    • 7: forum channel
    • 8: guide channel
    channelIdString
    Target channel ID
    permissionsString
    Permission value which belongs to different permission groups, if you want to verify multiple permissions, you can pass multiple permission values. For example, if you want to verify View Channels and Manage Channels permissions, you can pass "3" (1+2).
    • server:
      • 2:Manage Roles
    • channel:
      • 1:View Channels
      • 2:Manage Channels
    • membership
      • 1: Create Invites
      • 2: Kick
      • 4: Ban
      • 8: Timeout
    • chat:
      • 1: Send Messages
      • 2: Manage Messagess
    • voice:
      • 1: Speak
      • 2: Manage Voices
    • announcement:
      • 1: Manage Announcements
    • forum:
      • 1: Create Posts
      • 2: Reply
      • 4: Manage Posts
      • 8: Mentions
    • guide:
      • 1: Manage Messages
  • Example Value

    {
    "allowed": "5"
    }

    Note: int(allowed) & permission > 0 means the permission was passed.

  • Return Value

    ParametersTypeDescription
    allowedStringValidation request whether the requested permissions are satisfied.

Validate user's server-level permissions

Validate user's server-level permissions

  • Endpoint

    • /servers/{serverId}/permissions/validate
  • Method

    • GET
  • Parameters

    ParametersTypeDescription
    userId String
    Opencord User ID
    groupString
    Resource type you want to validate the target user's permission:
    • 1: server
    • 2: channel
    • 3: membership
    • 4: chat channel
    • 5: voice channel
    • 6: announcement channel
    • 7: forum channel
    • 8: guide channel
    serverIdString
    current server id
    permissionsString
    Permission value which belongs to different permission groups, if you want to verify multiple permissions, you can pass multiple permission values. For example, if you want to verify View Channels and Manage Channels permissions, you can pass "3" (1+2).
    • server:
      • 1:Manage Overview
      • 2:Manage Roles
      • 4:Manage Applications
    • channel:
      • 1:View Channels
      • 2:Manage Channels
    • membership
      • 1: Create Invites
      • 2: Kick
      • 4: Ban
      • 8: Timeout
    • chat:
      • 1: Send Messages
      • 2: Manage Messagess
    • voice:
      • 1: Speak
      • 2: Manage Voices
    • announcement:
      • 1: Manage Announcements
    • forum:
      • 1: Create Posts
      • 2: Reply
      • 4: Manage Posts
      • 8: Mentions
    • guide:
      • 1: Manage Messages
  • Example Value

    {
    "allowed": "5"
    }

    Note: int(allowed) & permission > 0 means you passed the permission.

  • Return Value

    ParametersTypeDescription
    allowedStringValidation request whether the requested permissions are satisfied.

Push notification

  • Endpoint

    • /notify
  • Method

    • POST
  • Parameters

    ParametersTypeDescription
    channelIdString
    Current channel ID
    titleString
    Title of the notification.
    contentString
    Content of the notification
    jumpPathString
    Path to the route that the user should be redirected to upon clicking on the notification. Example: /test
    receiverIdsString[]
    (Optional)
    If not provided, the notification will be sent to all users in the channel by default. Otherwise, it will be sent to the specified users.