Documentation / Errors

API BCE error codes: HTTP 400, 401, 404, 429 and 500

API BCE error codes: what each HTTP status means and how to react to an invalid key, a company not found, an exceeded quota or a server error.

API BCE uses conventional HTTP status codes. 2xx means success, 4xx means a problem with your request, 5xx means a problem on our side.

Status codes#

TypeDescription
400The request was malformed or missing a required parameter.
401Missing or invalid API credentials.
402Your subscription is inactive or the monthly quota is exhausted.
403Your key is not allowed to access this resource.
404The requested entity does not exist.
412A required precondition (e.g. headers) was not met.
429Hourly rate limit or monthly quota exceeded.
500Something went wrong on our side. Retry later.

Error shape#

Errors use the same envelope; the message is in error. Quota and rate-limit errors add plan, limit and resetAt.

{
  "success": false,
  "error": "Monthly quota exceeded",
  "plan": "free",
  "limit": 1000,
  "resetAt": "...",
  "timestamp": "..."
}
ℹ️

Retry 429 and 5xx responses with exponential backoff. Do not retry 4xx errors other than 429.

A retry policy for API BCE errors#

The rule is simple: retry 429 and 5xx responses with exponential backoff, and never retry the other 4xx codes. In practice, each status calls for a precise reaction in your code.

  • 400: fix the input. For instance, an enterprise number with wrong check digits fails the modulo 97 test.
  • 401: credentials are missing or invalid; alert your team instead of retrying.
  • 402: the subscription is inactive or the monthly quota is exhausted; check the account.
  • 403: the key cannot access this resource, for example when the plan does not include it.
  • 404: the entity does not exist; record it as a business result.
  • 412: a required precondition, such as a header, was not met.
  • 429: wait until resetAt, then resume.
  • 500 and 503: back off and try again later.

Turning errors into business decisions#

A 404 during a supplier check is information, not a failure. It tells you the number belongs to no known company. Therefore, show a clear message and ask the user to check the number. In a KYB flow, however, separate “company not found” from “service unavailable”. The first one blocks onboarding, whereas the second one should queue a new attempt. Similarly, a 503 from the VAT route means VIES is down, not that the number is invalid.

Logging and alerting#

Log the status, the error message and, for quota errors, the plan, limit and resetAt fields. Then, alert on a sudden rise of 401 or 403 responses, because it often follows a key rotation. In addition, cap retries so that one broken record cannot loop forever.

Showing errors to users#

Raw messages rarely help end users. For instance, a 400 on a number field should become a clear hint to check the digits. A 404 should say that no company uses this number. However, a 5xx or a 429 should not blame the user. Instead, explain that the check will run again shortly, and keep the form usable. As a result, a temporary API BCE issue never blocks a sale or an onboarding. Also, translate these messages into the languages your product supports.

API BCE error codes FAQ#

Should I retry a 404?

No. The entity does not exist, so a retry returns the same answer. Instead, check the number or ask the user for a new one.

What is the difference between 402 and 429?

A 402 points to an inactive subscription or an exhausted monthly quota, so check your account. A 429 signals the hourly limit or the monthly quota, and you should wait until resetAt.

How can I reproduce API BCE errors?

Use test mode. For example, 0999.999.526 returns 429, 0999.999.625 returns 500 and 0999.999.999 returns 400.