Monitoring API errors is crucial for maintaining a robust system. Server errors (5xx) usually signal underlying issues with your application, such as bugs in your code or networking problems.

Paying attention to client errors (4xx) is equally important, even if some are anticipated and not indicative of API problems. Analyzing client errors can provide valuable insights into how systems interact with your API. It can uncover potential issues within those systems and aid in refining your API’s design or documentation.

The Errors dashboard in Apitally provides a comprehensive overview of the errors encountered by consumers of your API.

The bar chart at the top shows the distribution of errors over time, broken down by client and server errors. When you hover over the bars you’ll see a tooltip with the number of occurrences of each error status code.

The table below lists all error status codes returned by your API’s endpoints and is sorted by the number of occurrences, so the most frequently occurring errors are at the top.

Error insights

Clicking on an error in this table opens up a modal with further insights about that error.

This includes a summary with the total number of occurrences, the number of affected API consumers and the time of the last occurrence.

A bar chart shows the frequency of the error over time and a second, horizontal bar chart displays the number of occurrences per API consumer, helping you identify which consumers are most affected by the error.

For validation and server errors, the modal includes a Details tab that provides additional information about the error.

Validation errors

Validating incoming requests is a fundamental task for API developers and frameworks. Many frameworks offer built-in validation capabilities, or are compatible with third-party validation libraries.

Apitally captures specific validation error messages encountered by your API consumers, which can help you refine validation rules or reveal issues on the consumer side.

This feature is currently supported for the following frameworks:

  • FastAPI (using pydantic)
  • Django Ninja (using pydantic)
  • Litestar (using pydantic, attrs or other modeling libraries)
  • Express (using express-validator or Joi + celebrate)
  • Fastify (using Ajv)
  • NestJS (using class-validator)
  • Hono (using Zod)

Server errors

If a 500 Internal Server Error response is caused by an unhandled exception in your code, Apitally captures details about the exception, such as the stack trace and the error message, and includes those in the Details tab of the error modal.

If you have enabled the Sentry integration for your app, you will also see a link to the Sentry issue that was created for the exception.

Expected errors

In certain applications or use cases, some client errors may be part of normal operation. You might not want these errors included in error rate metrics or combined with other failed requests.

Apitally enables you to mark specific client error status codes as expected for certain API endpoints. This prevents them from being counted as errors in error rate calculations, and requests with these response status codes are considered successful.

To do this, simply select Mark as expected from the dropdown menu in the errors table, which is opened by clicking on the button with three vertical dots on the right.