Codici di Errore
Codici di Errore
Tutti gli errori API restituiscono un formato JSON coerente:
{
"error": "Not Found",
"message": "Resume not found",
"statusCode": 404
}Codici di Stato HTTP
| Codice | Nome | Descrizione |
|---|---|---|
200 | OK | Richiesta riuscita |
201 | Created | Risorsa creata con successo |
400 | Bad Request | Corpo della richiesta o parametri non validi |
401 | Unauthorized | Chiave API mancante o non valida |
402 | Payment Required | Crediti esauriti. Acquistane altri o attendi il reset mensile |
403 | Forbidden | Azione non consentita (es. BYOK senza abbonamento) |
404 | Not Found | La risorsa non esiste |
413 | Payload Too Large | Il file caricato supera il limite di 10MB |
422 | Unprocessable Entity | JSON valido ma semanticamente non valido (es. descrizione del lavoro troppo corta) |
429 | Too Many Requests | Limite di frequenza superato. Riprova dopo il valore dell'header Retry-After |
500 | Internal Server Error | Si e verificato un problema lato server |
Scenari di Errore Comuni
Chiave API Mancante
{
"error": "Unauthorized",
"message": "Missing x-api-key header",
"statusCode": 401
}Soluzione: Aggiungi la tua chiave API nell'header x-api-key.
Chiave API Non Valida
{
"error": "Unauthorized",
"message": "Invalid API key",
"statusCode": 401
}Soluzione: Verifica la tua chiave su console.laddro.com. Le chiavi potrebbero essere state revocate.
Crediti Esauriti
{
"error": "Payment Required",
"message": "No credits remaining. Purchase credits at console.laddro.com",
"statusCode": 402
}Soluzione: Acquista un pacchetto crediti o attendi il reset del piano gratuito mensile.
BYOK Senza Abbonamento Attivo
{
"error": "Forbidden",
"message": "BYOK requires an active recurring Laddro subscription",
"statusCode": 403
}Soluzione: Abbonati su laddro.com con un piano ricorrente.
Chiave del Provider Non Valida
{
"error": "Unprocessable Entity",
"message": "API key validation failed for provider 'anthropic': invalid_api_key",
"statusCode": 422
}Soluzione: Ricontrolla la chiave API del tuo provider. L'API valida le chiavi con una chiamata di test prima del salvataggio.
Strategia di Retry
Per errori 429 e 5xx, implementa il backoff esponenziale:
async function withRetry(fn: () => Promise<Response>, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
const response = await fn()
if (response.status === 429) {
const retryAfter = parseInt(response.headers.get('Retry-After') || '1')
await new Promise(r => setTimeout(r, retryAfter * 1000))
continue
}
return response
} catch (error) {
if (i === maxRetries - 1) throw error
await new Promise(r => setTimeout(r, Math.pow(2, i) * 1000))
}
}
}