Skip to content

Instantly share code, notes, and snippets.

@apeckham
Created July 7, 2023 22:44
Show Gist options
  • Save apeckham/16899bd111279c72e3be3619e3cdb5c7 to your computer and use it in GitHub Desktop.
Save apeckham/16899bd111279c72e3be3619e3cdb5c7 to your computer and use it in GitHub Desktop.
discord openapi spec
openapi: "3.0.0"
info:
title: "Discord API"
version: "1.0.0"
servers:
- url: "https://discord.com/api"
paths:
/oauth2/token:
post:
summary: "Refresh the access token"
operationId: "refreshToken"
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: "object"
required:
- client_id
- client_secret
- grant_type
- refresh_token
properties:
client_id:
type: "string"
client_secret:
type: "string"
grant_type:
type: "string"
refresh_token:
type: "string"
responses:
'200':
description: "Refreshed Token"
content:
application/json:
schema:
type: "object"
properties:
access_token:
type: "string"
description: "Access token"
token_type:
type: "string"
description: "Type of the token"
expires_in:
type: "integer"
description: "Token expiration time in seconds"
refresh_token:
type: "string"
description: "Refresh token"
scope:
type: "string"
description: "Scope of the token"
/oauth2/token/revoke:
post:
summary: "Revoke a given token"
operationId: "revokeToken"
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: "object"
required:
- client_id
- client_secret
- token
properties:
client_id:
type: "string"
client_secret:
type: "string"
token:
type: "string"
responses:
'200':
description: "Token Revoked"
content:
text/plain:
schema:
type: string
/users/@me:
get:
summary: "Retrieve the current user"
operationId: "getCurrentUser"
responses:
'200':
description: "Current User"
content:
application/json:
schema:
$ref: "#/components/schemas/User"
/users/@me/guilds:
get:
summary: "Retrieve the guilds for the current user"
operationId: "getGuilds"
responses:
'200':
description: "Current User's Guilds"
content:
application/json:
schema:
type: "array"
items:
type: "object"
properties:
id:
type: "string"
description: "the id of the guild"
name:
type: "string"
description: "the name of the guild"
icon:
type: "string"
description: "the icon hash of the guild"
owner:
type: "boolean"
description: "whether the user is the owner of the guild"
permissions:
type: "string"
description: "the permissions the user has in the guild"
features:
type: "array"
items:
type: "string"
description: "the features of the guild"
/users/@me/guilds/{guildId}/member:
get:
summary: "Retrieve a member in a given guild"
operationId: "getCurrentUserGuildMember"
parameters:
- name: "guildId"
in: "path"
required: true
schema:
type: "string"
responses:
'200':
description: "Guild Member"
content:
application/json:
schema:
type: "object"
properties:
user:
type: "object"
description: "the user this guild member represents"
nick:
type: "string"
nullable: true
description: "this user's guild nickname"
avatar:
type: "string"
nullable: true
description: "the member's guild avatar hash"
roles:
type: "array"
items:
type: "string"
description: "array of role object ids"
joined_at:
type: "string"
format: "date-time"
description: "when the user joined the guild"
deaf:
type: "boolean"
description: "whether the user is deafened in voice channels"
mute:
type: "boolean"
description: "whether the user is muted in voice channels"
flags:
type: "integer"
description: "guild member flags represented as a bit set, defaults to 0"
pending:
type: "boolean"
nullable: true
description: "whether the user has not yet passed the guild's Membership Screening requirements"
permissions:
type: "string"
nullable: true
description: "total permissions of the member in the channel, including overwrites, returned when in the interaction object"
communication_disabled_until:
type: "string"
format: "date-time"
nullable: true
description: "when the user's timeout will expire and the user will be able to communicate in the guild again, null or a time in the past if the user is not timed out"
'404':
description: "Not Found"
components:
schemas:
User:
type: "object"
properties:
id:
type: "string"
description: "The user's id"
username:
type: "string"
description: "The user's username"
discriminator:
type: "string"
description: "The user's Discord-tag"
global_name:
type: "string"
nullable: true
description: "The user's display name"
avatar:
type: "string"
nullable: true
description: "The user's avatar hash"
bot:
type: "boolean"
nullable: true
description: "Whether the user belongs to an OAuth2 application"
system:
type: "boolean"
nullable: true
description: "Whether the user is an Official Discord System user"
mfa_enabled:
type: "boolean"
nullable: true
description: "Whether the user has two factor enabled on their account"
banner:
type: "string"
nullable: true
description: "The user's banner hash"
accent_color:
type: "integer"
nullable: true
description: "The user's banner color encoded as an integer representation of hexadecimal color code"
locale:
type: "string"
nullable: true
description: "The user's chosen language option"
verified:
type: "boolean"
nullable: true
description: "Whether the email on this account has been verified"
email:
type: "string"
nullable: true
description: "The user's email"
flags:
type: "integer"
nullable: true
description: "The flags on a user's account"
premium_type:
type: "integer"
nullable: true
description: "The type of Nitro subscription on a user's account"
public_flags:
type: "integer"
nullable: true
description: "The public flags on a user's account"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment