Introduction
This one‑page guide shows the essentials: install, authenticate, make your first request, handle webhooks, and understand errors.
Installation
Install the SDK with your package manager:
# npm
npm i @your/sdk
# yarn
yarn add @your/sdk
# pnpm
pnpm add @your/sdk
Authentication
Use your API key in the Authorization
header as a Bearer token.
curl -X GET https://api.example.com/v1/projects -H "Authorization: Bearer YOUR_API_KEY"
Making requests
Here’s a minimal TypeScript example using the SDK.
import { Client } from "@your/sdk";
const client = new Client({ apiKey: process.env.MY_API_KEY! });
async function main() {
const res = await client.projects.list({ limit: 10 });
console.log(res.data);
}
main();
Webhooks
Configure an endpoint to receive event notifications. Verify signatures to ensure authenticity.
// Next.js API route example
import type { NextRequest } from "next/server";
export async function POST(req: NextRequest) {
const raw = await req.text();
const signature = req.headers.get("x-signature");
// TODO: verify signature, then handle event
return new Response("ok");
}
Errors
Standard HTTP status codes with a JSON body. Retry 429s with backoff.
{
"error": {
"type": "rate_limit",
"message": "Too many requests. Try again soon."
}
}