Instagram API in Java
Call a REST API from Java 11+ with java.net.http.HttpClient and parse the JSON with Jackson. No Instagram login, no unofficial Java library to keep patched, and it works the same from Kotlin or any JVM language.
50 free credits on signup · no card required
curl "https://api.profilequery.com/v1/profile?handle=nike" \
-H "Authorization: Bearer $PROFILEQUERY_KEY"What you get
Structured JSON, not raw HTML
- ▹Plain java.net.http.HttpClient, with no SDK to install
- ▹JSON that maps straight onto records with Jackson or Gson
- ▹One cursor param for pagination on every list endpoint
- ▹Works from Spring Boot, Kotlin, Android backends and Scala
- ▹No Instagram account involved, so nothing gets banned
- ▹50 free credits on signup
Tutorial
Get Instagram data with Java
1. Fetch a profile
import java.net.URI;
import java.net.http.*;
import com.fasterxml.jackson.databind.*;
public class Instagram {
static final HttpClient http = HttpClient.newHttpClient();
static final ObjectMapper json = new ObjectMapper();
static final String KEY = System.getenv("PROFILEQUERY_KEY");
static JsonNode get(String path) throws Exception {
var req = HttpRequest.newBuilder(URI.create("https://api.profilequery.com/v1/" + path))
.header("Authorization", "Bearer " + KEY).build();
var res = http.send(req, HttpResponse.BodyHandlers.ofString());
return json.readTree(res.body()).get("data");
}
public static void main(String[] args) throws Exception {
var p = get("profile?handle=nike");
System.out.println(p.get("username").asText() + " " + p.get("followers").asLong());
}
}2. Page through posts
List endpoints return items and next_cursor. Pass next_cursor back as cursor (URL-encoded) until it's null.
String cursor = null;
for (int i = 0; i < 5; i++) {
var path = "profile/posts?handle=nike" + (cursor == null ? ""
: "&cursor=" + java.net.URLEncoder.encode(cursor, java.nio.charset.StandardCharsets.UTF_8));
var page = get(path);
for (var post : page.get("items")) System.out.println(post.get("url").asText());
var next = page.get("next_cursor");
if (next == null || next.isNull()) break;
cursor = next.asText();
}Example response
What comes back
{
"data": {
"id": "13460080",
"username": "nike",
"full_name": "Nike",
"biography": "Just Do It.",
"is_verified": true,
"is_private": false,
"is_business": true,
"category": null,
"followers": 291952375,
"following": 264,
"posts": 1657,
"external_url": "http://empli.fi/nike",
"profile_pic_url": "https://instagram.com/.../nike.jpg",
"public_email": null,
"public_phone_number": null
}
}Response fields
Fields returned by GET /v1/profile
| Field | Description |
|---|---|
| id | Numeric account id (stable even if the username changes). |
| username | The account's @handle. |
| full_name | Display name shown on the profile. |
| biography | The profile's bio text. |
| is_verified | Whether the account has a verified badge. |
| is_private | Whether the account is private. |
| is_business | Whether this is a business/professional account. |
| category | Business category label when set (e.g. "Sportswear"); null otherwise. |
| followers | Number of accounts following this account. |
| following | Number of accounts this account follows. |
| posts | Total number of posts on the profile. |
| external_url | The clickable link in the bio, if any. |
| profile_pic_url | URL of the account's profile picture. |
| public_email | Public contact email, if the account exposes one; null otherwise. |
| public_phone_number | Public contact phone number, if exposed; null otherwise. |
No login required
Nothing to authenticate but your API key
No OAuth flow
One static API key in an Authorization: Bearer header. No redirect, no refresh tokens, no expiring session.
No Meta app review
Never touch Meta's developer platform, Business Verification, or a connected Facebook Page. Sign up directly with Profile Query.
Public data only
Every endpoint returns only what's already visible on Instagram without logging in. Private accounts are never accessible.
Pricing
1 credit per request. Credits start at $8.00 per 1,000 and drop to $6.00 per 1,000 at volume — no subscription, no minimums. New accounts get 50 free credits.
See full pricingFAQ
Instagram API in Java, explained
Is there an official Instagram Java SDK?
Meta doesn't publish one for public data. Unofficial Java libraries log in with an Instagram account and break when the app changes. A REST API needs only HttpClient.
Does it work with Kotlin or Spring Boot?
Yes. It's standard HTTPS and JSON, so RestTemplate, WebClient, OkHttp, Ktor or any HTTP client works.
How much does it cost?
Most lookups are 1–2 credits. Credits start at $8.00 per 1,000, and new accounts get 50 free.
Related
More ways to pull Instagram data
Start pulling java data
Create a free key and make your first request in under a minute — 50 credits on us.