Error Handling
All Intotes API errors follow a consistent JSON format, making it easy to handle errors programmatically.
Error Response Formatβ
{
"error": {
"code": "ERROR_CODE",
"message": "Human-readable description of the error"
}
}
| Field | Type | Description |
|---|---|---|
code | string | Machine-readable error code (e.g., INSUFFICIENT_BALANCE) |
message | string | Human-readable English description |
HTTP Status Codesβ
| Status | Meaning | When |
|---|---|---|
400 | Bad Request | Validation error or business rule violation |
401 | Unauthorized | Missing or invalid authentication |
403 | Forbidden | Insufficient permissions (e.g., not a creator) |
404 | Not Found | Resource does not exist |
409 | Conflict | Duplicate resource (e.g., email already registered) |
429 | Too Many Requests | Rate limit exceeded |
500 | Internal Server Error | Unexpected server error |
Common Error Codesβ
Authentication Errorsβ
| Code | Description |
|---|---|
INVALID_CREDENTIALS | Wrong email or password |
EMAIL_NOT_VERIFIED | Email verification required |
TOKEN_EXPIRED | Access token has expired |
UNAUTHORIZED | No valid authentication provided |
Trading Errorsβ
| Code | Description |
|---|---|
INSUFFICIENT_BALANCE | Not enough funds for the trade |
MARKET_PAUSED | Market is not accepting trades |
MARKET_RESOLVED | Market has already been resolved |
INVALID_AMOUNT | Amount is zero, negative, or exceeds limits |
INVALID_PRICE | Price is outside the 0β10000 range |
ORDER_NOT_FOUND | Order does not exist |
POSITION_NOT_FOUND | No position in this market |
Withdrawal Errorsβ
| Code | Description |
|---|---|
INSUFFICIENT_BALANCE | Not enough funds to withdraw |
MIN_DEPOSIT_REQUIRED | Must deposit at least 1000 RUB before withdrawing |
WITHDRAWAL_LIMIT_EXCEEDED | Daily withdrawal limit reached |
UNSUPPORTED_TOKEN | Token is not supported for withdrawal |
UNSUPPORTED_NETWORK | Network is not supported |
INVALID_ADDRESS | Wallet address is invalid |
PENDING_WITHDRAWAL_EXISTS | A withdrawal is already in progress |
P2P Errorsβ
| Code | Description |
|---|---|
AD_NOT_ACTIVE | The P2P ad is no longer available |
DUPLICATE_AD_TYPE | User already has an active ad of this type |
INVALID_AMOUNT | Amount outside ad min/max range |
ORDER_ALREADY_PAID | Order has already been marked as paid |
ORDER_ALREADY_COMPLETED | Order is already completed |
ORDER_ALREADY_CANCELLED | Order was already cancelled |
CANNOT_CANCEL | Order is in a state that cannot be cancelled |
INVALID_PAYMENT_METHOD | Payment method not accepted by the ad |
Card Errorsβ
| Code | Description |
|---|---|
CARD_NOT_ACTIVE | Platform card is not active |
INVALID_AMOUNT | Amount outside deposit/withdrawal limits |
ORDER_ALREADY_PAID | Card order already confirmed |
MIN_DEPOSIT_REQUIRED | Minimum deposit not met for withdrawals |
Error Handling Exampleβ
const response = await fetch('https://intotes.com/api/v1/lmsr/trade', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
body: JSON.stringify({
market_id: 42,
side: 'buy_yes',
amount_type: 'spend',
amount: 10000,
}),
});
if (!response.ok) {
const { error } = await response.json();
switch (error.code) {
case 'INSUFFICIENT_BALANCE':
showNotification('Not enough funds. Please deposit first.');
break;
case 'MARKET_PAUSED':
showNotification('This market is currently paused.');
break;
default:
showNotification(error.message);
}
}