Discord Bot API Documentation

Complete guide to integrating with our Discord bot API. Build powerful applications with real-time Discord functionality.

Fast & Reliable

Built for high-performance applications with 99.9% uptime guarantee

Secure

Enterprise-grade security with OAuth2 and rate limiting

Easy Integration

RESTful API with comprehensive SDKs and documentation

Quick Start

Get started with the Discord Bot API in minutes:

bash
curl -X GET 'https://dashboard.tempotide.xyz/api/v1/user/@me' \
  -H 'Authorization: Bearer YOUR_TOKEN'

Authentication

The Discord Bot API uses OAuth2 with bearer tokens for authentication. All API requests must include a valid access token.

Getting Your Token

Follow these steps to obtain your API token:

  1. Navigate to the Discord Developer Portal
  2. Create a new application or select an existing one
  3. Go to the "Bot" section and copy your token
  4. Include the token in your API requests

Authentication Example

javascript
const response = await fetch('https://dashboard.tempotide.xyz/api/v1/user/@me', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_BOT_TOKEN',
    'Content-Type': 'application/json'
  }
});

const user = await response.json();
console.log(user);

Rate Limiting

The API implements rate limiting to ensure fair usage:

  • 1000 requests per hour for authenticated requests
  • 100 requests per hour for unauthenticated requests
  • Rate limit headers are included in all responses
http
HTTP/1.1 200 OK
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200

API Endpoints

Comprehensive list of available endpoints organized by resource type.

User Endpoints

GET /v1/user/@me
Get Current User

Returns information about the current authenticated user.

Response Example

json
{
  "id": "123456789012345678",
  "username": "TestUser",
  "discriminator": "1234",
  "avatar": "a1b2c3d4e5f6g7h8i9j0",
  "bot": true,
  "verified": true,
  "email": "test@example.com"
}
GET /v1/user/{user_id}
Get User by ID

Returns information about a specific user by their ID.

Parameters

Parameter Type Required Description
user_id string Yes The ID of the user to retrieve

Guild Endpoints

GET /v1/guilds
Get User Guilds

Returns a list of guilds the current user is a member of.

Query Parameters

Parameter Type Default Description
limit integer 100 Maximum number of guilds to return (1-200)
before string null Get guilds before this guild ID
after string null Get guilds after this guild ID

Message Endpoints

POST /v1/channels/{channel_id}/messages
Send Message

Send a message to a specific channel.

Request Body

json
{
  "content": "Hello, Discord!",
  "embeds": [
    {
      "title": "Example Embed",
      "description": "This is an example embed",
      "color": 5865242,
      "fields": [
        {
          "name": "Field Name",
          "value": "Field Value",
          "inline": true
        }
      ]
    }
  ]
}

Webhooks

Set up webhooks to receive real-time events from Discord servers.

Event Types

  • message.create - New message posted
  • message.update - Message edited
  • message.delete - Message deleted
  • guild.member.add - User joined guild
  • guild.member.remove - User left guild

Webhook Payload Example

json
{
  "event": "message.create",
  "data": {
    "id": "987654321098765432",
    "content": "Hello from Discord!",
    "author": {
      "id": "123456789012345678",
      "username": "User123",
      "discriminator": "1234"
    },
    "channel_id": "111222333444555666",
    "guild_id": "777888999000111222",
    "timestamp": "2023-12-01T12:00:00.000Z"
  }
}

Code Examples

Ready-to-use code examples in different programming languages.

JavaScript Example

javascript
// Discord Bot API Client
class DiscordBotAPI {
  constructor(token) {
    this.token = token;
    this.baseURL = 'https://dashboard.tempotide.xyz/api/v1//v1';
  }

  async request(endpoint, options = {}) {
    const url = `${this.baseURL}${endpoint}`;
    const config = {
      headers: {
        'Authorization': `Bearer ${this.token}`,
        'Content-Type': 'application/json',
        ...options.headers
      },
      ...options
    };

    const response = await fetch(url, config);
    
    if (!response.ok) {
      throw new Error(`API Error: ${response.status} ${response.statusText}`);
    }
    
    return response.json();
  }

  async getCurrentUser() {
    return this.request('/user/@me');
  }

  async sendMessage(channelId, content) {
    return this.request(`/channels/${channelId}/messages`, {
      method: 'POST',
      body: JSON.stringify({ content })
    });
  }
}

// Usage
const api = new DiscordBotAPI('YOUR_BOT_TOKEN');

async function main() {
  try {
    const user = await api.getCurrentUser();
    console.log('Logged in as:', user.username);
    
    const message = await api.sendMessage('CHANNEL_ID', 'Hello, Discord!');
    console.log('Message sent:', message.id);
  } catch (error) {
    console.error('Error:', error.message);
  }
}

main();

Python Example

python
import requests
import json

class DiscordBotAPI:
    def __init__(self, token):
        self.token = token
        self.base_url = 'https://dashboard.tempotide.xyz/api/v1//v1'
        self.headers = {
            'Authorization': f'Bearer {token}',
            'Content-Type': 'application/json'
        }
    
    def request(self, endpoint, method='GET', data=None):
        url = f'{self.base_url}{endpoint}'
        
        if method == 'GET':
            response = requests.get(url, headers=self.headers)
        elif method == 'POST':
            response = requests.post(url, headers=self.headers, json=data)
        
        response.raise_for_status()
        return response.json()
    
    def get_current_user(self):
        return self.request('/user/@me')
    
    def send_message(self, channel_id, content):
        return self.request(f'/channels/{channel_id}/messages', 
                          method='POST', 
                          data={'content': content})

# Usage
def main():
    api = DiscordBotAPI('YOUR_BOT_TOKEN')
    
    try:
        user = api.get_current_user()
        print(f'Logged in as: {user["username"]}')
        
        message = api.send_message('CHANNEL_ID', 'Hello, Discord!')
        print(f'Message sent: {message["id"]}')
    except requests.exceptions.HTTPError as e:
        print(f'API Error: {e}')

if __name__ == '__main__':
    main()

cURL Example

bash
#!/bin/bash

# Set your bot token
BOT_TOKEN='YOUR_BOT_TOKEN'
BASE_URL='https://dashboard.tempotide.xyz/api/v1//v1'

# Get current user
echo 'Getting current user...'
curl -X GET "$BASE_URL/user/@me" \
  -H "Authorization: Bearer $BOT_TOKEN" \
  -H "Content-Type: application/json"

echo -e '\n\n'

# Send a message
CHANNEL_ID='YOUR_CHANNEL_ID'
echo 'Sending message...'
curl -X POST "$BASE_URL/channels/$CHANNEL_ID/messages" \
  -H "Authorization: Bearer $BOT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Hello from cURL!",
    "embeds": [
      {
        "title": "API Test",
        "description": "This message was sent using cURL",
        "color": 5865242
      }
    ]
  }'

echo -e '\n\n'

# Get guild information
GUILD_ID='YOUR_GUILD_ID'
echo 'Getting guild information...'
curl -X GET "$BASE_URL/guilds/$GUILD_ID" \
  -H "Authorization: Bearer $BOT_TOKEN" \
  -H "Content-Type: application/json"