API Data Provider - Online Help

Connecting to Discord

Using OAuth Authentication

Discord uses OAuth 2.0 for authentication. You will need to create an OAuth application in the Discord Developer Portal to obtain your client credentials.

Setting Up OAuth Application

  1. Visit the Discord Developer Portal
  2. Click "New Application" and provide a name
  3. Navigate to the OAuth2 section
  4. Add a redirect URL (e.g., http://localhost:33333 for desktop applications)
  5. Copy your Client ID and Client Secret

Connection Properties

After setting the following connection properties, you are ready to connect:

  • AuthScheme: Set this to OAuth.
  • InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to manage the process to obtain the OAuthAccessToken.
  • OAuthClientId: Set this to your Discord application's Client ID.
  • OAuthClientSecret: Set this to your Discord application's Client Secret.
  • Scope: Set this to the required OAuth scopes (default: "identify email guilds").
  • CallbackURL: Set this to the redirect URL configured in your Discord application.

Example OAuth Connection String

Profile=C:\profiles\Discord.apip;ProfileSettings='Scope=identify email guilds';AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;CallbackURL=http://localhost:33333;

Using Bot Token Authentication

For server-to-server operations, you can use Discord Bot Token authentication.

Setting Up Bot Application

  1. Visit the Discord Developer Portal
  2. Create a new application or select an existing one
  3. Navigate to the "Bot" section
  4. Create a bot if one doesn't exist
  5. Copy the Bot Token
  6. Configure the bot permissions as needed

Bot Token Connection Properties

After setting the following connection properties, you are ready to connect:

  • AuthScheme: Set this to APIKey.
  • APIKey: Set this to your Discord Bot Token (without the "Bot " prefix).

Example Bot Token Connection String

Profile=C:\profiles\Discord.apip;AuthScheme=APIKey;ProfileSettings='APIKey=your_bot_token_here';

Available OAuth Scopes

  • identify: Access to basic user account information
  • email: Access to user's email address
  • guilds: Access to user's guilds (servers)
  • guilds.join: Join guilds on behalf of user
  • guilds.members.read: Access to guild member information
  • bot: Access for bot operations (requires bot account)
  • connections: Access to user's connected accounts (Steam, Spotify, etc.)
  • messages.read: Read message history
  • applications.commands: Create and manage application commands
  • webhook.incoming: Create incoming webhooks
  • activities.read: Access to user activities (Rich Presence)
  • activities.write: Update user activities (Rich Presence)
  • relationships.read: Access to user relationships (friends)
  • voice: Connect to voice channels

Usage Examples

Application Management

Application:

SELECT * FROM Application

ApplicationCommands:

SELECT * FROM ApplicationCommands WHERE ApplicationId = '123456789'

ApplicationEmojis:

SELECT * FROM ApplicationEmojis WHERE ApplicationId = '123456789'

ApplicationEntitlements:

SELECT * FROM ApplicationEntitlements WHERE ApplicationId = '123456789'

ApplicationRoleConnectionMetadata:

SELECT * FROM ApplicationRoleConnectionMetadata WHERE ApplicationId = '123456789'

ApplicationSKUs:

SELECT * FROM ApplicationSKUs WHERE ApplicationId = '123456789'

ApplicationActivityInstance:

SELECT * FROM ApplicationActivityInstance WHERE ApplicationId = '123456789' AND InstanceId = 'instance_123'

User Information

CurrentUser:

SELECT * FROM CurrentUser

CurrentUserGuilds:

SELECT * FROM CurrentUserGuilds

User:

SELECT * FROM User WHERE Id = '123456789'

UserConnections:

SELECT * FROM UserConnections

CurrentAuthorization:

SELECT * FROM CurrentAuthorization

CurrentUserApplicationRoleConnection:

SELECT * FROM CurrentUserApplicationRoleConnection WHERE ApplicationId = '123456789'

Guild Management

Guild:

SELECT * FROM Guild WHERE Id = '123456789'

GuildMembers:

SELECT * FROM GuildMembers WHERE GuildId = '123456789'

GuildRoles:

SELECT * FROM GuildRoles WHERE GuildId = '123456789'

Channels:

SELECT * FROM Channels WHERE GuildId = '123456789'

GuildEmojis:

SELECT * FROM GuildEmojis WHERE GuildId = '123456789'

GuildIntegrations:

SELECT * FROM GuildIntegrations WHERE GuildId = '123456789'

GuildBans:

SELECT * FROM GuildBans WHERE GuildId = '123456789'

GuildAuditLogs:

SELECT * FROM GuildAuditLogs WHERE GuildId = '123456789'

GuildPreview:

SELECT * FROM GuildPreview WHERE GuildId = '123456789'

GuildWidget:

SELECT * FROM GuildWidget WHERE GuildId = '123456789'

GuildWidgetSettings:

SELECT * FROM GuildWidgetSettings WHERE GuildId = '123456789'

GuildVanityUrl:

SELECT * FROM GuildVanityUrl WHERE GuildId = '123456789'

GuildWelcomeScreen:

SELECT * FROM GuildWelcomeScreen WHERE GuildId = '123456789'

GuildOnboarding:

SELECT * FROM GuildOnboarding WHERE GuildId = '123456789'

GuildPruneCount:

SELECT * FROM GuildPruneCount WHERE GuildId = '123456789'

GuildTemplates:

SELECT * FROM GuildTemplates WHERE GuildId = '123456789'

CurrentUserGuildMember:

SELECT * FROM CurrentUserGuildMember WHERE GuildId = '123456789'

GuildActiveThreads:

SELECT * FROM GuildActiveThreads WHERE GuildId = '123456789'

GuildSoundboardSounds:

SELECT * FROM GuildSoundboardSounds WHERE GuildId = '123456789'

Channel Operations

Channels:

SELECT * FROM Channels WHERE Id = '987654321'

ChannelMessages:

SELECT * FROM ChannelMessages WHERE ChannelId = '123456789'

ChannelPins:

SELECT * FROM ChannelPins WHERE ChannelId = '123456789'

ChannelMessagePins:

SELECT * FROM ChannelMessagePins WHERE ChannelId = '123456789'

ChannelThreadMembers:

SELECT * FROM ChannelThreadMembers WHERE ChannelThreadId = '123456789'

ChannelPublicArchivedThreads:

SELECT * FROM ChannelPublicArchivedThreads WHERE ChannelId = '123456789'

ChannelPrivateArchivedThreads:

SELECT * FROM ChannelPrivateArchivedThreads WHERE ChannelId = '123456789'

UserJoinedPrivateArchivedThreads:

SELECT * FROM UserJoinedPrivateArchivedThreads WHERE ChannelId = '123456789'

StageInstanceDetails:

SELECT * FROM StageInstanceDetails WHERE ChannelId = '123456789'

Message and Reaction Management

MessageReactions:

SELECT * FROM MessageReactions WHERE ChannelId = '123456789' AND MessageId = '987654321' AND Emoji = '�'

PollAnswerVoters:

SELECT * FROM PollAnswerVoters WHERE ChannelId = '123456789' AND MessageId = '987654321' AND AnswerId = '1'

Application Commands

GuildApplicationCommands:

SELECT * FROM GuildApplicationCommands WHERE GuildId = '123456789' AND ApplicationId = '987654321'

GuildApplicationCommandPermissions:

SELECT * FROM GuildApplicationCommandPermissions WHERE GuildId = '123456789' AND ApplicationId = '987654321'

Events and Scheduling

GuildScheduledEvents:

SELECT * FROM GuildScheduledEvents WHERE GuildId = '123456789'

GuildScheduledEventUsers:

SELECT * FROM GuildScheduledEventUsers WHERE GuildId = '123456789' AND EventId = '987654321'

Moderation and Security

AutoModerationRules:

SELECT * FROM AutoModerationRules WHERE GuildId = '123456789'

Voice State Management

UserVoiceState:

SELECT * FROM UserVoiceState WHERE GuildId = '123456789' AND UserId = '987654321'

CurrentUserVoiceState:

SELECT * FROM CurrentUserVoiceState WHERE GuildId = '123456789'

VoiceRegions:

SELECT * FROM VoiceRegions

Invites:

SELECT * FROM Invites WHERE ChannelId = '123456789'

Subscriptions and Commerce

SKUSubscriptions:

SELECT * FROM SKUSubscriptions WHERE SkuId = '123456789' AND SubscriptionId = '987654321'

Stickers and Media

Stickers:

SELECT * FROM Stickers WHERE WebhookId = '123456789'

StickerPacks:

SELECT * FROM StickerPacks

DefaultSoundboardSounds:

SELECT * FROM DefaultSoundboardSounds

Gateway and Connection

Gateway:

SELECT * FROM Gateway

GatewayBot:

SELECT * FROM GatewayBot

Connection Properties

The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.


Property Description
APIKey The Discord Bot Token used for authentication when AuthScheme is set to APIKey.
AuthScheme The scheme used for authentication. Accepted entries are OAuth, APIKey, or None.
Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT
CallbackURL Identifies the URL users return to after authenticating to API via OAuth (Custom OAuth applications only).
InitiateOAuth Specifies the process for obtaining or refreshing the OAuth access token, which maintains user access while an authenticated, authorized user is working.
Allowed values are: OFF, GETANDREFRESH, REFRESH
OAuthClientId Specifies the client ID (also known as the consumer key) assigned to your custom OAuth application. This ID is required to identify the application to the OAuth authorization server during authentication.
OAuthClientSecret Specifies the client secret assigned to your custom OAuth application. This confidential value is used to authenticate the application to the OAuth authorization server. (Custom OAuth applications only.).
Scope Scope(s) to use when authenticating, that control access to specific information.

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 25.0.9539.0