Java api with integration with Instagram api

Job ID: 40100279

Budget: ₹600 – ₹1,500 INR

Instagram Integration (Core APIs)



Overview



Your task is to implement three common, reusable REST APIs that handle Instagram account linking, data fetching, and token lifecycle management using official Meta app.



What You Have to Build (Only 3 APIs)



Link Instagram Account API


Goal
Allow a user to link their Instagram account using the official OAuth flow and store a user-scoped access token.

What to implement

Start Instagram OAuth authorization flow
Handle OAuth callback securely
Exchange authorization code for access token
Store token in DB with:

Access token
Expiry
Granted scopes
Instagram account type (personal / business / creator)

Single-step consent (login + permissions together)


Supported account types

Personal (public / private)
Business
Creator


Endpoints
GET /api/v1/instagram/link
GET /api/v1/instagram/callback
Expected result

Instagram account is linked
User-scoped token is saved securely
Account metadata is stored





Instagram Data Fetch API


Goal
Fetch Instagram data using the stored user token and persist it in the database.

What to implement

Use stored access token to call official Instagram APIs
Fetch (only what is allowed by account type & scopes):

User profile details
Recent posts/media
Followers list (only if API allows)

Handle pagination properly
Map responses into:

DTOs
JPA entities

Persist data using Spring Data JPA
Gracefully handle missing/restricted fields


Endpoint
POST /api/v1/instagram/fetch
Expected result

Data stored in DB
Clean, structured response returned





Refresh / Unlink Instagram Account API


Goal
Manage token lifecycle and allow account unlinking.

What to implement

Refresh access token (if supported)
Detect expired/invalid tokens
Revoke Instagram access when user unlinks
Cleanup:

Stored tokens
Related Instagram data (if required)



Endpoints
POST /api/v1/instagram/refresh
DELETE /api/v1/instagram/unlink
Expected result

Tokens refreshed or revoked correctly
Account cleanly unlinked




Technical Requirements


Spring Boot (latest stable)
Spring Security (OAuth handling)
Spring Data JPA
Any SQL DB (Postgres)
Clean architecture:

Controller
Service
Instagram API client
DTOs & Entities

Centralized error handling
Basic unit tests for:

OAuth flow
Token storage
Fetch logic






Deliverables


Working Spring Boot project
Runs locally with:

mvn spring-boot:run

README containing:

Environment variables
Instagram OAuth setup steps
Endpoint details

Postman collection or cURL scripts showing:

Link → Authorize → Fetch → Refresh/Unlink flow





Why Only These 3 APIs (For Clarity)


These APIs form the core Instagram integration layer.

Everything else depends on:

Account identity
User-scoped authorization
Reliable data ingestion


Once this is done:

No OAuth duplication later
No re-authorization issues
Fully policy-compliant
Easy to extend with new features





Compliance Expectations


Use official Meta / Instagram APIs only
Use user-scoped access tokens
No scraping, no private endpoints
Support token revocation
Respect data access limits per account type




Meta App Setup (Important)


A live setup call is required where you will:

Guide us in creating the Meta App
Configure:

App type
Instagram product
OAuth redirect URLs
Required scopes

Verify test login & permissions
Ensure the app is policy-compliant


This setup is part of the task.




Acceptance Criteria


OAuth works end-to-end
Tokens are user-scoped and stored securely
APIs work for all Instagram account types (with correct limitations)
Code is clean, extensible, and production-ready
Project runs locally without errors

Swagger Page to test these 3 api