Retrofit turns HTTP APIs into Java or Kotlin interfaces with annotated methods for paths, queries, and bodies. Generated clients support synchronous and asynchronous calls on Java 8+ or Android API 21+.
Overview
Retrofit is a client library that maps remote HTTP services to typed Java or Kotlin interfaces. You declare endpoints with annotations for verbs, URL templates, query parameters, and request bodies, then use a builder to create a live implementation that issues network calls.
Each service method returns a Call object that can execute synchronously or asynchronously against your configured base URL. The library supports common payload conversions, multipart uploads, and related patterns described in its documentation.
Distribute it as a JAR or Maven dependency; snapshot builds are published separately for development versions. Minimum supported environments are Java 8 or newer on the JVM and Android API level 21 or higher on Android.
Shrinkers such as R8 ship compatible rules automatically, while ProGuard users must add the provided keep rules plus any needed OkHttp rules because OkHttp is a dependency.
Key features
- Annotated Java or Kotlin API interfaces
- Synchronous and asynchronous Call objects
- URL template and query parameters
- JSON and protobuf body conversion
- Multipart uploads and file posts
- Maven Central and JAR distribution
- R8 rules bundled for Android builds
Use cases
- Android apps calling REST backends
- JVM services integrating HTTP APIs
- Typed SDKs over remote web services
- JSON or protobuf based mobile clients