Skip to main content
Documentation - Discord Docs

Search documentation

Type to search this documentation.

On this pageOverview

Sending Game Data

This guide walks through authorizing requests and sending a first payload to the Application Identity Profile API. For the full API reference, see the Application Identity Profile Resource.

Before you can send game data for a player and write to your widget on their profile, they must link their Discord account to your game. See Account Linking on Web for the web-specific flow, but it is recommended to support an in-game flow as well.

Follow these steps to set up authorization for game stats widgets:

  1. Set up an application in the Developer Portal and note your application ID (client ID)
  2. Get your bot token from the Bot section of your application dashboard
  3. Configure your widget in the Developer Portal
  4. Have the player link their Discord account to your game, requesting the application_identities.write scope. If you are building a Social SDK integration, the Social SDK scopes already include this scope.
  5. After the player completes linking, store the mapping between their Discord user ID and your game's player ID. The player's profile record is created on Discord's side the first time you call the Update Application Identity Profile endpoint for them.
  6. Use the bot token to call the Update Application Identity Profile endpoint for that player

The profile endpoint takes three identifiers in the path:

Identifier Where it comes from
application.id Your application ID from the Developer Portal
user.id The player's Discord user ID, returned during the OAuth2 account linking callback
provider_issued_user_id The player's ID in your game's system (e.g. a database row ID, UUID, or username)

The provider_issued_user_id is not a Discord ID. It's your game's own identifier for the player, stored alongside their Discord user ID when they complete account linking.

Your bot token is passed through the Authorization header:

Authorization: Bot YOUR_TOKEN

/applications/{application.id}/users/{user.id}/identities/{provider_issued_user_id}/profile

The minimal first call looks like this, set a username and a few primary fields for the player:

Bash
curl 'https://discord.com/api/v10/applications/1410709600545542144/users/1410709695433281536/identities/123456789123456789/profile' \
  -X PATCH \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bot YOUR_TOKEN' \
  -d '{
    "username": "johndoe123",
    "data": {
      "primary": {
        "season": "Season 3",
        "rank_name": "Silver",
        "rank_image": {"url": "https://example.com/assets/rank-images/silver.png"},
        "highest_rank": "Platinum",
        "highest_rank_image": {"url": "https://example.com/assets/rank-images/platinum.png"},
        "featured_played_character": "John Doe",
        "featured_played_character_image": {"url": "https://example.com/assets/character-images/john-doe.png"},
        "playtime_hours": 69.41,
        "total_wins": 57,
        "current_period_wins": 8,
        "total_games": 100,
        "current_period_games": 10,
        "total_kills": 253,
        "current_period_kills": 35,
        "total_assists": 478,
        "current_period_assists": 68,
        "total_deaths": 561,
        "current_period_deaths": 21
      }
    }
  }'

Returns 201 Created on first write, 204 No Content on subsequent updates.

For the complete payload shape, available primary fields, dynamic field types, request limits, and error responses, see the Application Identity Profile Resource.

After a successful write, you can read the player's stored profile back with the Get Application Identity Profile endpoint:

/applications/{application.id}/users/{user.id}/identities/{provider_issued_user_id}/profile

Bash
curl 'https://discord.com/api/v10/applications/1410709600545542144/users/1410709695433281536/identities/123456789123456789/profile' \
  -H 'Authorization: Bot YOUR_TOKEN'
JSON
{
  "username": "johndoe123",
  "metadata": null,
  "data": {
    "primary": {
      "season": "Season 3",
      "rank_name": "Silver",
      "rank_image": {"url": "https://example.com/assets/rank-images/silver.png"},
      "highest_rank": "Platinum",
      "highest_rank_image": {"url": "https://example.com/assets/rank-images/platinum.png"},
      "featured_played_character": "John Doe",
      "featured_played_character_image": {"url": "https://example.com/assets/character-images/john-doe.png"},
      "playtime_hours": 69.41,
      "total_wins": 57,
      "current_period_wins": 8,
      "total_games": 100,
      "current_period_games": 10,
      "total_kills": 253,
      "current_period_kills": 35,
      "total_assists": 478,
      "current_period_assists": 68,
      "total_deaths": 561,
      "current_period_deaths": 21
    }
  }
}
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu