A family of combinators for defining webservices APIs and serving them

Version on this page:0.7.1
LTS Haskell 22.22:0.20@rev:4
Stackage Nightly 2024-05-21:0.20@rev:5
Latest on Hackage:0.20@rev:5

See all snapshots servant-server appears in

BSD-3-Clause licensed by Servant Contributors
Maintained by [email protected]
This version can be pinned in stack with:servant-server-0.7.1@sha256:1e6ad2abb277c2501dfcbe2a9115a43dfcebad99a4c901cdae2a742971a338ac,4485



This library lets you implement an HTTP server with handlers for each endpoint of a servant API, handling most of the boilerplate for you.

Getting started

We’ve written a tutorial guide that introduces the core types and features of servant. After this article, you should be able to write your first servant webservices, learning the rest from the haddocks’ examples.




  • The Router type has been changed. Static router tables should now be properly shared between requests, drastically increasing the number of situations where servers will be able to route requests efficiently. Functions layout and layoutWithContext have been added to visualize the router layout for debugging purposes. Test cases for expected router layouts have been added.
  • If an endpoint is discovered to have a non-matching “accept header”, this is now a recoverable rather than a fatal failure, allowing different endpoints for the same route, but with different content types to be specified modularly.
  • Export throwError from module Servant
  • Add Handler type synonym


  • If servers use the BasicAuth combinator and receive requests with missing or invalid credentials, the resulting error responses (401 and 403) could be overwritten by subsequent alternative routes. Now BasicAuth uses FailFatal and the error responses can’t be overwritten anymore.


  • Query parameters that can’t be parsed result in a 400 (was 404).


  • Add Config machinery ( This is a breaking change, as the signatures of both route, serve and the typeclass HasServer now take an additional parameter.
  • Support for the HttpVersion, IsSecure, RemoteHost and Vault combinators
  • Drop EitherT in favor of ExceptT
  • Use http-api-data instead of Servant.Common.Text
  • Remove matrix params.
  • Remove RouteMismatch.
  • Redefined constructors of RouteResult.
  • Added Delayed and related functions (addMethodCheck, addAcceptCheck, addBodyCheck, runDelayed)
  • Added support for Basic Authentication
  • Add generalized authentication support via the AuthServerData type family and AuthHandler handler


  • Bump attoparsec upper bound to < 0.14
  • Bump wai-app-static upper bound to < 3.2
  • Bump either upper bound to < 4.5