A type-safe HTTP client for Android and Java
open sourceApache-2.0self-hostablefree
Retrofit turns an HTTP API into a Java or Kotlin interface: annotations on each method describe the request (method, path and query parameters, headers, form-encoded or multipart bodies), and Retrofit generates the implementation. Calls run synchronously or asynchronously, and Kotlin suspend functions can return the body or a Response directly. Converter modules serialize bodies with Gson, Jackson, Moshi, Protobuf, Wire, Simple XML, JAXB or kotlinx.serialization, and call adapters return RxJava, Guava or Java 8 types. It runs on OkHttp, needs Java 8+ or Android API 21+, and is Apache-2.0 licensed. Square created it; since 2026 it lives under lysine.dev, a member of the Commonhaus Foundation, with OkHttp and Okio.
Problems it solves
- call a REST API from my Android app without hand-writing HTTP request code
- describe API endpoints as a Java or Kotlin interface and get a working client
- parse JSON responses into Kotlin or Java objects automatically
- call a REST API from Kotlin coroutines with suspend functions
- upload files with multipart requests from Android
- add an auth header to every request in my Android networking layer
- return RxJava observables from my API client calls
- mock a REST API in tests of my Android app
Features
- annotations for request method, URL path and query parameters, headers and bodies
- form-encoded and multipart requests, including file upload
- synchronous and asynchronous calls
- Kotlin suspend functions returning the body or a Response
- converters for Gson, Jackson, Moshi, Protobuf, Wire, Simple XML, JAXB and kotlinx.serialization
- call adapters for RxJava 1-3, Guava, Java 8 and Scala futures
- retrofit-mock module for tests
- R8 shrinking rules included
Capabilities
| Takes plugins | plan not known |
|---|
Alternatives
The same job
These do what Retrofit does.
