Pular para o conteúdo
Teste grátis por 7 dias
Português
Abrir no Claude Fazer perguntas sobre esta páginaAbrir no ChatGPT Fazer perguntas sobre esta página

Errors

The error format, every error code the Public API returns, and what to do about each.

Este conteúdo não está disponível em sua língua ainda.

A failed request returns a non-2xx HTTP status and a JSON body with an errors list:

{
"errors": [
{
"code": "validation_failed",
"field": "customer.email",
"message": "The customer.email field must be a valid email address."
}
]
}
KeyMeaning
codeA fixed word. Use it in your code. It never changes within v1.
messageA sentence for people. Do not depend on its exact wording.
fieldPresent when the error is about one input, such as items.0.variant_id.

Decide what to do from the HTTP status and code, and log message.

StatusCodeMeaning and what to do
401unauthorizedNo API key was sent. Add the X-SAMITA-API-KEY header.
401invalid_api_keyThe key is wrong, revoked or expired, or the app was uninstalled. Check the key on the Public API page, or create a new one.
403insufficient_scopeThe key lacks the permission this endpoint needs. Create a new key with it — permissions can't be edited.
403plan_upgrade_requiredThe store's plan does not include the Public API. Upgrade to PRO or above.
403not_availableThe API is not available for this store. Contact support.
403cors_not_supportedThe request came from a browser. Call the API from your server.
403quote_limit_reachedThe store has used its plan's monthly quote limit, so no new quote can be created. Upgrade, or wait for the next month.
404not_foundThe quote does not exist in this store, or the path is wrong. A quote from another store gives the same answer.
405method_not_allowedThat HTTP method is not supported on this path.
409idempotency_conflictA request with the same Idempotency-Key is still being processed. Wait a moment and retry.
422validation_failedAn input is missing or wrong. field and message say which. Fix it and resend.
429rate_limitedToo many requests, or too many failed key attempts. Wait Retry-After seconds.
500internal_errorSomething went wrong on our side. Retry later, and contact support if it keeps happening.
503shopify_unavailableThe products could not be loaded from Shopify while creating a quote. Try again in a moment.

Other unexpected statuses return request_failed.

Retry automaticallyFix first, then retry
429 (after Retry-After), 503, 500, 409401, 403, 404, 405, 422

When you retry a POST /quotes, send the same Idempotency-Key so a repeat can never create the quote twice. See Quotes.

You seeTry this
invalid_api_key right after creating a keyCopy the key again from your password manager. Check for a missing character or a trailing space.
unauthorized although you set a headerCheck the header name is exactly X-SAMITA-API-KEY, or use Authorization: Bearer. A key in the URL is ignored.
cors_not_supported from a toolSome tools add an Origin header. Call from a server-side step instead.
not_found on a quote you can see in the appUse the quote's id, not its number. List quotes to find the right id.
validation_failed on fields.*The key is not on your quote form. Call GET /form for the exact field keys. See Quote form.

Isso foi útil?