Key Information/Error Codes

Error Codes

Cito API uses conventional HTTP response codes to indicate success or failure of requests.

HTTP Status Codes

CodeErrorDescription
400Bad RequestInvalid parameters or malformed request
401UnauthorizedInvalid or missing API key
403ForbiddenAPI key doesn't have access to this resource
404Not FoundResource doesn't exist
429Rate LimitToo many requests, see rate limits
500Server ErrorSomething went wrong on our end
503Service UnavailableAPI is temporarily down (check status page)

Error Response Format

All errors follow the same structure:

{
  "error": {
    "type": "invalid_request",
    "message": "Player 'Bugha123' not found",
    "param": "username",
    "code": "player_not_found"
  }
}
FieldDescription
typeThe type of error (see table below)
messageA human-readable error message
paramThe parameter that caused the error (if applicable)
codeA machine-readable error code

Error Types

TypeDescription
invalid_requestThe request was invalid or malformed
authentication_errorInvalid or expired API key
authorization_errorAPI key lacks permission for this action
not_foundThe requested resource was not found
rate_limit_exceededToo many requests in the time window
validation_errorOne or more request parameters are invalid
internal_errorAn unexpected error occurred on our servers

Handling Errors

try {
  const response = await fetch('https://api.citoapi.com/v1/fortnite/players/Bugha', {
    headers: { 'Authorization': 'Bearer sk_live_...' }
  });

  if (!response.ok) {
    const { error } = await response.json();

    switch (error.type) {
      case 'not_found':
        console.log(`Player not found: ${error.message}`);
        break;
      case 'rate_limit_exceeded':
        // Wait and retry
        await sleep(error.retry_after * 1000);
        break;
      case 'authentication_error':
        console.log('Invalid API key');
        break;
      default:
        console.log(`Error: ${error.message}`);
    }
    return;
  }

  const data = await response.json();
  console.log(data);
} catch (err) {
  console.error('Network error:', err);
}

Common Issues

"Invalid API key provided"

Check that you're using the correct key prefix (sk_live_ or sk_test_) and that the key hasn't been revoked.

"Player not found"

Usernames are case-sensitive. Make sure you're using the exact username as it appears in-game.

"Rate limit exceeded"

Wait for the retry_after period and consider implementing caching or upgrading your plan.