Skip to content

Error Codes

Auto-generated from the error code registry. Last generated: 2026-03-27 Run npm run docs:errors -w @king-jewel/api to regenerate.

All KINGSTONE API errors include a machine-parseable error code in the errorCode field. Codes follow the format KS-XXXX where the number range indicates the category.

Authentication Errors (KS-40xx)

CodeHTTP StatusMessageResolution
KS-4001401Missing X-API-Key headerInclude the X-API-Key header with a valid API key in your request.
KS-4002401Invalid API keyCheck that your API key is correct. Keys start with "ks_" for sandbox or "kp_" for production.
KS-4003401API key is revoked or inactiveContact Predigy to issue a new API key.
KS-4004401API key has expiredContact Predigy to renew your API key.
KS-4005401Partner account is deactivatedContact Predigy to reactivate your partner account.

Validation Errors (KS-41xx)

CodeHTTP StatusMessageResolution
KS-4101400Request validation failedCheck the request body/parameters against the API documentation.
KS-4102400Required field missingInclude all required fields in your request body.
KS-4103400Wager amount out of rangeEnsure wager is between the game's minimum and maximum wager limits.
KS-4104400Invalid PAR sheet dataVerify your PAR sheet JSON matches the required schema and RTP math is correct.
KS-4105400Invalid date formatUse YYYY-MM-DD format for date parameters.
KS-4106400Invalid webhook URLProvide a valid HTTPS URL for webhook registration.
KS-4107400Invalid webhook event typesUse valid event types: spin.large_win, settlement.report_ready, block.low_reserve, api_key.expiring.
KS-4108409Game config name already existsChoose a unique config name for the game.
KS-4109400minWagerUsd must be less than maxWagerUsdEnsure the minimum wager is strictly less than the maximum wager.

Game/Resource Errors (KS-42xx)

CodeHTTP StatusMessageResolution
KS-4006403Game not found or not registered to this partnerVerify the game ID and ensure it is registered to your partner account.
KS-4201404Game not foundVerify the game ID and ensure it is registered to your partner account.
KS-4202400Game is not activeActivate the game or contact Predigy support.
KS-4203503Game outcome queue exhaustedWait for automatic block generation. If this persists, contact Predigy support.
KS-4204404Player not foundVerify the external player ID. Players are auto-created on first spin.
KS-4205404PAR sheet not foundUpload a PAR sheet first using POST /par-sheets.
KS-4206404Webhook not foundVerify the webhook ID and ensure it belongs to your partner account.
KS-4207403Webhook does not belong to this partnerVerify the webhook ID belongs to your partner account.
KS-4208400PAR sheet is not activeOnly ACTIVE PAR sheets can be used for game registration.
KS-4209404Partner not foundVerify the partner ID in your request.
KS-4210403Partner is deactivatedContact Predigy to reactivate this partner account.
KS-4211409Partner with this slug already existsChoose a unique slug for the partner.
KS-4212404API key not foundVerify the API key ID in your request.
KS-4213403API key does not belong to this partnerVerify the API key belongs to your partner account.
KS-4214404No games registered for this partnerRegister at least one game before generating settlement reports.
KS-4215404Resource not foundVerify the resource ID in your request.

Settlement Errors (KS-43xx)

CodeHTTP StatusMessageResolution
KS-4301404Settlement report not foundVerify the date format (YYYY-MM-DD). Reports are generated daily.
KS-4302409Settlement report already acknowledgedThis report has already been acknowledged and cannot be changed.
KS-4303409Settlement report already disputedThis report has already been disputed.
KS-4304409Settlement report status does not allow this actionOnly GENERATED or PENDING reports can be acknowledged or disputed.

Rate Limit Errors (KS-429x)

CodeHTTP StatusMessageResolution
KS-4291429Rate limit exceeded for spin requestsWait and retry after the Retry-After period. Check X-RateLimit-* headers.
KS-4292429Rate limit exceeded for API requestsWait and retry after the Retry-After period. Check X-RateLimit-* headers.

Server Errors (KS-50xx)

CodeHTTP StatusMessageResolution
KS-5004500Authentication service errorRetry after a brief delay. If the issue persists, contact Predigy support.
KS-5001500Internal server errorRetry after a brief delay. If the issue persists, contact Predigy support.
KS-5002503Service temporarily unavailableThe service is under maintenance. Retry after a brief delay.
KS-5003500Spin processing failedRetry the spin. The wager was not deducted. If this persists, contact Predigy.
KS-5005500Failed to register gameRetry after a brief delay. If the issue persists, contact Predigy support.
KS-5006500Failed to upload PAR sheetRetry after a brief delay. If the issue persists, contact Predigy support.
KS-5007500Failed to create partnerRetry after a brief delay. If the issue persists, contact Predigy support.
KS-5008500Failed to issue API keyRetry after a brief delay. If the issue persists, contact Predigy support.
KS-5009500Failed to generate settlement reportRetry after a brief delay. If the issue persists, contact Predigy support.
KS-5010500Failed to resolve or create partner playerRetry after a brief delay. If the issue persists, contact Predigy support.

Using Error Codes in Your Application

typescript
import { KingstoneClient, KingstoneApiError } from '@kingstone/sdk';

try {
  await client.spin({ gameId: 1, playerId: 'p1', wagerUsd: 0.25 });
} catch (error) {
  if (error instanceof KingstoneApiError) {
    switch (error.errorCode) {
      case 'KS-4103':
        showUserMessage('Invalid wager amount. Please adjust your bet.');
        break;
      case 'KS-4291':
        showUserMessage('Please wait a moment before spinning again.');
        break;
      case 'KS-5001':
      case 'KS-5002':
        showUserMessage('Service temporarily unavailable. Retrying...');
        await retryWithBackoff(() => client.spin(/* ... */));
        break;
      default:
        showUserMessage(`Error: ${error.message}`);
    }
  }
}

Retryable vs. Non-Retryable

The SDK's KingstoneApiError.retryable property is true for:

  • 429 errors — rate limited, safe to retry after waiting
  • 5xx errors — server-side issues that may resolve on their own

All 4xx errors (except 429) are not retryable — the request itself needs to be changed.

See the Error Handling guide for retry patterns with exponential backoff.

KINGSTONE by Predigy Inc.