SDK Reference
Configuration
All options passed to the Staffify constructor.
TypeScript
const client = new Staffify({
apiKey: 'sfy_live_YOUR_KEY', // required
baseUrl: 'https://api.staffifyai.com/v1', // optional
maxRetries: 3, // optional, default 3
timeout: 30000, // optional, default 30000ms
projectId: 'proj_abc', // optional, for org keys
});Options
| Option | Type | Default | Description |
|---|---|---|---|
| apiKey | string | — | Required. Your API key. Project keys start with sfy_live_, org keys with sfy_org_. |
| baseUrl | string | https://api.staffifyai.com/v1 | Override the base URL. Useful for testing against a local proxy. |
| maxRetries | number | 3 | Maximum number of retries on 429 and 5xx responses. Set to 0 to disable retries. |
| timeout | number | 30000 | Request timeout in milliseconds. Requests that exceed this throw an AbortError. |
| projectId | string | — | Sets the X-Project-Id header on every request. Required when using an org key (sfy_org_) to scope requests to a specific project. |
Org keys and project scoping
TypeScript
// Org key — must specify projectId
const client = new Staffify({
apiKey: process.env.STAFFIFY_ORG_KEY,
projectId: 'proj_abc',
});
// Or manage multiple project clients separately
const projectAClient = new Staffify({ apiKey: orgKey, projectId: 'proj_a' });
const projectBClient = new Staffify({ apiKey: orgKey, projectId: 'proj_b' });Retry behaviour
The SDK automatically retries 429 and 5xx responses with exponential backoff. On a 429, it waits until the time indicated by the X-RateLimit-Reset header before retrying. Set maxRetries: 0 to disable automatic retries and handle them yourself.
Environment variables
Store your API key in a .env file and load it with dotenv or the native Node.js --env-file flag. Never commit API keys to source control.