# Discord

Free

A /rate slash command for your Discord server, served from a signature-verified interactions endpoint (Ed25519).

[API reference](/content/docs/api/index.html)

## Examples

`/rate from:USD to:EUR``/rate from:USD to:EUR amount:100`

## Setup

1. 1

### Create an application

At discord.com/developers/applications, create a New Application. On General Information, copy the Public Key and Application ID.

2. 2

### Set the public key

On the Rate-API server, add the public key to .env and re-cache config (do this before saving the endpoint URL, or Discord’s verification ping will fail).

```
DISCORD_PUBLIC_KEY=your_application_public_key_here
php artisan config:cache
```

3. 3

### Set the interactions endpoint

Back in the Discord portal, set Interactions Endpoint URL to the address below and save - it should verify with a ✓.

```
https://rate-api.com/integrations/discord
```

4. 4

### Register the /rate command

Run this once with your App ID and Bot token. Global commands can take up to an hour to appear.

```
DISCORD_APP_ID=... DISCORD_BOT_TOKEN=... node register-commands.mjs
```

5. 5

### Add it to your server

Use OAuth2 → URL Generator with the applications.commands scope to invite the app.

## Endpoint

`POST https://rate-api.com/integrations/discord`

Verified by the platform’s request signature. It safely returns “not configured” until its secret is set on the server.
