TanqoryDocs

Errors

Admin API ตอบอะไรเมื่อให้บริการคำขอไม่ได้ และควรทำอย่างไรในแต่ละกรณี

Admin API แจ้งปัญหาได้สามที่ คือ HTTP status ก่อน GraphQL ทำงาน รายการ errors ในคำตอบ GraphQL หรือ userErrors ใน payload ของ mutation ตัวอย่างทุกตัวในหน้านี้เป็นคำตอบจริงจาก API

ก่อน GraphQL ทำงาน

token และร้านถูกตรวจก่อน คำตอบเหล่านี้เป็น HTTP ธรรมดา

StatusBodyเมื่อ
401{"error":{"code":"invalid_access_token","message":"Send a valid access token in the Authorization header. The token sent is missing, not valid, or belongs to another store.","status":401}}ไม่มี token, token ไม่ถูกต้อง หรือเป็น token ของร้านอื่น รวมถึง store id ที่ไม่มีอยู่
404{"error":{"code":"resource_not_found","message":"Not found.","status":404}}ที่อยู่ที่ API ไม่มี เช่น store id ที่ไม่ใช่ UUID หรือเวอร์ชันที่ไม่ใช่ YYYY-MM หรือ unstable

ในคำตอบ GraphQL

เมื่อ GraphQL ปฏิเสธคำขอ คำตอบจะมีรายการ errors แต่ละรายการมี message และ extensions ซึ่งมี

ฟิลด์ความหมาย
codeสิ่งที่ผิดพลาด เป็นตัวพิมพ์ใหญ่ เช่น ACCESS_DENIED
typeกลุ่มของ error เช่น permission_error หรือ api_error
request_idid ของคำขอนี้ ให้แนบเมื่อขอความช่วยเหลือ
doc_urlลิงก์มาที่หน้านี้สำหรับ code นั้น

คำขอที่ไม่ใช่ GraphQL ที่ถูกต้องจะได้ 400

JSON
{
  "errors": [
    {
      "message": "Syntax Error: Expected Name, found <EOF>.",
      "locations": [{ "line": 1, "column": 16 }],
      "extensions": {
        "type": "api_error",
        "code": "GRAPHQL_PARSE_FAILED",
        "request_id": "req_1w0vuypb",
        "doc_url": "https://docs.tanqory.com/errors/GRAPHQL_PARSE_FAILED"
      }
    }
  ]
}

operation ที่ scope ของ token ไม่อนุญาตจะได้ 200 และไม่มี data สำหรับส่วนนั้น

JSON
{
  "errors": [
    {
      "message": "This request cannot use `orders`: it needs the `read_orders` access scope.",
      "extensions": {
        "type": "permission_error",
        "code": "ACCESS_DENIED",
        "request_id": "req_npe0tdcy",
        "doc_url": "https://docs.tanqory.com/errors/ACCESS_DENIED"
      }
    }
  ]
}

Codes

invalid_access_token

HTTP 401 ก่อน GraphQL ทำงาน token ใน Authorization (Storefront API ใช้ X-Tanqory-Storefront-Access-Token) ไม่ได้ส่งมา ไม่ใช่ token ที่ถูกต้อง หรือเป็นของร้านอื่น ทั้งสามกรณีได้คำตอบเดียวกัน token จึงใช้ค้นหาไม่ได้ว่ามีร้านใดอยู่บ้าง ขอ token ใหม่ตามการติดตั้งและ access token

GRAPHQL_PARSE_FAILED

HTTP 400 query ไม่ใช่ GraphQL ที่ถูกต้อง ข้อความและ locations ชี้ตำแหน่งที่ผิด

GRAPHQL_VALIDATION_FAILED

HTTP 400 query ขอฟิลด์หรือ argument ที่ schema ไม่มี เช่น Cannot query field "nope" on type "Shop". Did you mean "name"? ให้ตรวจ reference ของเวอร์ชันที่เรียก

ACCESS_DENIED

HTTP 200 scope ของ token หรือบทบาทของผู้ใช้เบื้องหลัง token ไม่อนุญาต operation นี้ ข้อความจะบอก scope ที่ขาด ให้เพิ่มใน Configuration ของแอปแล้วให้ร้านค้าอนุมัติ

รหัสทั้งหมดที่ API ส่ง

ฟิลด์ type ของคำตอบที่เป็น error คือ https://docs.tanqory.com/errors/<code> ซึ่งจะเปิดแถวของรหัสนั้นในตารางนี้ รายการนี้สร้างจากซอร์สของ API (tools/errors/codes.mjs) รหัสใหม่จึงปรากฏที่นี่พร้อมกับ release ที่ส่งรหัสนั้น ช่องสถานะที่ว่างหมายความว่าขึ้นกับคำขอ

รหัสสถานะ HTTPความหมายโดยย่อ
above_cap422Above cap
access_denied400Access denied
access_not_open409Access not open
access_request_closed409Access request closed
access_request_open409Access request open
account_gone409Account gone
account_not_foundAccount not found
account_owns_stores409Account owns stores
account_required409Account required
actor_not_permitted403Actor not permitted
addon_currency_unavailable409Addon currency unavailable
addon_in_use409Addon in use
addon_not_allowed_on_plan409Addon not allowed on plan
addon_not_sellable409Addon not sellable
addons_closing409Addons closing
addons_enterprise409Addons enterprise
addons_no_plan409Addons no plan
addons_past_due409Addons past due
addons_paused409Addons paused
addons_pending_change409Addons pending change
addons_trial409Addons trial
addons_unpaid409Addons unpaid
adopt_needs_rows409Adopt needs rows
already_asked409Already asked
already_delisted409Already delisted
already_erased409Already erased
already_granted422Already granted
already_live409Already live
already_refundedAlready refunded
already_registered422Already registered
amount_invalidAmount invalid
amount_over_remaining409Amount over remaining
api_client_limit409Api client limit
app_credentials_unavailable503App credentials unavailable
app_delisted409App delisted
app_has_charges409App has charges
app_installed409App installed
app_limit_reached409App limit reached
app_listed409App listed
app_not_published409App not published
app_published409App published
append_only_document409Append only document
applies_at_run_time409Applies at run time
applies_in_console409Applies in console
approval_closed409Approval closed
approval_open409Approval open
artifact_file_not_found404Artifact file not found
artifact_not_content_free422Artifact not content free
artifact_not_found404Artifact not found
artifact_not_ready422Artifact not ready
artifact_not_revocable422Artifact not revocable
artifact_yanked422Artifact yanked
assignee_not_allowed409Assignee not allowed
auth_code_expired400Auth code expired
auth_code_invalid400Auth code invalid
auth_code_replaced400Auth code replaced
auth_email_not_verified400Auth email not verified
auth_invalid_credentials401Auth invalid credentials
auth_mfa_invalid_code400, 401Auth mfa invalid code
auth_provider_new_connections_closed403Auth provider new connections closed
auth_session_expired400, 401Auth session expired
auth_token_invalid401Auth token invalid
authorization_pending400Authorization pending
avatar_size400Avatar size
avatar_type400Avatar type
bad_gateway502Bad gateway
bad_request400Bad request
below_margin422Below margin
billing_country_mismatch422Billing country mismatch
billing_portal_unavailable503Billing portal unavailable
billing_provider_error502Billing provider error
billing_provider_unavailable503Billing provider unavailable
brand_term_not_allowed400Brand term not allowed
budget_reached422Budget reached
build_artifact_mismatch422Build artifact mismatch
build_not_found404Build not found
build_not_installable404Build not installable
build_not_private422Build not private
build_not_signed422Build not signed
build_owner_mismatch422Build owner mismatch
build_revoked422Build revoked
build_service_token_unavailableBuild service token unavailable
build_service_unavailable503Build service unavailable
build_statement_unverified422Build statement unverified
cap_reached422Cap reached
card_country_mismatch422Card country mismatch
card_invalid422Card invalid
catalog_change_invalid409Catalog change invalid
catalog_incomplete409Catalog incomplete
catalog_key_missingCatalog key missing
catalog_unavailable503Catalog unavailable
cell_unreachable502, 503Cell unreachable
central_cell_mismatch422Central cell mismatch
cf_bad_answerCf bad answer
cf_unreachableCf unreachable
change_already_in_files409Change already in files
change_already_in_force409Change already in force
change_failed409Change failed
change_in_progress409Change in progress
change_not_merged409Change not merged
change_not_pending409Change not pending
change_of_registrant_unconfirmed409Change of registrant unconfirmed
change_pending_payment409Change pending payment
channel_expired410Channel expired
channel_not_found404Channel not found
charge_not_foundCharge not found
charge_not_paid409Charge not paid
charge_not_settledCharge not settled
check_recorded409Check recorded
checks_not_complete409Checks not complete
checks_not_passed409Checks not passed
config_moved409Config moved
config_required422Config required
config_rows_off409Config rows off
conflict409Conflict
content_migration_failed422Content migration failed
content_migration_unavailable422Content migration unavailable
content_not_found404Content not found
content_revision_conflict409Content revision conflict
content_store_unavailable503Content store unavailable
content_too_large413Content too large
content_version_mismatch422Content version mismatch
control_plane_unavailable503Control plane unavailable
country422Country
country_not_available409Country not available
custom_distribution409Custom distribution
custom_store_limit409Custom store limit
custom_theme_build_unavailable503Custom theme build unavailable
customerio_not_configured409Customerio not configured
customerio_version_not_approvable409Customerio version not approvable
cycle422Cycle
data_residency_unavailable409Data residency unavailable
demo_store_not_found400Demo store not found
dependency_unavailable503Dependency unavailable
development_install_unavailable503Development install unavailable
development_store_limit_reached409Development store limit reached
development_store_not_found400Development store not found
directory_changed409Directory changed
distribution_final409Distribution final
dns_elsewhere409Dns elsewhere
document_changed409Document changed
domain_sales_unavailable503Domain sales unavailable
editor_state_not_enabled404Editor state not enabled
editor_state_unauthenticated401Editor state unauthenticated
effective_date_too_soon409Effective date too soon
email_verification_required403Email verification required
emoji_not_allowed400Emoji not allowed
enrollment_closed403Enrollment closed
environment422Environment
errorError
exclusive_conflict422Exclusive conflict
expired_token400Expired token
export_not_approved409Export not approved
export_ready409Export ready
export_window_closed409Export window closed
feature_unavailable_in_country403Feature unavailable in country
field_invalidField invalid
field_requiredField required
file_too_large400File too large
files_changed409Files changed
flag_moved409Flag moved
flags_need_rows409Flags need rows
forbidden403Forbidden
gateway_timeout504Gateway timeout
generation_conflict409Generation conflict
generation_not_found404Generation not found
gone410Gone
group_missingGroup missing
group_would_be_emptyGroup would be empty
handle_taken409Handle taken
httpHttp
idempotency_key_required400Idempotency key required
idempotency_key_reused409, 422Idempotency key reused
identity_not_verified409Identity not verified
image_changed409Image changed
installation_in_use409Installation in use
installation_not_found404Installation not found
insufficient_scope403Insufficient scope
internal_error500Internal error
invalidInvalid
invalid_client401Invalid client
invalid_config422Invalid config
invalid_content422Invalid content
invalid_creditsInvalid credits
invalid_domainInvalid domain
invalid_event400Invalid event
invalid_grant400, 401Invalid grant
invalid_hostInvalid host
invalid_idInvalid id
invalid_parameter400, 422Invalid parameter
invalid_request400, 401Invalid request
invalid_responseInvalid response
invalid_scope400, 403Invalid scope
invalid_signature401Invalid signature
invalid_target400, 404Invalid target
invalid_token401Invalid token
invalid_transition409Invalid transition
invitation_other_account403Invitation other account
invoice_line_not_foundInvoice line not found
invoice_not_foundInvoice not found
invoice_not_paid409Invoice not paid
kv_partialKv partial
kv_unreachableKv unreachable
launch_intro_ineligible409Launch intro ineligible
launch_intro_price_unresolved500Launch intro price unresolved
launch_intro_unavailable409Launch intro unavailable
length_required411Length required
listing_approved409Listing approved
listing_in_review409Listing in review
listing_incomplete400Listing incomplete
listing_not_approved409Listing not approved
listing_not_draft409Listing not draft
listing_not_in_review409Listing not in review
live_key_outside_productionLive key outside production
locked423Locked
lot_emptyLot empty
lot_expiredLot expired
lot_not_foundLot not found
lot_not_refundableLot not refundable
low_balance422Low balance
manifest_invalid400Manifest invalid
manifest_mismatch400Manifest mismatch
manifest_required400Manifest required
manifest_too_large400Manifest too large
method_not_allowed405Method not allowed
mfa_enrollment_required403Mfa enrollment required
mfa_expired400, 401Mfa expired
move_open409Move open
move_stateMove state
move_switchedMove switched
never_published404, 409Never published
new_business422New business
no_account409No account
no_cell_available503No cell available
no_change409No change
no_connected_accountNo connected account
no_contract409No contract
no_eligible_target422No eligible target
no_invoiceNo invoice
no_passkey409No passkey
no_patch409No patch
no_payment_methodNo payment method
no_previous_secret409No previous secret
no_sample_data409No sample data
no_signed_build422No signed build
no_stripe_account503No stripe account
no_transfer_pending409No transfer pending
no_versions409No versions
not_a_theme409Not a theme
not_acceptable406Not acceptable
not_allowed_hereNot allowed here
not_an_update409Not an update
not_approved409Not approved
not_connected422Not connected
not_custom_distribution409Not custom distribution
not_delisted409Not delisted
not_editable409Not editable
not_found404Not found
not_implemented501Not implemented
not_installed409Not installed
not_listed409Not listed
not_manual409Not manual
not_on_trial409Not on trial
not_priced422Not priced
not_quarantined409Not quarantined
not_renewable422Not renewable
not_runNot run
not_sold422Not sold
not_transferable409Not transferable
not_your_request403Not your request
nothing_differs409Nothing differs
nothing_missing409Nothing missing
nothing_refundableNothing refundable
nothing_to_change400Nothing to change
notice_too_short409Notice too short
notification_default_not_approvable409Notification default not approvable
notification_defaults_dormant409Notification defaults dormant
nova_build_unavailable503Nova build unavailable
oauth_device_attempts429Oauth device attempts
oauth_device_not_found404Oauth device not found
oauth_no_partner_organization403Oauth no partner organization
oauth_no_scope403Oauth no scope
oauth_request_not_found404Oauth request not found
offer_needs_card409Offer needs card
offer_needs_checkout409Offer needs checkout
offer_needs_new_plan409Offer needs new plan
offer_not_a_discount409Offer not a discount
offer_not_applied409Offer not applied
offer_not_eligible409Offer not eligible
offer_not_found404Offer not found
offer_not_live422Offer not live
offer_staff_only403Offer staff only
offer_terms_frozen409Offer terms frozen
oidc_request_not_found404Oidc request not found
one_per_business422One per business
one_submission_open409One submission open
organization_in_use409Organization in use
organization_limit_reached409Organization limit reached
organization_name_taken409Organization name taken
outside_window422Outside window
over_thresholdOver threshold
override_not_allowed403Override not allowed
own_request403Own request
own_staff_change403Own staff change
owner_cannot_leave409Owner cannot leave
owner_hand_on_first409Owner hand on first
owner_needs_super_admin409Owner needs super admin
owner_only403Owner only
owner_role_fixed409Owner role fixed
parity_report_required422Parity report required
partner_permission_denied403Partner permission denied
partner_terms_not_accepted409Partner terms not accepted
pause_unavailable409Pause unavailable
payment_connect_failed502Payment connect failed
payment_connect_unavailable503Payment connect unavailable
payment_failed402Payment failed
payment_past_due409Payment past due
payment_required402Payment required
payment_setup_in_stripe409Payment setup in stripe
payouts_unavailable503Payouts unavailable
permission_required422Permission required
placement_not_found404Placement not found
placement_unresolved422Placement unresolved
plan422Plan
plan_change_needs_preview409Plan change needs preview
plan_change_not_available409Plan change not available
plan_change_scheduled409Plan change scheduled
plan_feature_required402Plan feature required
plan_limit_exceeded409Plan limit exceeded
plan_limit_reached402Plan limit reached
plan_required409Plan required
plan_unchanged409Plan unchanged
pointer_not_found404Pointer not found
pointer_not_poisoned409Pointer not poisoned
precondition_failed412Precondition failed
precondition_required428Precondition required
premium422Premium
preview_mismatch422Preview mismatch
preview_not_verified422Preview not verified
preview_quota429Preview quota
preview_required422Preview required
preview_stale409Preview stale
preview_unavailable503Preview unavailable
preview_used409Preview used
price_not_in_stripe409Price not in stripe
price_out_of_range400Price out of range
privacy_unavailable409Privacy unavailable
program_not_active422Program not active
program_not_found404Program not found
provider_unavailable503Provider unavailable
provisioning_not_enabled404Provisioning not enabled
publish_gate_quota429Publish gate quota
publish_in_progress409Publish in progress
publish_unavailable503Publish unavailable
purchase_not_paidPurchase not paid
query_cost_exceededQuery cost exceeded
rate_limit_exceeded429Rate limit exceeded
rate_limited429Rate limited
reason_required422Reason required
refund_needs_staffRefund needs staff
refund_pending409Refund pending
registrar_error422, 502Registrar error
registrar_not_connected503Registrar not connected
rehome_tombstone_invalid422Rehome tombstone invalid
release_never_live422Release never live
release_not_found404Release not found
release_red422Release red
renewal_in_progress422Renewal in progress
replay_guard_unavailableReplay guard unavailable
report_closed409Report closed
request_changed409Request changed
request_closed409Request closed
request_timeout408Request timeout
resource_already_exists409Resource already exists
resource_conflict409Resource conflict
resource_not_found404Resource not found
retry_later503Retry later
review_closed409Review closed
review_store_missing500Review store missing
revocation_done409Revocation done
revocation_sending409Revocation sending
role_conflict409Role conflict
rollback_needs_rows409Rollback needs rows
same_cell409Same cell
service_unavailable503Service unavailable
session_expired401Session expired
setup_task_done409Setup task done
setup_task_open409Setup task open
share_not_found404Share not found
share_quota429Share quota
slow_down400Slow down
sms_unavailable503Sms unavailable
source_invalid400Source invalid
source_not_found404Source not found
source_rejected400, 422Source rejected
source_required409Source required
source_too_large400Source too large
source_unavailable503Source unavailable
source_upload_unavailable503Source upload unavailable
staff_access_mismatch403Staff access mismatch
staff_access_required401Staff access required
staff_console_unavailable503Staff console unavailable
staff_exists409Staff exists
staff_permission_denied403Staff permission denied
staff_read_only403Staff read only
staff_session_required401Staff session required
step_up_method_unavailable400Step up method unavailable
step_up_required403Step up required
storage_limitStorage limit
store_access_denied403Store access denied
store_access_not_granted403Store access not granted
store_access_suspended403Store access suspended
store_closed409Store closed
store_closed_by_tanqory409Store closed by tanqory
store_data_purged410Store data purged
store_is_controller409Store is controller
store_kind422Store kind
store_limit_reached402Store limit reached
store_member_required403Store member required
store_mismatch422Store mismatch
store_movingStore moving
store_not_found404Store not found
store_not_open409Store not open
store_not_serving409Store not serving
store_not_suspended409Store not suspended
store_not_transferable409Store not transferable
store_on_hold409Store on hold
store_suspended_by_tanqory409Store suspended by tanqory
store_unavailable409Store unavailable
store_withdrawn409Store withdrawn
stores_partly_closed502Stores partly closed
studio_bad_responseStudio bad response
subdomain_taken409Subdomain taken
submission_limit_reached409Submission limit reached
submission_not_in_review409Submission not in review
subscription_needs_staff409Subscription needs staff
subscription_not_active409Subscription not active
subscription_not_found409Subscription not found
subscription_plan_not_found404, 409Subscription plan not found
super_admin_limit409Super admin limit
support_chat_disabled404Support chat disabled
target_not_eligible422Target not eligible
tax_profile_conflict409Tax profile conflict
temporary_host400Temporary host
terms_not_published409Terms not published
test_clock_advancing409Test clock advancing
test_clock_exists409Test clock exists
test_clock_missing409Test clock missing
test_clock_refused409Test clock refused
test_clock_unavailable409Test clock unavailable
test_key_in_productionTest key in production
theme_limit_reached409Theme limit reached
theme_manifest_unavailable422Theme manifest unavailable
theme_not_found404Theme not found
theme_not_listed409Theme not listed
theme_removed409Theme removed
tier_not_foundTier not found
too_many_requests429Too many requests
transfer_in_progress422Transfer in progress
transfer_other_account403Transfer other account
transfer_pending409Transfer pending
trial_store_limit_reached409Trial store limit reached
trust_root_below_floor503Trust root below floor
trust_root_unverified503Trust root unverified
turnstile_action_mismatch403Turnstile action mismatch
turnstile_unavailable503Turnstile unavailable
two_secrets_active409Two secrets active
two_step_required403Two step required
unauthorized401Unauthorized
unauthorized_client400Unauthorized client
unavailable422Unavailable
unknown_approval500Unknown approval
unknown_config_document500Unknown config document
unpaid_billUnpaid bill
unprocessable_content422Unprocessable content
unreachableUnreachable
unsupported_countryUnsupported country
unsupported_file_type400Unsupported file type
unsupported_grant_type400Unsupported grant type
unsupported_media_type415Unsupported media type
upload_incomplete409Upload incomplete
validation_error400Validation error
verification_closed409Verification closed
verification_code_expired409Verification code expired
verification_open409Verification open
verification_reported409Verification reported
verification_required422Verification required
version_current409Version current
version_in_review409Version in review
version_not_approved409Version not approved
version_not_checking409Version not checking
version_not_in_review409Version not in review
version_not_increasing409Version not increasing
version_not_released409Version not released
webhook_not_configured503Webhook not configured
wrong_cell409Wrong cell
wrong_request_type409Wrong request type

Cost errors

MAX_COST_EXCEEDED และ THROTTLED มีรูปแบบของตัวเอง โดยมีลิงก์ documentation แทน doc_url อธิบายไว้ที่ Rate limits and query cost

ใน payload ของ mutation

mutation ที่ทำงานแต่ทำตามที่ขอไม่ได้จะตอบ 200 พร้อม data และแสดงปัญหาใน userErrors ของ payload แต่ละรายการมี path ใน field และ message ให้เลือก userErrors และตรวจทุกครั้ง

JSON
{ "data": { "appUsageRecordCreate": { "appUsageRecord": null, "userErrors": [{ "message": "The app subscription line item must have a usage pricing plan" }] } } }

Error ของ token endpoint

token endpoint ตอบ error แบบ OAuth เช่น invalid_grant และ invalid_client ดู การติดตั้งและ access token

สร้างจาก commit c0b3fb3fdef7 · เวอร์ชัน API 2026-10