Developer API
Build With The thecrimsonmarket.com Discord Bot
Developers can create an app in TCM and use approved OAuth scopes to manage the Discord servers they already control, read useful bot data, and receive webhook events for automations outside Discord.
Setup Steps
- Step 1
Create an app in the TCM developer portal.
- Step 2
Make sure the app owner has a TCM account with Discord linked.
- Step 3
Request the Discord bot API scopes your app needs for read or management actions.
- Step 4
Use OAuth to get an access token for the service.discord audience.
- Step 5
Call API endpoints from your backend. Management calls are checked against the app owner's Discord server permissions.
Available APIs
The API is designed to support the same server-owner workflows as the dashboard. Read scopes can power public giveaway directories, community websites, stats pages, server comparison tools, and custom dashboards. Management scopes can update settings only for servers the app owner is allowed to manage.
/mana/discord/api/v1/statusCheck that the Discord bot API is reachable.
Scope: discordbot:read
/mana/discord/api/v1/giveawaysList public active giveaways across servers using the bot.
Scope: discordbot:read
/mana/discord/api/v1/me/guildsList bot servers the app owner can manage based on their linked Discord account and server permissions.
Scope: discordbot:manage
/mana/discord/api/v1/guilds/{guildId}Read safe public status for a Discord server using the bot.
Scope: discordbot:read
/mana/discord/api/v1/guilds/{guildId}/managementRead dashboard-equivalent configuration data for a server the app owner can manage.
Scope: discordbot:manage
/mana/discord/api/v1/guilds/{guildId}/giveawaysList giveaways for one server.
Scope: discordbot:read
/mana/discord/api/v1/guilds/{guildId}/levels/leaderboardRead server leveling leaderboard data.
Scope: discordbot:leaderboards:read
/mana/discord/api/v1/guilds/{guildId}/economy/leaderboardRead server credit economy leaderboard data.
Scope: discordbot:leaderboards:read
/mana/discord/api/v1/guilds/{guildId}/economy/credits/{discordUserId}Read a member's spendable server credit balance for a server the app owner can manage.
Scope: discordbot:economy:read
/mana/discord/api/v1/guilds/{guildId}/economy/credits/adjustAdd, remove, or set server credits from an external system using an idempotent transaction ID.
Scope: discordbot:economy:write
/mana/discord/api/v1/guilds/{guildId}/giveawaysCreate a giveaway for a server the app owner can manage.
Scope: discordbot:giveaways:write
/mana/discord/api/v1/guilds/{guildId}/leveling/configUpdate server leveling settings, including level roles and level-up webhook rewards.
Scope: discordbot:leveling:write
/mana/discord/api/v1/guilds/{guildId}/economy/configUpdate server economy settings, including reward shop purchase webhooks.
Scope: discordbot:economy:write
/mana/discord/api/v1/guilds/{guildId}/commandsCheck slash-command registration status for a server the app owner can manage.
Scope: discordbot:manage
/mana/discord/api/v1/guilds/{guildId}/commands/refreshRefresh slash commands for a server the app owner can manage.
Scope: discordbot:manage
Owner-Scoped Server Management
A developer app should not become a global bot admin key. The app is tied back to its TCM owner, and that owner's linked Discord ID is used to determine which servers they can manage.
Permission Model
- The developer app belongs to a Portal user account.
- That user account must have a Discord ID stored through linked account data.
- The API uses that Discord ID to find which bot servers the app owner can manage.
- For each guild action, the bot verifies the owner is still a member and has the required Discord permissions, such as Manage Guild or an equivalent admin-level permission.
- Scopes limit what the app is allowed to do even when the owner has Discord permission.
Management Use Cases
- Create, edit, end, reroll, and export giveaways.
- Read and update server leveling, rank card, level role, and level-up webhook settings.
- Read and update server economy, reward shop, purchase webhook, and leaderboard settings.
- Read server credit balances and let approved third-party systems add, remove, or set server credits with idempotent transaction IDs.
- Configure welcome, verification, role panels, tickets, logs, moderation, automations, scheduled messages, and alerts as those API scopes are exposed.
- Read command registration status and trigger command refresh for servers the app owner can manage.
Webhook Integrations
Server owners can also configure outbound webhooks from the dashboard. These are useful when the owner wants their own server to react to bot activity without polling the API.
discord.level_upSent when a member reaches a new server level. Includes guild ID, Discord ID, username/display name, previous and current level, XP totals, source, role rewards, and credit rewards.
Supports API key header and optional HMAC SHA-256 signature.
discord.level_role_rewardSent when a configured level role reward is actually awarded. Includes guild ID, Discord ID, username/display name, previous and current level, reward level, XP totals, source, and the Discord role ID/name.
Supports API key header and optional HMAC SHA-256 signature.
discord.reward_purchaseSent when a member buys a reward shop item. Includes guild ID, Discord ID, item details, purchase ID, status, price, role reward details, and remaining balance.
Supports API key header and optional HMAC SHA-256 signature.
What Apps Can Safely Do
Show Giveaways
Build public pages that help servers promote active giveaways and grow their Discord communities.
Display Progress
Show level leaderboards, rank point standings, and economy leaderboards outside Discord.
Manage Authorized Servers
Apps can be allowed to perform dashboard-style actions for servers where the app owner has the required Discord permissions and the app has the matching OAuth scope.