---
title: "Discussion on \"Fastify Fundamentals: How to Validate API Responses\" | Hashnode"
description: "Discussion on \"Fastify Fundamentals: How to Validate API Responses\". Validation is an important aspect of API development as it helps you check whether an API is working as expected, whether it returns the right data quickly, and if it meets security requirements.\nDevelopers who use Fastify need to remain aware of how..."
url: "https://hashnode.com/posts/fastify-fundamentals-how-to-validate-api-responses/65d892adc201f4056cf6ee9b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Fastify Fundamentals: How to Validate API Responses](https://blog.platformatic.dev/fastify-fundamentals-how-to-validate-api-responses?utm_source=hashnode&utm_medium=feed)

Validation is an important aspect of API development as it helps you check whether an API is working as expected, whether it returns the right data quickly, and if it meets security requirements. Developers who use Fastify need to remain aware of how...

Feb 23, 2024 · 6 min read · blog.platformatic.dev  
Read the article

-   [#platformatic](https://hashnode.com/tag/platformatic)
-   [#fastify](https://hashnode.com/tag/fastify)
-   [#apis](https://hashnode.com/tag/apis)
-   [#validation](https://hashnode.com/tag/validation)
-   [#ajv](https://hashnode.com/tag/ajv)
-   [#json-schema](https://hashnode.com/tag/json-schema)
-   [#serialization](https://hashnode.com/tag/serialization)

## Written by

[Matteo Collina](https://hashnode.com/@matteocollina)

@matteocollina

  
[View profile](https://hashnode.com/@matteocollina)

Open Sourcerer, Node.js TSC member, Fastify Lead Maintainer

## Responses 2

Markdown supported · ⌘↵ to post

[Damien Garrido](https://hashnode.com/@damiengarrido)

[Jun 18, 2024](https://hashnode.com/posts/fastify-fundamentals-how-to-validate-api-responses/65d892adc201f4056cf6ee9b/comment/66715de93c4361919ff75c73)

I would also respond with an HTTP 400 for a failed request validation (and an HTTP 500 for a failed response validation).

[Damien Garrido](https://hashnode.com/@damiengarrido)

[Jun 18, 2024](https://hashnode.com/posts/fastify-fundamentals-how-to-validate-api-responses/65d892adc201f4056cf6ee9b/comment/66715d3cbf355d6006ff8904)

Shouldn't this article be entitled "How to validate API requests"?
