Skip to content

AdvanceFTeam/Discord-User-Info-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Avatar API

This Node.js application provides an API for fetching Discord user avatars(pfp).

Installation

  1. Clone this repository.
  2. Install dependencies by running npm install.
npm install cors express node-fetch dotenv
  1. Create a .env file in the root directory and add your Discord bot token:
    DISCORD_BOT_TOKEN=your_discord_bot_token_here
    
  2. Start the server by running cd api first then node index.

Usage

Get Avatar URL

  • Endpoint: /api/:userId
  • Method: GET
  • Parameters:
    • userId (required): Discord user ID for which avatar is to be fetched.
  • Example:
    {
    "id": "773952016036790272",
    "username": "yellowgreg",
    "display_name": null,
    "avatarUrl": "https://cdn.discordapp.com/avatars/773952016036790272/cfe9480144d80fbf9625abf9e66a0b9b.png?size=128"
    }
  • Response: JSON object containing the avatar URL.

Get Avatar Image

  • Endpoint: /api/pfp/:userId/image
  • Method: GET
  • Parameters:
    • userId (required): Discord user ID for which avatar is to be fetched.
    • size (optional): Size of the avatar image. Default is 512.
  • Response: Redirects to the URL of the avatar image.

Get Small Avatar Image

  • Endpoint: /api/pfp/:userId/smallimage
  • Method: GET
  • Parameters:
    • userId (required): Discord user ID for which avatar is to be fetched.
    • size (optional): Size of the avatar image. Default is 128.
  • Response: Redirects to the URL of the avatar image with specified size.

Get Big Avatar Image

  • Endpoint: /api/pfp/:userId/bigimage
  • Method: GET
  • Parameters:
    • userId (required): Discord user ID for which avatar is to be fetched.
    • size (optional): Size of the avatar image. Default is 1024.
  • Response: Redirects to the URL of the avatar image with specified size.

Get Super Big Avatar Image

  • Endpoint: /api/pfp/:userId/superbigimage
  • Method: GET
  • Parameters:
    • userId (required): Discord user ID for which avatar is to be fetched.
    • size (optional): Size of the avatar image. Default is 4096.
  • Response: Redirects to the URL of the avatar image with specified size.

Dependencies

  • express: Fast, unopinionated, minimalist web framework for Node.js.
  • cors: Middleware for enabling Cross-Origin Resource Sharing (CORS) in Express.js.
  • dotenv: Loads environment variables from a .env file into process.env.

License

  • Free to use