A Java library that runs raw curl commands as ordinary Java method calls, so you can paste curl from Postman or browser DevTools without writing HTTP client code.
lysine-dev/retrofit
A type-safe HTTP client for Android and Java that turns annotated interface methods into network calls.
- Stars
- 43,934
- Forks
- 7,331
- Open issues
- 148
- Last commit
- 10 hours ago
What is it?
Retrofit is an HTTP client for Android and Java. You declare your API as a Java interface with annotated methods, and Retrofit generates the implementation that performs the HTTP requests, so calls are checked by the compiler rather than built from strings.
The library requires Java 8 or later, or Android API 21 or later. It is distributed through Maven Central under the coordinates com.squareup.retrofit2:retrofit. ProGuard and R8 shrinking rules are covered: R8 includes them automatically, while ProGuard users add them manually. OkHttp is a dependency and is used as the underlying transport.
Key features
- 01Declare HTTP endpoints as annotated Java interface methods.
- 02Generates the request implementation automatically at runtime.
- 03Built on OkHttp as the underlying HTTP transport.
- 04Ships R8 shrinking and obfuscation rules, with a ProGuard configuration file.
Use cases
- Calling a REST API from an Android app with compile-time checked method signatures.
- Building a typed client for a JVM service that consumes a JSON web API.
Quick start
- 1
Add the dependency com.squareup.retrofit2:retrofit:3.0.0 from Maven Central
- 2
Check that your environment meets the requirement of Java 8+ or Android API 21+
Things to know
- Requires Java 8+ or Android API 21+.
- ProGuard users must add the Retrofit rules manually.
Topics
FAQ
- What is retrofit?
- A type-safe HTTP client for Android and Java that turns annotated interface methods into network calls. Retrofit is an HTTP client for Android and Java. You declare your API as a Java interface with annotated methods, and Retrofit generates the implementation that performs the HTTP requests, so calls are checked by the compiler rather than built from strings.
- Is retrofit free to use? What license does it have?
- retrofit is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is retrofit still maintained?
- Actively maintained. The last commit to retrofit was on Oct 20, 2026.
- What can I use retrofit for?
- Calling a REST API from an Android app with compile-time checked method signatures. Building a typed client for a JVM service that consumes a JSON web API.
- How do I install retrofit?
- Add the dependency com.squareup.retrofit2:retrofit:3.0.0 from Maven Central Check that your environment meets the requirement of Java 8+ or Android API 21+
- Where can I get retrofit?
- The source code and installation instructions are on GitHub: https://github.com/lysine-dev/retrofit
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
An HTTP client for the JVM, Android, and GraalVM that reuses connections, supports HTTP/2, and caches responses by default.
Self-hosted, open-source PDF editing platform for editing, signing, redacting, converting and automating PDFs in the browser, desktop or via API.
Distributed, RESTful search and analytics engine that also serves as a scalable data store and vector database.
Command-line and GUI tools that decompile Android Dex, APK and related files into readable Java source code.
Open-source API client that stores collections as plain-text files on your filesystem, an offline alternative to Postman and Insomnia.