- 0.37.105Latest
- 0.37.104
- 0.37.102
- 0.37.102
- 0.37.101
- 0.37.101
- 0.37.100
- 0.37.99
- 0.37.98
- 0.37.97
- 0.37.96
- 0.37.94
- 0.37.93
- 0.37.92
- 0.37.91
- 0.37.90
- 0.37.89
- 0.37.88
- 0.37.88
- 0.37.87
- 0.37.86
- 0.37.85
- 0.37.84
- 0.37.83
- 0.37.82
- 0.37.81
- 0.37.80
- 0.37.79
- 0.37.78
- 0.37.76
- 0.37.75
- 0.37.75
- 0.37.74
- 0.37.73
- 0.37.71
- 0.37.70
- 0.37.69
- 0.37.68
- 0.37.67
- 0.37.66
- 0.37.65
- 0.37.64
- 0.37.63
- 0.37.62
- 0.37.62
- 0.37.61
- 0.37.60
- 0.37.59
- 0.37.58
- 0.37.57
- 0.37.56
- 0.37.55
- 0.37.55
- 0.37.54
- 0.37.53
- 0.37.52
- 0.37.51
- 0.37.50
- 0.37.49
- 0.37.48
- 0.37.47
- 0.37.46
- 0.37.45
- 0.37.45
- 0.37.44
- 0.37.44
- 0.37.43
- 0.37.42
- 0.37.41
- 0.37.40
- 0.37.39
- 0.37.38
- 0.37.37
- 0.37.37
- 0.37.36
- 0.37.35
- 0.37.34
- 0.37.33
- 0.37.32
- 0.37.32
- 0.37.30
- 0.37.29
- 0.37.28
- 0.37.27
- 0.37.26
- 0.37.25
- 0.37.24
- 0.37.23
- 0.37.22
- 0.37.21
- 0.37.20
- 0.37.20
- 0.37.20
- 0.37.20
- 0.37.20
- 0.37.19
- 0.37.18
- 0.37.17
- 0.37.16
- 0.37.15
- 0.37.14
- 0.37.13
- 0.37.12
- 0.37.11
- 0.37.10
- 0.37.9
- 0.37.8
- 0.37.7
- 0.37.6
- 0.37.5
- 0.37.4
- 0.37.3
- 0.37.2
- 0.37.1
- 0.37.0
- 0.36.3
- 0.36.2
- 0.36.1
- 0.36.0
- 0.35.0
- 0.34.0
- 0.33.5
- 0.33.4
- 0.33.3
- 0.33.2
- 0.33.1
- 0.33.0
- 0.32.1
- 0.32.0
- 0.32.0
- 0.31.2
- 0.31.1
- 0.31.0
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.3
- 0.27.2
- 0.27.1
- 0.27.0
- 0.26.1
- 0.26.0
- 0.25.2
- 0.25.1
- 0.25.0
- 0.24.0
- 0.23.1
- 0.23.0
- 0.22.0
- 0.22.0
- 0.20.2
- 0.20.1
- 0.21.0
- 0.20.0
- 0.19.0
- v1.0.0
- 0.18.1
- 0.18.0
- 0.17.0
- 0.16.0
- 0.15.1
- 0.15.0
- 0.14.0
- 0.13.3
- 0.13.2
- 0.13.1
- 0.13.0
- 1
- 0.12.1
- 0.12.0
Discord API Types
Simple type definitions for the Discord API.
Installation
Install with npm / yarn / pnpm:
npm install discord-api-types
yarn add discord-api-types
pnpm add discord-api-types
We also provide typings compatible with the deno runtime. You have 3 ways you can import them:
- Directly from GitHub
// Importing the default API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/mod.ts';
// Importing a specific API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v8/mod.ts';
- From deno.land/x
// Importing the default API version
import { APIUser } from 'https://deno.land/x/discord_api_types@0.12.0/mod.ts';
// Importing a specific API version
import { APIUser } from 'https://deno.land/x/discord_api_types@0.12.0/v8/mod.ts';
- From skypack.dev
// Importing the default API version
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types?dts';
// Importing a specific API version
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v8?dts';
Project Structure
The exports of each API version is split into three main parts:
Everything exported with the
API
prefix represents a payload you may get from the REST API or the Gateway.Everything exported with the
Gateway
prefix represents data that ONLY comes from or is directly related to the Gateway.Everything exported with the
REST
prefix represents data that ONLY comes from or is directly related to the REST API.For endpoint options, they will follow the following structure:
REST<HTTP Method><Type><Query|(JSON|FormData)Body|Result>
where the type represents what it will return.For example,
RESTPostAPIChannelMessageJSONBody
orRESTGetAPIGatewayBotInfoResult
.Some exported types (specifically OAuth2 related ones) may not respect this entire structure due to the nature of the fields. They will start with either
RESTOAuth2
or with something similar toREST<HTTP Method>OAuth2
If a type ends with
Result
, then it represents the expected result by calling its accompanying route.- Types that are exported as
never
usually mean the result will be a204 No Content
, so you can safely ignore it. This does not account for errors.
- Types that are exported as
Anything else that is miscellaneous will be exported based on what it represents (for example the
REST
route object).There may be types exported that are identical for all versions. These will be exported as is and can be found in the
common
directory. They will still be prefixed accordingly as described above.
Warning: This package documents just KNOWN (and documented) properties. Anything that isnāt documented will NOT be added to this package (unless said properties are in an open Pull Request to Discordās API Documentation repository or known through other means and have received the green light to be used). For clarificationās sake, this means that properties that are only known through the process of data mining and have not yet been confirmed in a way as described will NOT be included.
Usage
You can require
/ import
the module directly, which will give you the latest types as of the current API version. This is considered the default
version and will be updated according to Discordās default API version; this means it may break at any point in time.
We strongly recommend you use a version when importing this module! This will prevent breaking changes when updating the module.
const { APIUser } = require('discord-api-types');
// TypeScript/ES Module support
import { APIUser } from 'discord-api-types';
You should instead consider adding the API version you want to target by appending /v*
, where the *
represents the API version.
const { APIUser } = require('discord-api-types/v8');
// TypeScript/ES Module support
import { APIUser } from 'discord-api-types/v8';