Tapir

Type-safe HTTP API definition library for Scala that generates both server implementations and OpenAPI documentation from a single endpoint description. Tapir endpoints are typed values: endpoint.in('path' / 'resource').in(jsonBody[RequestType]).out(jsonBody[ResponseType]).errorOut(statusCode). The same endpoint definition can generate http4s, Akka HTTP, or ZIO HTTP server routes, a Scala client, and OpenAPI 3 docs. 'Write once, deploy anywhere, document for free.'

Evaluated Mar 06, 2026 (0d ago) v1.x
Homepage ↗ Repo ↗ Developer Tools scala openapi type-safe api-definition http4s akka-http documentation server client
⚙ Agent Friendliness
66
/ 100
Can an agent use this?
🔒 Security
88
/ 100
Is it safe for agents?
⚡ Reliability
81
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
85
Error Messages
82
Auth Simplicity
88
Rate Limits
88

🔒 Security

TLS Enforcement
100
Auth Strength
85
Scope Granularity
82
Dep. Hygiene
88
Secret Handling
85

Type-safe input/output prevents implicit data leakage. Explicit error outputs prevent information disclosure in 500s. SecurityIn models auth requirements explicitly. No external network calls.

⚡ Reliability

Uptime/SLA
85
Version Stability
80
Breaking Changes
75
Error Recovery
85
AF Security Reliability

Best When

You're building Scala APIs that need accurate OpenAPI documentation and type-safe HTTP handling, and want both derived from the same source of truth.

Avoid When

Your team prefers writing OpenAPI specs manually (spec-first), or you're using a non-Scala JVM language where the type system benefits are reduced.

Use Cases

  • Define typed agent API endpoints once and generate both http4s server routes and OpenAPI 3.0 documentation automatically without manual spec maintenance
  • Build type-safe Scala HTTP clients from the same endpoint definitions used for the server — guarantees client and server API contracts stay in sync
  • Generate validated API documentation for agent services that is always accurate because it derives from the same type definitions as the implementation
  • Implement contract-first API development in Scala — define endpoints as typed values, then implement handler logic separately
  • Add automatic request/response validation by leveraging Tapir's codec derivation — invalid inputs are rejected before reaching business logic

Not For

  • Non-Scala teams — Tapir is Scala-specific; use OpenAPI Generator for multi-language spec-first development
  • Simple APIs without OpenAPI documentation needs — direct http4s or Akka HTTP routes are simpler without Tapir's endpoint abstraction
  • Teams that prefer handwriting OpenAPI specs — Tapir generates specs from code; code-first approach only

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Tapir provides endpoint.securityIn for modeling auth (bearer token, API key, basic auth) as typed inputs. Actual auth validation is server-side logic.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Tapir is Apache 2.0 licensed, maintained by SoftwareMill. Free for all use.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • Endpoint definitions use type-level programming — complex endpoint types cause slow Scala compilation; split complex endpoints into multiple simpler ones and combine with .orElse
  • Server interpreter selection is explicit — tapir-http4s-server, tapir-akka-http-server, tapir-zio-http-server are separate artifacts; importing the wrong interpreter causes runtime route failures
  • Error outputs must be explicitly defined — Tapir only generates error responses that are specified in .errorOut(); uncaught exceptions propagate as 500s without documentation
  • Streaming endpoints require explicit stream type parameters — streaming JSON arrays or server-sent events need fs2.Stream or akka.stream.scaladsl.Source typed endpoints
  • OpenAPI docs generation is separate from server — tapir-openapi-docs is a separate artifact; forgetting to add it means no OpenAPI spec even though endpoint types are defined
  • Binary backwards compatibility — Tapir uses Scala version-dependent binary artifacts (tapir-core_2.13, tapir-core_3); ensure Scala version consistency across all tapir modules in the project

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Tapir.

$99

Scores are editorial opinions as of 2026-03-06.

5215
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered