Catálogo de Códigos de Erro

Este catálogo lista os valores de error.code que a API pode retornar, agrupados por status HTTP e

Este catálogo lista os valores de error.code que a API pode retornar, agrupados por status HTTP e por recurso. Para a estrutura do objeto de erro (envelope), veja Tratamento de Erros.

Trate erros pelo error.code, não pela message. O code é o identificador estável e legível por máquina (faz parte do contrato); a message é texto e pode mudar. Sempre presente na resposta.

Status HTTP

A API usa códigos de status HTTP padrão. O error.statusCode/error.category derivam de um template interno (não são definidos campo a campo). Cada error.code mapeia para um template, e o template define o trio statusCode / status / category:

categoryStatusTemplate internoSignificado
validation400badRequestRequisição malformada ou parâmetro inválido (veja error.params)
authentication401unauthorizedCredencial (SelectKey / login) ausente, inválida ou revogada
payment402paymentRequiredPagamento recusado pelo emissor
authorization403forbiddenAutenticado, mas sem permissão / conta não ativa
client404notFoundRecurso não encontrado
client409conflictConflito (estado incompatível, duplicidade, idempotência)
client413payloadTooLargeCorpo da requisição grande demais
validation422unprocessableEntidade não processável (regra de negócio)
rate_limit429tooManyRequestsLimite de requisições excedido (veja API Limits)
server500internalServerErrorErro interno — tente novamente; se persistir, contate o suporte
server503serviceUnavailableIndisponibilidade temporária de um serviço — repita com backoff

Observação: erros de validação de contrato são sempre 400 / validation (com error.params), nunca 422. O 422 é reservado para regras de negócio (entidade processável sintaticamente, mas rejeitada).

Em erros que admitem nova tentativa (ex.: 429), respeite o cabeçalho Retry-After da resposta no seu backoff.

Códigos comuns (cross-cutting)

Estes códigos vêm do kernel e podem aparecer em qualquer rota (recurso server, exceto onde indicado):

error.codeHTTPQuando ocorre
invalidParameters400Falha de validação de contrato (veja error.params para os campos)
unauthorized401SelectKey/token ausente, inválido ou revogado
forbidden403Autenticado, mas sem permissão para a operação
payloadTooLarge413Corpo da requisição excede o limite (envie arquivos via /v1/assets)
tooManyRequests429Rate limit atingido (veja API Limits)
idempotencyInProgress409Já há uma requisição em andamento com esta X-Idempotency-Key
idempotencyMismatch409Esta X-Idempotency-Key já foi usada com um payload diferente
serverError500Erro interno inesperado

Erros de validação de campos trazem detalhes por campo em error.params:

{
  "error": {
    "status": "Bad Request",
    "statusCode": 400,
    "category": "validation",
    "code": "invalidParameters",
    "message": "Validation errors occurred.",
    "resource": "server",
    "params": [{ "amount": "amount must be a positive integer" }]
  }
}

Por recurso

Transactions

error.codeHTTPMensagem
transactionNotFound404Transaction not found
customerNotFound404The customer for this transaction was not found
cardNotFound404The card for this transaction was not found
addressNotFound404The billing address was not found
recipientNotFound404A split recipient was not found
disputeNotFound404No dispute was found for this transaction
cardCustomerMismatch422The card does not belong to the customer
transactionNotRefundable422This transaction cannot be refunded in its current status
refundAmountInvalid422Refund amount inválido (≤ 0 ou acima do total já cobrado)
refundInProgress409A refund for this transaction is already in progress
transactionNotCapturable422This transaction is not awaiting capture
captureAmountInvalid422Capture amount inválido (≤ 0 ou acima do autorizado)
transactionNotInDispute422Defense evidence só pode ser enviada com a transação em disputa
discountExceedsAmount422O desconto deixa a cobrança abaixo do mínimo
splitsExceedAmount422A soma dos splits excede o valor cobrado
splitsInvalid422Um split resolve para valor inválido (zero ou negativo)
installmentsExceedMax422Parcelas acima do máximo oferecido no momento
onBehalfOfInvalid422onBehalfOf deve referenciar uma sub-conta sua (marketplace habilitado)
sellerRatesMissing422Conta sem taxa configurada — não pode transacionar

Erros de processamento do pagamento (motor de pagamentos, recurso payorch):

error.codeHTTPMensagem
paymentDeclined402The payment was declined by the issuer
providerNotConfigured422Nenhum provedor de pagamento configurado para o modo solicitado
transactionNotFound404Transaction not found at the provider
providerUnavailable500The payment provider is temporarily unavailable

Subscriptions

/v1/subscriptions é Selectwin-strict: a precificação vem das variantes recorrentes; não há campo amount nem preço manual.

error.codeHTTPMensagem
subscriptionNotFound404Subscription not found
customerNotFound404The customer for this subscription was not found
cardNotFound404The card for this subscription was not found
variantNotFound404One or more product variants were not found
cycleNotFound404The billing cycle was not found for this subscription
itemNotFound404The line item was not found for this subscription
splitNotFound404The split was not found for this subscription
splitRecipientNotFound404The split recipient company was not found
meteredItemNotFound404Metered subscription item not found
thresholdNotFound404Billing threshold not found
cardCustomerMismatch422The card does not belong to the customer
variantNotRecurring422A variant is not priced for recurring billing
subscriptionAlreadyCanceled422This subscription is already canceled
subscriptionNotModifiable422A canceled subscription cannot be modified
subscriptionNotPausable422This subscription cannot be paused in its current status
subscriptionNotResumable422Only a paused subscription can be resumed
noScheduledCycle422There is no scheduled cycle to renew for this subscription
subscriptionRequiresItem422A subscription must keep at least one line item
itemCurrencyMismatch422The item currency must match the subscription currency
duplicateSplitRecipient422A split already exists for this recipient
splitValueInvalid422A percentage split value must be between 0 and 100
usageOnNonMeteredItem422Usage can only be reported on metered items
usageActionUnsupported422Usage action not supported (only 'increment')
thresholdMisconfigured422Billing threshold misconfigured
thresholdAlreadyExists409A billing threshold already exists for this item
onBehalfOfInvalid422onBehalfOf deve referenciar uma sub-conta sua (marketplace habilitado)

Customers

error.codeHTTPMensagem
customerNotFound404Customer not found
invalidCustomerId404The provided customer id is invalid
customerEmailTaken409A customer with this email already exists
customerDocumentTaken409A customer with this document already exists
customerHasActiveSubscription409Cliente com assinatura ativa não pode ser excluído (cancele a assinatura antes)

Cards

error.codeHTTPMensagem
cardIdNotFound404Card ID not found
cardIdIsInvalid400Card ID is invalid
cardExpired400Card expired
invalidCardData422Invalid card data
cardBrandNotSupported422Card brand not supported

Addresses

error.codeHTTPMensagem
addressIdNotFound404Address not found

Wallets (contas bancárias)

error.codeHTTPMensagem
walletNotFound404Wallet not found
walletAlreadyExists409A wallet with these account details already exists
walletHasPendingWithdrawal409Wallet com saque em andamento não pode ser excluída
bankCodeNotSupported400This bank code is not supported

Withdrawals (saques)

error.codeHTTPMensagem
withdrawalNotFound404Withdrawal not found
withdrawalCreateNotEnabled400Withdrawals are not enabled for this company
withdrawalAmountLessThanMinimum400The withdrawal amount is below the minimum

Auto-cashout (saque automático)

error.codeHTTPMensagem
autoCashoutNotFound404Auto-cashout config not found
duplicateAutoCashoutForWallet400An auto-cashout config already exists for this wallet
percentageOverlapDetected400A soma das porcentagens habilitadas não pode exceder 100%

Finance (Balance / Receivables)

error.codeHTTPMensagem
balanceNotFound404No balance found for this company yet
balanceIsInsufficient422Insufficient available balance for this withdrawal
receivableNotFound404Receivable not found

Products & Variants

error.codeHTTPMensagem
productNotFound404Product not found
variantNotFound404Variant not found
invalidPricing422Invalid advanced pricing configuration
pricingTypeImmutable422pricing.type is immutable
pricingSchemaImmutable422pricing.schema is immutable

Coupons

error.codeHTTPMensagem
couponNotFound404The coupon code was not found
couponCodeConflict409A coupon with this code already exists
couponDisabled422This coupon is no longer active
couponNotYetActive422This coupon is not active yet
couponExpired422This coupon has expired
couponMinCartAmount422Cart total abaixo do mínimo do cupom
couponMaxCartAmount422Cart total acima do máximo do cupom
couponMinCartItems422Menos itens do que o cupom exige
couponMaxCartItems422Mais itens do que o cupom permite
couponNotApplicable422This coupon does not apply to this cart
couponUsageLimitReached422This coupon has reached its usage limit
couponCustomerLimitReached422This coupon has already been used by this customer
couponExceedsTotal422The coupon discount exceeds the chargeable total

Checkout

error.codeHTTPMensagem
checkoutSessionNotFound404Checkout session not found
checkoutSessionNotUpdatable409A completed checkout session can no longer be updated
checkoutSessionNotPayable409This checkout session is not in a payable state
variantIdIsInvalid422One of the items references a product variant that does not exist
onBehalfOfInvalid422onBehalfOf deve referenciar uma sub-conta sua (marketplace habilitado)
checkoutPaymentLinkNotFound404Payment link not found
checkoutPaymentLinkCreateFailed500The payment link could not be created
checkoutTemplateNotFound404Checkout template not found
checkoutTemplateIdIsInvalid422The checkout template does not exist
orderbumpNotFound404Order bump not found
reviewNotFound404Checkout review not found
shippingOptionNotFound404Shipping option not found
shippingOptionRequiresTemplateOrGlobal422A shipping option must be global or bound to a checkout template
checkoutMonitorNotFound404Checkout monitor not found
checkoutPixelNotFound404Checkout tracking pixel not found
upsellNotFound / upsellOfferNotFound404Upsell offer not found
upsellParentNotFound404Parent transaction not found
upsellParentNotApproved422A transação pai precisa estar aprovada para cobrar um upsell
upsellOfferExpired422This upsell offer has expired
upsellOfferNotEligible422This upsell offer is not eligible for the parent purchase
upsellAmountTooLow422The upsell amount is below the minimum chargeable value

Webhooks

error.codeHTTPMensagem
webhookEndpointNotFound404Webhook endpoint not found
webhookEventNotFound404Webhook event not found
webhookDispatchNotFound404Webhook dispatch not found
webhookUnknownResource422Unknown event resource — cannot build payload
webhookSigningDisabled422This endpoint has signing disabled (no secret)

Domains

error.codeHTTPMensagem
domainIdIsInvalid404Domain ID is invalid (not found for this company)
domainAlreadyExists409Domain already exists
domainLimitExceeded409Domain limit exceeded
domainUpdateFailed400Domain update failed
domainEdgeProvisionFailed422Domain edge provisioning failed

Authentication & API Keys

error.codeHTTPMensagem
invalidPassword401Invalid email or password
userDisabled403This account is not active. Verify your email to continue
mfaCodeRequired401This account has MFA enabled — a verification code is required
mfaChallengeInvalid401The MFA challenge is invalid, expired, or already used
mfaTokenInvalid401The verification code is incorrect
stepUpRequired401This operation requires recent authentication. Please re-authenticate
recoveryTokenInvalid401The password reset token is invalid or has expired
resourceNotAllowed403This resource is not allowed for this client
operationMethodNotAllowed403This operation is not allowed for this client
companyNotMember403You are not a member of this company
sessionNotFound404Session not found
passwordMismatch422The passwords do not match
invalidApiKeyId400API key not found
m2mTokenUnauthorized401Invalid client credentials

Signup

error.codeHTTPMensagem
userEmailExists400An account with this email already exists
userEmailConfirmationTokenInvalid400The email confirmation token is invalid
companyLimitReached422Você atingiu o máximo de empresas para esta conta
companiesNotActive422Finalize suas empresas existentes (todas ativas) antes de criar outra
companyCreateForbidden403You do not have permission to create a company from this account
signupNotProcessable500Could not create the account

Exports

error.codeHTTPMensagem
exportNotFound404The export was not found
exportNotCancelable422This export can no longer be canceled
exportTooLarge422The export exceeds the maximum allowed row count

Assets (upload)

error.codeHTTPMensagem
assetNotFound404The asset was not found
assetUploadIncomplete422No uploaded object was found for this asset yet
assetCompanyUnresolved422Could not resolve the company for this upload
storageNotConfigured503Object storage is not configured (indisponibilidade temporária)

Como tratar erros (recomendado)

const res = await fetch(url, { headers: { SelectKey: process.env.SELECTWIN_API_KEY } });
if (!res.ok) {
  const { error } = await res.json();
  switch (error.code) {                       // ← key no code, nunca na message
    case 'customerNotFound':
      return handleMissingCustomer();
    case 'balanceIsInsufficient':
      return promptTopUp();
    case 'paymentDeclined':
      return promptAnotherCard();
    default:
      if (error.statusCode === 429) return retryWithBackoff();   // rate limit
      if (error.statusCode >= 500)  return retryWithBackoff();   // transitório
      throw new Error(`${error.code}: ${error.message}`);
  }
}

Esta lista cobre os erros mais comuns voltados ao desenvolvedor para cada recurso público. Outros códigos específicos podem aparecer; trate sempre o default pelo error.statusCode/category.

On this page