Back to all posts
Backend7 min read·October 25, 2026

Why an API Works in Sandbox but Fails in Production

TB
ThynkBlox Team
Engineering

If your API works in sandbox but not production, start by checking what changed between the two environments. A successful sandbox test does not establish that your live endpoint, credentials, permissions, account status or real records are correct. Compare one failing operation with the provider's production requirements, then verify the complete result through a safely controlled live test.

What does sandbox success actually prove?

Treat a passing test as evidence about the exact conditions tested: the account, request, records and response used in that run. Before extending that conclusion to production, establish which conditions remain the same.

For example, creating a sample order does not answer whether the live account may create orders, whether the intended customer record exists, or whether the completion callback reaches your application.

Ask the provider which behaviours its sandbox reproduces and which require live verification. Use that answer to define the remaining checks.

Where should you start diagnosing the failure?

Choose one failing operation. Record its intended result, the observed result and the point where they diverge. Avoid changing several settings together: you need to know which correction resolves the failure.

Use this sequence to organise the investigation:

CheckQuestion to answerEvidence to collect
EndpointDid the request reach the intended production service?Destination and API version
CredentialsDoes the credential belong to the intended live account?Credential metadata, without secret values
PermissionsMay that account perform this operation?Granted access and required permissions
ActivationIs the relevant live capability enabled?Account and capability status
DataAre these records valid for this account and operation?Record ownership and validation response
QuotasIs a usage or spending limit blocking the request?Limit details and current usage
CallbacksDid the final event reach and update the application?Delivery record and resulting state
NetworkCan the actual application reach the provider?Connection result from the running application

Keep a sanitised record of the failure. Include the provider's request reference where available, but exclude credentials and personal data.

Are the endpoint and live credentials matched correctly?

Inspect the destination of the actual outgoing request. Compare the hostname, route and API version with the provider's production documentation. Confirm any region or account-specific destination the provider requires.

Next, check the credential's identity without copying its secret value into a report. Confirm its account, production designation, expiry status and intended application.

Do not stop at “the setting was updated”. Verify what the running application used for the failing request.

If an authorisation flow is involved, compare its production registration with the request being made. Check the registered redirect address, requested access and account connection. Keep these checks separate from business-event callbacks, which need their own verification.

Is the live account activated and allowed to perform the operation?

Check authentication, permission and activation separately:

  • Authentication: does the provider recognise the caller?
  • Permission: does the caller have the required access?
  • Activation: is the requested capability available to this live account?

Use the provider's account view and documentation to establish each answer. Inspect the exact capability involved, rather than relying on a general “account active” label.

Check for outstanding verification, agreements, billing setup or product enablement where the provider requires them. Confirm whether access applies to the intended organisation, connected account or individual user.

Request only the permissions the operation needs. Broadening access without identifying the missing permission leaves the original question unanswered.

Does the request use valid production data?

Trace each identifier in the failing request to its live record. Check ownership, status and eligibility for the requested action. Establish whether any identifier was copied from a sandbox example.

Then compare the request with the production contract. Review required fields, accepted values, currency, units and record relationships. Read the provider's validation response before changing the payload.

Inspect application decisions too. If the response contains an unfamiliar status or an optional field is absent, determine how your application handles it. Do not treat an unrecognised response as success.

For wider test planning, see software testing and quality assurance practices.

Are quotas, billing or retries blocking progress?

Check the limits attached to the live account and the specific operation. Look for request limits, concurrent-operation limits, spending controls and available balance where relevant. Use the provider's documented meaning of the response to decide which applies.

Before retrying a write, establish whether the first attempt created anything. Inspect the provider's operation record or documented status lookup.

If the API supports an idempotency key—a value used to identify repeated attempts at the same operation—confirm its documented scope and reuse rules before relying on it.

Set a bounded retry policy that follows the provider's guidance. Repeatedly sending the same request is not a diagnosis.

Did the callback complete the business operation?

Separate “the provider accepted the request” from “the intended result is complete”. Establish what each response and event means in the provider's documented lifecycle.

For callbacks, inspect the full path:

  • Is the intended production destination registered?
  • Is the required event selected for the correct account?
  • Does the provider show a delivery attempt?
  • Did your application receive and verify it?
  • Did processing update the correct record?
  • What happened if delivery or processing failed?

Where the provider documents repeated or out-of-order delivery, test those conditions explicitly. Confirm that processing a repeated event does not repeat its business effect.

Measure completion through the result the user needs, such as a confirmed booking. A callback receipt alone does not establish that result.

Could network restrictions explain the difference?

Run the connection check from the application that sends the live request. A successful request from a developer's computer establishes only that computer's result.

Check name resolution, secure connection errors, outbound access rules and any provider allowlist requirements. For browser requests, inspect the browser's reported failure and compare the request with the provider's supported browser access pattern.

Investigate outbound requests and incoming callbacks separately. Record which direction fails before changing access rules.

Avoid disabling certificate validation or opening broad access as a troubleshooting shortcut. Make the narrow correction supported by the observed error. See data security in modern applications for related security considerations.

How can you verify production safely?

Define the live test before running it:

  • Name the operation and the expected final state.
  • Use an authorised account and approved test records.
  • Prefer a read-only operation for the first connection check.
  • For a necessary write, agree its scope, cost and cleanup.
  • Prevent unrelated notifications or downstream actions where supported.
  • Define the stop condition and how to reconcile an uncertain result.

Illustrative example: verify an order integration by first reading an approved customer record. Then create one authorised order, inspect its provider status, confirm the completion event and check the application's final order state. Record whether cancellation or cleanup is required.

Stop if the result is unclear. Resolve the existing operation before starting another.

What common mistakes should you avoid?

Changing everything together. Correct one confirmed mismatch, then repeat the same controlled test.

Treating every rejection as a credential problem. Read the response and check permissions, activation and data independently.

Testing only the initial response. Verify the final business state and any required callback.

Trying customer records at random. Use approved records with a known expected outcome.

Assuming every live failure is an environment mismatch. Check provider service notices and whether the documented operation is currently available before changing your application.

Frequently asked questions

Should you replace sandbox tests with live tests?

Keep both. Use sandbox tests for the scenarios it supports, and controlled live checks for production conditions that remain unverified.

What if the provider offers no safe live write test?

Confirm the supported verification method with the provider. Complete read-only checks first, and agree an authorised real operation only if necessary.

What should a founder request before accepting the integration?

Request evidence of the intended live account, required access, one controlled end-to-end result, failure handling and any cleanup. Acceptance should describe the business outcome, not just a successful API response.

Ready to build?

Let's turn these ideas into your next product.

Start your project