Docs/Getting Started/Authentication

Authentication

Get your API key and authenticate requests.

Most API endpoints require an API key for authentication. You can get one from your bot's edit page on the DiscordForge Dashboard.

How to Get Your API Key

  1. Go to your Dashboard.
  2. Click Edit on the bot you want to manage.
  3. Scroll down to the API Access section.
  4. Click Generate or Regenerate to get your token.

Setting Up the Client

index.ts
1import { ForgeClient } from "discordforge-sdk";
2 
3const forge = new ForgeClient(process.env.FORGE_API_KEY, process.env.FORGE_BOT_ID);

Environment Variables

Store your API key in a .env file and never commit it to version control.

.env
1FORGE_API_KEY=your_api_key_here
2FORGE_BOT_ID=your_bot_discord_id

Authentication Headers

The SDK sends your API key automatically. If you're making raw HTTP requests, include it as either header:

1Authorization: <YOUR_API_KEY>
2// or
3x-api-key: <YOUR_API_KEY>

Public Endpoints

The Get Bot Info endpoint is public and does not require authentication.