Documentation Index
Fetch the complete documentation index at: https://docs.killb.com/llms.txt
Use this file to discover all available pages before exploring further.
KillB returns standardized error responses:
{
"errorCode": "USER.0001",
"message": ["User not found"],
"statusCode": "404",
"arguments": [
{
"key": "userId",
"value": "invalid-id"
}
]
}
HTTP Status Codes
| Status | Meaning | Action |
|---|
200 | Success | Process response |
201 | Created | Resource created successfully |
400 | Bad Request | Fix request parameters |
401 | Unauthorized | Refresh token |
403 | Forbidden | Check permissions |
404 | Not Found | Resource doesn’t exist |
409 | Conflict | Resource already exists |
429 | Too Many Requests | Implement backoff |
500 | Server Error | Retry with backoff |
Common Error Codes
Authentication Errors
| Code | Message | Solution |
|---|
AUTH.0001 | Invalid credentials | Check email/password |
AUTH.0002 | Token expired | Refresh access token |
AUTH.0003 | Invalid token | Re-authenticate |
User Errors
| Code | Message | Solution |
|---|
USER.0001 | User not found | Verify user ID |
USER.0002 | Invalid document | Check document format |
USER.0003 | Email already exists | Use different email |
USER.0004 | Underage user | User must be 18+ |
Account Errors
| Code | Message | Solution |
|---|
ACCOUNT.0001 | Account not found | Verify account ID |
ACCOUNT.0002 | Invalid bank code | Check supported banks |
ACCOUNT.0003 | Invalid wallet address | Validate address format |
Ramp Errors
| Code | Message | Solution |
|---|
RAMP.0001 | Quotation expired | Create new quotation |
RAMP.0002 | Insufficient balance | Check pre-fund balance |
RAMP.0003 | User limit exceeded | Upgrade KYC level |
RAMP.0004 | Invalid account | Verify account status |
Error Handling Strategy
class KillBAPIError extends Error {
constructor(response) {
super(response.message.join(', '));
this.errorCode = response.errorCode;
this.statusCode = response.statusCode;
this.arguments = response.arguments;
}
}
const makeAPIRequest = async (endpoint, options) => {
try {
const response = await fetch(endpoint, options);
if (!response.ok) {
const error = await response.json();
throw new KillBAPIError(error);
}
return await response.json();
} catch (error) {
if (error instanceof KillBAPIError) {
// Handle API errors
console.error(`API Error ${error.errorCode}:`, error.message);
if (error.statusCode === '401') {
// Token expired, refresh
await refreshToken();
return makeAPIRequest(endpoint, options);
}
if (error.errorCode === 'RAMP.0001') {
// Quotation expired, get new one
const newQuote = await getNewQuotation();
// Retry with new quote
}
}
throw error;
}
};
Retry Logic
Implement exponential backoff:
const retryWithBackoff = async (fn, maxRetries = 3) => {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (i === maxRetries - 1) throw error;
// Don't retry client errors (4xx)
if (error.statusCode && error.statusCode < 500) {
throw error;
}
// Exponential backoff
const delay = Math.pow(2, i) * 1000;
await new Promise(resolve => setTimeout(resolve, delay));
}
}
};
// Usage
const user = await retryWithBackoff(() => createUser(userData));
User-Friendly Messages
Map technical errors to user messages:
const getUserMessage = (error) => {
const messages = {
'AUTH.0002': 'Your session expired. Please log in again.',
'USER.0003': 'This email is already registered.',
'RAMP.0001': 'The price quote expired. Please try again.',
'RAMP.0003': 'Transaction amount exceeds your limit. Please verify your identity to increase limits.'
};
return messages[error.errorCode] || 'An error occurred. Please try again.';
};
Next Steps
Rate Limits
Understanding API rate limits
Best Practices
Production integration tips