Table of contents

As you make API calls to different API providers, youâll likely receive a wide range of response codes.
These can vary based on how providers implement HTTP status codes and the nature of the issues associated with the requests. So, theoretically, you can end up receiving countless response codes.
However, youâll likely only run into a certain set of codes consistently.
Weâll help you understand and respond to each of the most common ones so that you can manage your API calls effectively over time.
But first, letâs align on the definition of an API response code.
Itâs an HTTP status code that a server returns to a client for a given API request. The code reveals whether the request was successful or not, and, if not, provides additional context on the issueâenabling the client to debug the issue if itâs on their end.
.avif)
{{this-blog-only-cta}}
Here are the top response codes to be aware of.
Youâll hopefully see this response code in the majority of your API calls. It simply means that the request was successful.

If you used a GET request, you should see the requested resource below the code, allowing you to easily pull the data. While if you used a method like PATCH, you might get a message that the data was updated on the server successfully and see the specific data that was updated.
This means that request was successful and a resource was created on the server.
Hereâs a simplified look at how the HTTP header can look for a successful response:

The body can include details on the resource that was created.

This is associated with either POST requests, where a new resource is created on the server, or PUT requests, where a resource is either created or replaced on the server.
API providers may end up changing their resourcesâ locations over time, leading you to receive this error.Â
Fortunately, the API provider typically shares the resource's new URL within the responseâs location header, which allows you to automatically redirect current and future requests for that resource.

You likely wonât need to debug this error, as most HTTP libraries handle redirects automatically.Â
This status code means that the requested resource is located in a different URL temporarily.Â
Similar to the 301 status code, the response includes the temporary URL within the location header.Â

Also like the 301 status code, thereâs likely little you need to do. Your request will automatically redirect to the temporary URL, and all future requests willâand shouldâcontinue to use the original URL, as the redirect is temporary.
This means that the requested resource either doesnât exist or isnât available.

You can debug this in a few ways:Â
Related: Top integration issues to look out for
This indicates that youâve reached your rate limit for calling a certain endpoint in the current rate limit window.

To troubleshoot this response code, you can:
This means that the request either doesnât have authentication credentials or the credentials donât have sufficient privileges to perform the desired action on the resource.

To manage this type of error, you can try any of the following:
Related: How to decide between building and buying integrations
The request couldnât be completed successfully because of an issue on the serverâs end.

To address this status code effectively, you can:
This generally means that a server is unavailableâwhether thatâs because itâs overloaded with traffic, undergoing maintenance, etc.
The API provider might include details on when you should retry the request in the header field âRetry-Afterâ, where the timeframe for retrying can be presented in seconds or through a specific timestamp.Â

To address this status code effectively, you can:
Analyzing and responding to individual status code errors can be overwhelming if left to your engineers. This is especially true for customer-facing integrations, as you might be supporting dozens of integrations that are used by countless end-users (your customerâs customers).
To offload this work to your customer-facing employees and to help these employees identify, diagnose, and resolve integration issues effectively and easily, your team can use Mergeâs Integration Observability tooling.
Learn more about this tooling and how our unified API lets you add hundreds of integrations to your product through a single build by scheduling a demo with one of our integration experts.
In case you have any more questions on API response codes, weâve addressed several more below.
Use 400 when the requestâs structure is invalid, missing required fields, or canât be parsed; and use 422 when the request is well-formed but fails domain or business-rule validation (e.g. date range conflict).Â
As a general best practice, you should not only implement 400 and 422 error codes but also any other potential 4xx response codes. This enables the client to understand the source of an error, decide whether to retry the request, andâif the request should be retriedâresend the request quickly and successfully.
A 202 response code means the server accepted the request but hasnât finished processing it.
To see when the server finishes handling a request, youâll have two options to choose from:
1. Youâll often see a status endpoint in the response that you can poll at a reasonable interval (and a max number of attempts) until the operation reaches a terminal state (success, failure, or timeout).
2. You might see a <code class="blog_inline-code">Retry-After</code> field in the response header that tells you when itâs safe to poll the endpoint. You can follow this value to time your follow-up status check.
The first option is most common. But if the endpoint also displays the <code class="blog_inline-code">Retry-After</code> value, you should prioritize the second option, as it provides more helpful instructions on when you should poll the endpoint.Â
A 401 Unauthorized response indicates that the client is unauthenticated or has provided invalid credentials, while a 403 Forbidden response means the client is authenticated but not authorized for the resource or action.
For a 401 response, the server provides a <code class="blog_inline-code">WWW-Authenticate</code> header. This header tells the client the type of authentication thatâs needed and any required parameters so the client can retry the request with appropriate credentials.
For example:
This tells the client that Basic authentication is required and that the credentials should correspond to the âadminâ realm.
A 403 Forbidden response typically doesnât include a <code class="blog_inline-code">WWW-Authenticate</code> header because the issue isnât authentication. The client is recognized but still not allowed to perform the action, either due to insufficient permissions or because the server forbids the operation entirely.
Many APIs include rate-limitârelated response headers to help clients pace their requests and avoid hitting rate limits.Â
Here are a few examples:
Merge lets you add hundreds of integrations to your product by simply building to its Unified API.