Migration
Labs API (JavaScript / TypeScript), v1
Overview
This guide helps you move from hand-written HTTP calls or older community clients to the official @conscherry/labs-api v1 package.
Install and initialize
Shell
npm install @conscherry/labs-api
TypeScript
import { LabsApiClient } from '@conscherry/labs-api';const client = new LabsApiClient({ apiKey: process.env.LABS_API_KEY });
Replace manual requests
Swap direct HTTP calls for typed client methods:
TypeScript
1// Before: manual fetch2await 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 },8 body: JSON.stringify({ botId, guildCount, userCount }),9});1011// After: official client12const res = await client.postStats({ botId, guildCount, userCount });
Error handling
- Catch and log the descriptive errors the client throws.
- Validate required fields (
botId,guildCount,userCount). - Retry with backoff on transient network failures.
Need more help?
Ask in our Discord or email support@conscherry.com.