OSS TanbouSign in with GitHub

call HTTP APIs through typed Java and Kotlin interfaces

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
43,936
Primary language
Java
License
Apache-2.0
Repository last updated
Oct 2, 2026
On this page

Overview

Retrofit is an HTTP client for Android and the JVM that expresses API paths, parameters, and return values as Java or Kotlin interfaces.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Build HTTP calls from an annotated interface

Retrofit derives URLs, methods, and parameters from interface annotations and exposes synchronous or asynchronous calls. An added converter maps JSON and other response formats into typed values.

Sources: [3][1]

Best fit

Fits clients that want an API contract at a typed, testable boundary

Android and JVM clients can consolidate scattered URL strings and manual parsing into one service interface. A localhost fixture verifies paths and converted results without external credentials.

Sources: [3]

Before adoption

Design transport policy and API error handling in the client

Retrofit is an HTTP client, not an API server. Timeouts, retries, credentials, HTTP errors, converter failures, and model compatibility remain OkHttp and application concerns. Pin the reviewed 3.0.0 release and Apache-2.0 scope.

Sources: [2][5]

Official sources

  1. [1]Retrofit README at commit 3724fff(2026-10-05)
  2. [2]Retrofit 3.0.0 release(2026-10-05)
  3. [3]Retrofit declarations documentation(2026-10-05)
  4. [4]Retrofit GitHub metadata(2026-10-05)
  5. [5]Retrofit Apache license at commit(2026-10-05)
Supplemental curator note

Retrofit fits Android and JVM teams that want HTTP API boundaries expressed as typed interfaces. Verify paths and conversion against a localhost fixture, then define timeout, authentication, and error-handling policy.

Try it in 3 steps

  1. 1

    Pin Retrofit 3.0.0 and its JSON converter

    Requires Java 17, Maven, Python 3, and curl. Create a POM with fixed dependencies in a temporary directory.

    retrofit_demo_dir=$(mktemp -d "${TMPDIR:-/tmp}/retrofit-demo.XXXXXX") && cd "$retrofit_demo_dir" && printf '%s ' '<project xmlns="http://maven.apache.org/POM/4.0.0"><modelVersion>4.0.0</modelVersion><groupId>demo</groupId><artifactId>retrofit-demo</artifactId><version>1</version><properties><maven.compiler.release>17</maven.compiler.release></properties><dependencies><dependency><groupId>com.squareup.retrofit2</groupId><artifactId>retrofit</artifactId><version>3.0.0</version></dependency><dependency><groupId>com.squareup.retrofit2</groupId><artifactId>converter-gson</artifactId><version>3.0.0</version></dependency></dependencies><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.14.1</version></plugin></plugins></build></project>' > pom.xml
  2. 2

    Compile a typed API interface

    In the same directory, define GET /message and its JSON model, resolve dependencies, and compile.

    mkdir -p src/main/java/demo && printf '%s ' 'package demo; import retrofit2.*; import retrofit2.converter.gson.*; import retrofit2.http.*; public class Main { record Message(String value){} interface Api{@GET("message") Call<Message> message();} public static void main(String[]a)throws Exception{var r=new Retrofit.Builder().baseUrl(a[0]).addConverterFactory(GsonConverterFactory.create()).build();var v=r.create(Api.class).message().execute().body();System.out.println(v.value());}}' > src/main/java/demo/Main.java && mvn -q dependency:copy-dependencies package
  3. 3

    Convert a real localhost response

    Serve JSON from a directly owned loopback process and verify Retrofit converts it to typed-ok. The trap kills and waits for the PID on success or failure.

    ( set -eu; port=$(python3 -c 'import socket;s=socket.socket();s.bind(("127.0.0.1",0));print(s.getsockname()[1]);s.close()'); pid=''; cleanup(){ if [ -n "$pid" ];then kill "$pid" 2>/dev/null||true;wait "$pid" 2>/dev/null||true;fi;}; trap cleanup EXIT HUP INT TERM; printf '%s' '{"value":"typed-ok"}' > message; python3 -m http.server "$port" --bind 127.0.0.1 > server.log 2>&1 & pid=$!; i=0;until curl -fsS --max-time 1 "http://127.0.0.1:$port/message" >/dev/null;do i=$((i+1));[ "$i" -lt 20 ];sleep .25;done; out=$(java -cp 'target/classes:target/dependency/*' demo.Main "http://127.0.0.1:$port/");[ "$out" = typed-ok ];cleanup;pid='';python3 -c 'import errno,socket,sys;s=socket.socket();s.settimeout(1);r=s.connect_ex(("127.0.0.1",int(sys.argv[1])));raise SystemExit(0 if r==errno.ECONNREFUSED else 1)' "$port";trap - EXIT HUP INT TERM;printf '%s ' "$out" )
Check the official README

Growth

Growth trends · Last 30 days

43,936 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
17
Open PRs
38

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data

GitHub Topics

  • java
  • android
Stars
43,936
Forks
7,332
Watchers
1,542
Open issues
114
Contributors
163
Owner type
Organization
Primary language
Java
License
Apache-2.0
Repository last updated
Oct 2, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?