heruAPI

Overview

Errors of a request carry an HTTP status; outcomes in a webhook carry only a code.

heru reports problems in two places, and they are read differently:

Request errorsWebhook event codes
WhenThe request itself cannot run: a field, the token, the state of the resource, or the SAT rejected the invoice.A fiscal or social security validation finished in the background without a full profile or NSS.
WhereThe answer of the request, with an HTTP status 4xx or 5xx.The code of the validation, in its webhook and in GET. The request had answered 202.
ShapeJSON with code, status, message and link.The resource, with status, code and message.
PagesGeneral, Validation, Invoices and certificates, CSD, State conflictsValidation results

In both, branch on code: it is stable, UPPER_SNAKE and starts with its family. The text in message can change.

Request errors

Every error answer has code, status, message, link and request_id; validation errors add the fields that failed, and SAT rejections the SAT rule in sat_code. link is the docs page that explains the error. Each operation of the API reference lists the errors it can answer, with an example of each.

422 Unprocessable Content
{
  "code": "VALIDATION_FAILED",
  "status": 422,
  "message": "Fix the fields listed in `fields` and retry.",
  "link": "https://developers.heru.app/errors/validation",
  "fields": [
    { "field": "curp", "reason": "must have 18 characters" }
  ],
  "request_id": "req_01m4ra8x59ehp870crwjcypejt"
}

Quote the request_id when you contact your account team about a specific call. It also comes in the X-Request-Id response header.

HTTP statusWhat to do
400, 413, 422Fix the request. Do not retry it unchanged. Nothing was created.
401Request a new token and retry once.
403Ask your account team to add the scope.
404Check the id. A resource of another company also answers 404.
409, 410Read the resource to see its state. For IDEMPOTENCY_KEY_REUSED, use a new key.
429Wait for Retry-After seconds, then retry.
500, 503Retry with the same Idempotency-Key. See retries.

Catalog

General

Details and what to do: General.

CodeHTTP statusMeaning
IDEMPOTENCY_KEY_REQUIRED400Idempotency-Key header is required.
MALFORMED_REQUEST400The request body is not valid JSON.
TOKEN_EXPIRED401The access token expired.
UNAUTHORIZED401Missing or invalid access token.
INSUFFICIENT_SCOPE403Your credential lacks the scope for this operation.
NOT_FOUND404Not found.
IDEMPOTENCY_KEY_REUSED409Idempotency-Key was used with a different request.
PAYLOAD_TOO_LARGE413The request body is too large.
RATE_LIMITED429Too many requests.
INTERNAL_ERROR500Something failed on our side.

Validation

Details and what to do: Validation.

CodeHTTP statusMeaning
VALIDATION_FAILED422Some fields are not valid.

Invoices and certificates

Details and what to do: Invoices and certificates.

CodeHTTP statusMeaning
COMPANY_CSD_NOT_ACTIVE422The CSD heru keeps for the issuing company expired or was revoked.
COMPANY_NOT_ALLOWED422The company is not one your credential can use.
COMPANY_REQUIRED422Your credential covers several companies and the request does not say which one.
INVOICE_TYPE_NOT_AVAILABLE422This invoice type is not available yet.
MERCHANT_NOT_ACTIVE422The merchant cannot invoice yet.
SAT_REJECTED422The SAT rejected the document.
WORKER_NOT_ELIGIBLE422The worker is not eligible for invoicing on their behalf.
WORKER_NO_CONSENT422The worker has not given consent.
WORKER_NO_CSD422The worker has no valid CSD.
WORKER_NO_EFIRMA422The worker has no active e.firma.
STAMP_UNAVAILABLE503Stamping is unavailable.

CSD

Details and what to do: CSD.

CodeHTTP statusMeaning
CSD_EXPIRED422The certificate expired.
CSD_INVALID_CERTIFICATE422The certificate is not a valid .cer file.
CSD_INVALID_KEY422The private key is not a valid .key file.
CSD_IS_EFIRMA422The certificate is an e.firma, not a CSD.
CSD_KEY_MISMATCH422The key does not belong to the certificate.
CSD_RFC_MISMATCH422The certificate belongs to another RFC.
CSD_WRONG_PASSWORD422The password does not open the private key.

State conflicts

Details and what to do: State conflicts.

CodeHTTP statusMeaning
BATCH_INVALID_STATE409The status of the batch does not allow pausing, resuming or cancelling it.
BATCH_NOT_READY409The batch is not ready to process.
BATCH_EXCEEDS_CAPACITY409The batch is estimated not to finish in its 20 days.
CHARGE_ALREADY_INVOICED409The charge was already invoiced.
INVOICE_ALREADY_CANCELLED409The invoice is already cancelled.
INVOICE_CANCELLATION_IN_PROGRESS409A cancellation is already in progress.
MERCHANT_ONBOARDING_NOT_NEEDED409The merchant does not need a new onboarding link.
MERCHANT_SLUG_TAKEN409The slug is taken.
EXTERNAL_ID_ALREADY_USED409A retention certificate of this issuer already has this external_id.
RETENTION_CERTIFICATE_CANCELLATION_IN_PROGRESS409The cancellation was already sent to the SAT.
RETENTION_CERTIFICATE_ALREADY_CANCELLED409The retention certificate is already cancelled.
WORKER_CSD_ALREADY_ACTIVE409The worker already has an active CSD.
WORKER_CSD_IN_PROGRESS409The CSD is already being requested.
WORKER_REMOVED409The worker was removed.
CHARGE_EXPIRED410The charge expired.
CHARGE_VOIDED410The charge was voided.

Webhook event codes

They have no HTTP status: the validation was accepted with 202, and its outcome comes later in the code of the resource. A .completed event with a code is the authority's answer, final until the person fixes it; a .failed event means heru could not finish the query. See validation results for what to do with each.

CodeEventMeaning
CURP_NOT_FOUNDfiscal_validation.completedThe CURP is not registered with RENAPO.
RFC_NOT_FOUNDfiscal_validation.completedThe RFC is not registered with the SAT.
NAME_MISMATCHfiscal_validation.completedThe name sent does not match the RFC.
SAT_SOURCES_PENDINGfiscal_validation.completedSome SAT sources did not answer; heru retries and sends another webhook.
RETRIES_EXHAUSTEDfiscal_validation.failedEvery retry with the SAT failed.
IN_PERSON_VALIDATION_REQUIREDsocial_security_validation.completedThe IMSS asks the person to go in person.
REGISTRATION_REQUIREDsocial_security_validation.completedThe person has no NSS.
CURP_NOT_FOUNDsocial_security_validation.completedThe CURP is not registered with RENAPO.
RETRIES_EXHAUSTEDsocial_security_validation.failedThe IMSS did not answer after every retry.
© 2026 Kuarto Inc. (heru)heru.appQuestions about your integration? Contact your heru account team.

On this page