Last Updated: 1/27/2026
Quick Start
Get up and running in 5 minutes.
Prerequisites
- Node.js 18+
- npm, yarn, or pnpm
- An API key (get one here )
:::info Don’t have an API key? Sign up for a free account to get started. :::
Step 1: Install
npm install @example/sdkStep 2: Configure
Create a .env file:
EXAMPLE_API_KEY=your_api_key_hereStep 3: Initialize
import { createClient } from '@example/sdk';
const client = createClient({
apiKey: process.env.EXAMPLE_API_KEY!,
});Step 4: Make Your First Request
// List all users
const users = await client.users.list({
limit: 10,
orderBy: 'createdAt',
});
console.log('Users:', users);
// Get a specific user
const user = await client.users.get('user_123');
console.log('User:', user.name);
// Create a new user
const newUser = await client.users.create({
name: 'Alice Smith',
email: 'alice@example.com',
role: 'admin',
});:::tip
Use async/await for cleaner code. All SDK methods return Promises.
:::
Complete Example
import { createClient, ApiError } from '@example/sdk';
async function main() {
const client = createClient({
apiKey: process.env.EXAMPLE_API_KEY!,
});
try {
// Health check
const status = await client.healthCheck();
console.log('API Status:', status.ok ? 'Healthy' : 'Unhealthy');
// Fetch users
const users = await client.users.list({ limit: 5 });
for (const user of users) {
console.log(`- ${user.name} (${user.email})`);
}
} catch (error) {
if (error instanceof ApiError) {
console.error(`API Error: ${error.code} - ${error.message}`);
} else {
throw error;
}
}
}
main();:::warning
Always handle errors in production code. The SDK throws ApiError for API failures.
:::
Next Steps
| Guide | Description |
|---|---|
| Configuration | Advanced configuration options |
| Authentication | OAuth2 and API key management |
| Error Handling | Handling errors gracefully |
:::danger Never log or expose your API key in client-side code or error messages. :::