- 0.37.104Latest
- 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
Usage
You can only import this module by specifying the API version you want to target. Append /v*
to the import path, where the *
represents the API version. Below are some examples
const { APIUser } = require('discord-api-types/v10');
// TypeScript/ES Module support
import { APIUser } from 'discord-api-types/v10';
You may also import just certain parts of the module that you need. The possible values are: globals
, gateway
, gateway/v*
, payloads
, payloads/v*
, rest
, rest/v*
, rpc
, rpc/v*
, utils
, utils/v*
, voice
, and voice/v*
. Below are some examples
const { GatewayVersion } = require('discord-api-types/gateway/v10');
// TypeScript/ES Module support
import { GatewayVersion } from 'discord-api-types/gateway/v10';
Note: The
v*
exports (discord-api-types/v*
) include the appropriate version ofgateway
,payloads
,rest
,rpc
, andutils
you specified, alongside theglobals
exports
Deno
We also provide typings compatible with the deno runtime. You have 3 ways you can import them:
- Directly from GitHub
// Importing a specific API version
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v10.ts';
- From deno.land/x
// Importing a specific API version
import { APIUser } from 'https://deno.land/x/discord_api_types/v10.ts';
- From skypack.dev
// Importing a specific API version
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v10?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
globals
file. They will still be prefixed accordingly as described above.
A note about how types are documented: This package will add types only for known and documented properties that are present in Discord’s API Documentation repository, that are mentioned in an open pull request, or known through other means and have received the green light to be used. Anything else will not be documented (for example client only types).
With that aside, we may allow certain types that are not documented in the API Documentation repository on a case by case basis.
They will be documented with an @unstable
tag and are not subject with the same versioning rules.