API 1.0.0REST APIStable
Code Examples
Practical examples to get you started with the Discord Labs API
Post your stats
Requires an API key. Post at most once every 5 minutes; hourly is recommended.
JavaScript
1async function postStats(botId, guildCount, userCount) {2 const response = await fetch('https://labs.conscherry.com/api/v1/stats', {3 method: 'POST',4 headers: {5 'Authorization': `Bearer ${process.env.LABS_API_KEY}`,6 'Content-Type': 'application/json',7 'X-SDK-Name': 'my-client',8 'X-SDK-Version': '1.0.0',9 'X-SDK-Lang': 'javascript',10 },11 body: JSON.stringify({ botId, guildCount, userCount }),12 });13 return response.json();14}
List popular bots
Public endpoint, no key needed.
JavaScript
1async function getBots() {2 const response = await fetch('https://labs.conscherry.com/api/v1/bots?limit=10&sort=-votes');3 const { success, data } = await response.json();4 if (success) console.log(data);5}
Good habits
Use environment variables
Never hardcode API keys. Read them from env vars or a secrets manager.
Handle errors gracefully
Retry with backoff and respect the 429 Retry-After header.
Next steps
Need more help?
Ask in our Discord or email support@conscherry.com.