Retrofit

Type-safe HTTP client for Android and Java/Kotlin. Retrofit turns REST API interfaces into callable Java/Kotlin objects using annotations (@GET, @POST, @Body, @Path) and converters (Gson, Moshi, Jackson). Eliminates manual HTTP parsing boilerplate — define an interface, Retrofit generates the implementation. The de facto standard for Android networking, used in virtually every Android app.

Evaluated Mar 06, 2026 (0d ago) v2.11+
Homepage ↗ Repo ↗ Developer Tools http rest android java kotlin okhttp type-safe square
⚙ Agent Friendliness
66
/ 100
Can an agent use this?
🔒 Security
86
/ 100
Is it safe for agents?
⚡ Reliability
90
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

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

🔒 Security

TLS Enforcement
95
Auth Strength
85
Scope Granularity
80
Dep. Hygiene
88
Secret Handling
85

TLS via OkHttp (configurable). Auth via Interceptors — tokens kept in memory/keystore. Square is security-conscious. Certificate pinning supported. No built-in secret storage.

⚡ Reliability

Uptime/SLA
95
Version Stability
92
Breaking Changes
88
Error Recovery
85
AF Security Reliability

Best When

You're building an Android or JVM application that calls REST APIs and want type-safe interface definitions with automatic serialization/deserialization.

Avoid When

You need multiplatform (Android + iOS + JS) networking — use Ktor Client instead. Retrofit is JVM-only.

Use Cases

  • Define Android REST API clients as annotated Kotlin/Java interfaces — Retrofit generates the implementation with OkHttp and Gson/Moshi converters
  • Build type-safe API call wrappers for agent tools that target Android or JVM backends, with automatic request/response serialization
  • Integrate Retrofit with Kotlin coroutines (suspend functions) for non-blocking Android HTTP calls in agent workflows
  • Use Retrofit's RxJava adapter for reactive Android networking pipelines with Observable/Single return types
  • Generate mock API clients for testing Android agent implementations using Retrofit's MockRetrofit adapter

Not For

  • Non-Android/non-JVM environments — Retrofit is JVM-only; use Ktor, OkHttp directly, or kotlinx-ktor-client for multiplatform
  • WebSocket or streaming connections — Retrofit is HTTP request-response only; use OkHttp WebSocket API directly
  • GraphQL clients — use Apollo Android instead of Retrofit for GraphQL

Interface

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

Authentication

Methods: none
OAuth: No Scopes: No

Retrofit itself has no auth — authentication is handled via OkHttp Interceptors (add Authorization headers, token refresh, etc.). Standard pattern: add an Authenticator or Interceptor to the OkHttpClient builder.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Square open source library. Apache 2.0 license. No commercial restrictions.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • Retrofit interfaces must be created via Retrofit.create(ApiService::class.java) — calling interface methods directly throws IllegalStateException
  • Converter order matters: if multiple converters are added (Gson + Moshi), Retrofit uses the first one that can handle the type — order is significant
  • Null body in responses: Response.body() can return null on empty responses (204, 205, or 304) — agents must null-check before accessing
  • Kotlin coroutine suspend functions require the retrofit2-kotlin-coroutines-adapter OR Retrofit 2.6+ which supports suspend natively
  • Error responses need manual parsing: errorBody() returns ResponseBody, not your error DTO — call errorBody?.string() then parse manually or use a custom CallAdapter
  • Retrofit requires all interface method parameters to be non-null by default — nullable parameters require @Nullable annotation or Kotlin ? types with appropriate handling

Alternatives

Full Evaluation Report

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

$99

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

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