API Documentation

Back to Home

Instagram Profile Analysis API

Quick Start

Base URL: https://viveka.darkgravitylabs.com

Authentication: None required (for now)

How it works: Viveka pulls photos and videos from Instagram profiles and sends them to Gemini AI for analysis. The AI can understand both images and video content, analyzing visual themes, captions, and more based on your prompt.

Sync vs Async: /api/v1/analyze gives results right away. /api/v1/jobs lets you start a job and check back later.

Endpoints

POST /api/v1/analyze

Synchronous: Waits for analysis to complete before returning results (60-120 seconds).

Request

Parameter Type Required Description
profiles array[string] Yes Instagram usernames (currently max 1 profile)
prompt string Yes Analysis question for the AI
max_posts_per_profile integer No Posts to analyze (default: 20, max: 100)

Example

curl -X POST https://viveka.darkgravitylabs.com/api/v1/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "profiles": ["natgeo"],
    "prompt": "What are the main themes?",
    "max_posts_per_profile": 15
  }'

Response

{
  "results": [
    {
      "username": "natgeo",
      "status": "success",
      "analysis": "# Analysis\n\nMain themes include...",
      "error_code": null,
      "error_message": null
    }
  ]
}

POST /api/v1/jobs

Asynchronous: Returns immediately with job_id. Poll for results using GET endpoint below.

Request

Parameter Type Required Description
profiles array[string] Yes Instagram usernames (currently 1 profile)
prompt string Yes Analysis question for the AI
max_posts_per_profile integer No Posts to analyze (default: 20, max: 100)

Example

curl -X POST https://viveka.darkgravitylabs.com/api/v1/jobs \
  -H "Content-Type: application/json" \
  -d '{
    "profiles": ["natgeo"],
    "prompt": "What are the main themes?",
    "max_posts_per_profile": 15
  }'

Response

{
  "job_id": "550e8400-e29b-41d4-a716-446655440000"
}

GET /api/v1/jobs/{job_id}

Check job status and retrieve results.

Request

Parameter Type Required Description
job_id string (UUID) Yes Job ID from POST /api/v1/jobs response

Example

curl https://viveka.darkgravitylabs.com/api/v1/jobs/550e8400-e29b-41d4-a716-446655440000

Response (for status: completed)

{
  "job_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "completed",
  "created_at": "2025-01-15T10:30:00Z",
  "results": [
    {
      "username": "natgeo",
      "status": "success",
      "analysis": "# Analysis\n\n...",
      "error_code": null,
      "error_message": null
    }
  ],
  "error": null
}

Status values: pending, running, completed, failed

Error Codes

When analysis fails, results include an error code and message:

Code Description
PROFILE_NOT_FOUND Instagram profile doesn't exist
PRIVATE_PROFILE Profile is private
INVALID_USERNAME Invalid username format
CONTENT_BLOCKED Blocked by safety filters
EMPTY_ANALYSIS AI returned empty analysis
APIFY_ERROR Failed to fetch profile data
GEMINI_ERROR AI analysis service error
NOT_IMPLEMENTED Feature not yet implemented
UNKNOWN_ERROR Unexpected error occurred

Error Response Example

{
  "results": [
    {
      "username": "invalid_user",
      "status": "error",
      "analysis": null,
      "error_code": "PROFILE_NOT_FOUND",
      "error_message": "This Instagram profile doesn't exist"
    }
  ]
}

Usage Examples

Synchronous (Simple)

curl -X POST https://viveka.darkgravitylabs.com/api/v1/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "profiles": ["natgeo"],
    "prompt": "Analyze the visual storytelling style",
    "max_posts_per_profile": 20
  }' | jq '.results[0].analysis'

Asynchronous (Integration-friendly)

1. Submit job

JOB_ID=$(curl -s -X POST https://viveka.darkgravitylabs.com/api/v1/jobs \
  -H "Content-Type: application/json" \
  -d '{
    "profiles": ["natgeo"],
    "prompt": "Analyze the visual storytelling style",
    "max_posts_per_profile": 20
  }' | jq -r '.job_id')

echo "Job ID: $JOB_ID"

2. Poll for completion

while true; do
  STATUS=$(curl -s https://viveka.darkgravitylabs.com/api/v1/jobs/$JOB_ID | jq -r '.status')
  echo "Status: $STATUS"
  [[ "$STATUS" == "completed" || "$STATUS" == "failed" ]] && break
  sleep 5
done

3. Get results

curl -s https://viveka.darkgravitylabs.com/api/v1/jobs/$JOB_ID | jq '.results[0].analysis'

Be a founding user. I'm building what you need. Hear about new features.

Yannik Zimmermann

Who's Behind This

Yannik Zimmermann — Building tools to understand people better. Viveka started as a personal experiment to analyze Instagram profiles through an AI lens.