Mistakes

That guide describes the error code that can return APIs of JAAKand recommendations for their resolution.

Error response format

All error responses follow the same JSON format:

{
  "error": {
    "code": "invalid_token",
    "message": "The token's expired",
    "status": 401,
    "details": {
      "expiredAt": "2024-01-15T10:30:00Z"
    }
  }
}
FieldDescription
codeUnique error code to identify problem
messageLegible description of error
statusHTTP status code
detailsAdditional information specific to error (optional)

HTTP status code

400 Bad Request

The request contains syntax errors or invalid parameters.

{
  "error": {
    "code": "invalid_request",
    "message": "The email field is required",
    "status": 400,
    "details": {
      "field": "email",
      "reason": "required"
    }
  }
}

solution:

  • Check that all required fields are present
  • Check that data types are correct (string, number, etc.)
  • Check that values are valid (email, URL, date) ISO 8601)

401 Unauthorized

The credentials are invalid or have been insufficient.

{
  "error": {
    "code": "invalid_credentials",
    "message": "API Key or API Invalid secret",
    "status": 401
  }
}

solution:

  • Check that you're sending the right authentication headquarters
  • Check that the credentials are right for the environment (sandbox vs. production)
  • Check that tokens haven't expired.

403 Forbidden

You have no permission to have access to the requested remedy.

{
  "error": {
    "code": "forbidden",
    "message": "You have no permission to gain access to this remedy",
    "status": 403
  }
}

solution:

  • Check that your plan includes access to this functionality
  • Check that the user has the necessary permission
  • Contact support if you think you should have access

404 Not Found

The requested remedy does not exist.

{
  "error": {
    "code": "not_found",
    "message": "Unfound meeting",
    "status": 404,
    "details": {
      "resourceType": "session",
      "resourceId": "ses_abc123xyz"
    }
  }
}

solution:

  • Check that the remedy's ID is correct
  • Check that the remedy exists in the right environment
  • The remedy may have been removed or expired

422 Unprocessor Entity

The request is valid but cannot be processed due to business rules.

{
  "error": {
    "code": "session_already_completed",
    "message": "The sitting was completed and cannot be altered.",
    "status": 422,
    "details": {
      "sessionId": "ses_abc123xyz",
      "status": "completed"
    }
  }
}

solution:

  • Check the current status of the remedy before trying to amend it
  • Check documentation to understand valid status transitions

429 Too Many Requests

You have exceeded the limit of permitted applications.

{
  "error": {
    "code": "rate_limit_exceeded",
    "message": "You have exceeded the demand limit. Try again in 60 seconds",
    "status": 429,
    "details": {
      "retryAfter": 60,
      "limit": 100,
      "window": "1m"
    }
  }
}

solution:

  • Implement exponential backoff into your code
  • Backup the head Retry-After in response
  • Consider packing responses as soon as possible
  • Contact support if you need a bigger limit

500 Internal Server Error

Internal server error.

{
  "error": {
    "code": "internal_error",
    "message": "That's an internal mistake.",
    "status": 500,
    "details": {
      "requestId": "req_xyz789"
    }
  }
}

solution:

  • Retry after a few seconds
  • If the error persists, contact support with the requestId

Request ID

All responses include a Leader X-Request-Id. Enter them by contacting support so we can quickly identify your request.


Specific error codes

Authentication errors

CodeDescriptionResolution
invalid_api_keyAPI Unvalid keyHe verifies that API Key's right.
invalid_api_secretAPI Invalid secretCheck that API Secret be correct
invalid_tokenToken JWT invalidget a new token with sign-in
token_expiredToken JWT expiredUse the refresh token to renew
refresh_token_expiredRefresh token expiredRelogin
credentials_mismatchCredentials do not coincide with the environmentUse sandbox or production credentials as appropriate

Verification errors (KYC)

CodeDescriptionResolution
session_not_foundUnfound meetingCheck Session ID
session_expiredThe sitting has been closed.Create a new session
session_already_completedThe session has been completedCheck the result with PET / sessions /{d}
session_cancelledThe session was cancelledCreate a new session if necessary
invalid_verification_typeUnvalid type of verificationUse one of: kyc _ full, survival _ only, face _ match, document _ only, document _ validation
document_type_not_supportedUnsupported document typeCheck the permitted document types
ine_validation_unavailableValidation with INE Not availableService temporarily unavailable, try later

Signature errors (Signa)

CodeDescriptionResolution
template_not_foundUnfoundCheck the template ID
template_invalidThe template has mistakesCheck the template settings at dashboard
submission_not_foundUnfound sendingCheck the sending ID
submission_cancelledThe dispatch was cancelledThe document cannot be signed
signer_not_foundUnfound signCheck the sign's ID or email
signature_already_completedThe sign signedCan't sign twice
invalid_signature_typeUnvalid signature typeUse one of: simple, electronic _ advanced, electronic _ quantified
pdf_processing_errorFailed to process PDFCheck that the PDF is valid and isn't corrupt

Validation errors

CodeDescriptionResolution
field_requiredRequired area missingincludes all required fields
field_invalidField with invalid formatCheck the field format
field_too_longField beyond borderReduces value length
field_too_shortVery short fieldIncrease Value Length
invalid_emailEmail with invalid formatUse valid email
invalid_urlInvalid URLInclude protocol (https: / /)
invalid_dateInvalid dateUse format ISO 8601
invalid_jsonJSON malformedValid JSON before sending

Rate Limiting

The APIs of JAAK they implement demand limits to ensure service stability.

Default limits

PlanRequests per minuteRequests per hour
Sandbox601,000
Starter1005,000
Business50025,000
EnterpriseCustomCustom

Points limit heads

Each response includes leaders with border information:

X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1705315200
LeaderDescription
X-RateLimited-LibitLoan of applications by window
X-RateLimited-RemainingRequests remaining in the current window
X-RateLimited -ResetTimespamp Unix after Reboot

Status limitation management

Implement exponential backoff when you get an error 429:

async function apiCallWithRetry(fn, maxRetries = 3) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    try {
      return await fn();
    } catch (error) {
      if (error.status === 429 && attempt < maxRetries - 1) {
        const retryAfter = error.details?.retryAfter || Math.pow(2, attempt);
        console.log(`Rate limited. Esperando ${retryAfter} segundos...`);
        await sleep(retryAfter * 1000);
      } else {
        throw error;
      }
    }
  }
}

function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}

Optimize your applications

To reduce the number of applications:

  • Using webhooks instead of polling
  • Skip responses where possible
  • Stretch operations at API Let him.

Identification checks errors

These errors occur during the verification process and are reported in the result of the session.

document errors

CodeDescriptionRecommendation
DOCUMENT_NOT_READABLECan't read documentAsk the user to take a more clear photo
DOCUMENT_EXPIREDThe document's upRequests users to use an existing document
DOCUMENT_ALTEREDReactions were foundPossible fraud, manually check
DOCUMENT_NOT_SUPPORTEDUnsupported document typeIndicates accepted document types
DOCUMENT_WRONG_COUNTRYUnsupported country documentMexican document only accepted
DOCUMENT_PHOTO_MISSINGNo photo found in documentCheck to be the front of the document

Life errors

CodeDescriptionRecommendation
LIVENESS_FAILEDLiveness detection FailedCan be an attempt at fraud or bad light
SPOOF_DETECTEDSuplantation attempt detectedPossible photo or video fraud
FACE_NOT_DETECTEDNo face was foundAsk the user to focus his face
MULTIPLE_FACESMultiple faces were detectedOnly one person should be in the image
FACE_TOO_SMALLA very small face in the imageRequests the user to come closer
POOR_LIGHTINGInadequate lightCall for better light

face match errors

CodeDescriptionRecommendation
FACE_MISMATCHThe face doesn't match the documentPossible fraud or document of another person
LOW_CONFIDENCELow confidence in coincidenceConsider manual review
SELFIE_QUALITY_LOWInsufficient selfie qualityAsk for a better photo
DOCUMENT_PHOTO_QUALITY_LOWphoto quality of low documentRequests better photo of document

Validation errors INE

CodeDescriptionRecommendation
INE_NOT_FOUNDINE Not found at bestCheck that data are correct
INE_CANCELLEDINE cancelled or reportedThe document is invalid
INE_EXPIREDINE earned by the best manThe document is invalid
INE_SERVICE_UNAVAILABLEService INE Not availableTry later

Mapping your code

Full example

class JAAKError extends Error {
  constructor(response) {
    super(response.error.message);
    this.code = response.error.code;
    this.status = response.error.status;
    this.details = response.error.details;
  }
}

async function callJAAKAPI(endpoint, options) {
  const response = await fetch(`https://api.jaak.ai${endpoint}`, {
    ...options,
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': API_KEY,
      'X-API-Secret': API_SECRET,
      ...options.headers
    }
  });

  const data = await response.json();

  if (!response.ok) {
    throw new JAAKError(data);
  }

  return data;
}

// Using with bug management
async function createSession(verificationType) {
  try {
    const session = await callJAAKAPI('/api/v1/sessions', {
      method: 'POST',
      body: JSON.stringify({ verificationType })
    });
    return session;
  } catch (error) {
    if (error instanceof JAAKError) {
      switch (error.code) {
        case 'rate_limit_exceeded':
          console.log('Just waiting before we get back to it...');
          await sleep(error.details.retryAfter * 1000);
          return createSession(verificationType);

        case 'invalid_credentials':
          console.error('Invalid credentials. Check your API Key and Secret.');
          throw error;

        case 'forbidden':
          console.error('You have no access to this type of check.');
          throw error;

        default:
          console.error(`Error de JAAK: ${error.message} (${error.code})`);
          throw error;
      }
    }
    throw error;
  }
}

Contact Support

If you find an error that you cannot solve:

  1. includes Request-Id response head
  2. Describe the steps to play the bug
  3. Includes error code and complete message
  4. indicates the environment (sandbox or production)

Email: support

Support schedule

Our support team is available Monday through Friday, 9:00 to 18:00 (Mexico City time). For emergencies outside business hours, contact your account executive.


Following

  • Webhooks - Configure real-time notifications
  • Sandbox - Test your integration without affecting production