Read the DJ identifier
Find out which DJ your token belongs to. It works any time, on air or not.
When the same DJ consents again, a new token pair is issued and the previous tokens stay
valid. Save the userId from this API as soon as you receive a token, and you can merge
multiple tokens for the same DJ into one.
| Method and path | GET /v1/me |
| Permission | me.read |
| Success | 200 |
| When not on air | Still 200 — independent of the broadcast |
export SPOON_BASE_URL="https://kr-openapi.spooncast.net"
export SPOON_ACCESS_TOKEN="{your access token}"
For the Japan region use https://jp-openapi.spooncast.net — see regions.
Request
GET /v1/me
Headers
| Name | Required | Description |
|---|---|---|
Authorization | ✔ | Bearer {access_token}. |
There are no path parameters, query parameters, or request body.
The token decides whose identifier you get — the DJ who consented to that token.
Request example
curl -H "Authorization: Bearer $SPOON_ACCESS_TOKEN" "$SPOON_BASE_URL/v1/me"
Response
{
"userId": "Ab1Cd2Ef3Gh4Ij5Kl6Mn7O"
}
| Field | Type | Null | Description |
|---|---|---|---|
userId | string | no | The unique identifier of the DJ this token points at. |
userIduserId is this DJ's unique identifier. It is always the same value for the same DJ, so use
it as the key for token bookkeeping and accumulated data. It is the same value as the
user.id that arrives on the event stream when this DJ chats.
Its scope is the pair of your bot and that DJ. It survives the DJ disconnecting and consenting again.
Code
// me.ts — node --experimental-strip-types me.ts
interface Me {
userId: string;
}
const res = await fetch(`${process.env.SPOON_BASE_URL}/v1/me`, {
headers: { Authorization: `Bearer ${process.env.SPOON_ACCESS_TOKEN}` },
});
if (!res.ok) throw new Error(`Identifier lookup failed: ${res.status}`);
const { userId } = (await res.json()) as Me;
// If a token for this userId already exists, overwrite it with this one — one DJ, one token set
console.log(`This token's DJ: ${userId}`);
node --experimental-strip-types me.ts
Watch out
Call it once, right after you receive a token, and save the result. When the same DJ
consents again the previous tokens are not revoked, so without userId you cannot tell
whether two tokens belong to the same DJ. If the same userId already exists, overwrite it
with the new token and revoke the old one.
It is the DJ's own value, not a listener's. Listener identifiers come from the event stream and the listener list.
The value is only consistent inside your app. Another app gets a different value for the same DJ. Apps cannot compare values to find the same person.
Errors
| HTTP | detailCode | What happened | What to do |
|---|---|---|---|
401 | none | The token is missing or invalid. | Ask the DJ to authorize again. |
403 | none | The me.read permission is missing. | Add the permission and get consent again. |
States outside this table can arrive too. A wrong method or Content-Type (400 ·
405 · 415 — OAPI_MNGR_0103), the call quota (429, no body), and server errors
(500 — OAPI_MNGR_1002) are common to every endpoint — see
Error codes.
Related documents
- Endpoint list — the full endpoint list.
- Tokens — issue, refresh, and revoke. Use this API with it to clean up duplicate tokens.
- Event stream —
user.idworks the same way as this value. - Error codes — the full list of error codes.