Skip to main content
Running an agent creates an asynchronous job. You submit parameters, receive a job ID, then poll for results when the job completes.

Start an Agent Run

Before running an agent, check its required parameters using GET /agents/{group}/{slug}. See the Agent Reference for all available agents.
curl -X POST https://api.mindcase.co/api/v1/agents/instagram/profile-scraper/run \
  -H "Authorization: Bearer mk_live_abc123def456" \
  -H "Content-Type: application/json" \
  -d '{
    "params": {
      "usernames": ["nike", "adidas", "puma"]
    }
  }'
Response (202 Accepted)
{
  "job_id": "job_7f3a2b1c",
  "status": "queued",
  "agent": "instagram/profile-scraper",
  "created_at": "2026-03-30T10:15:00Z"
}

Request Body

FieldTypeRequiredDescription
paramsobjectYesAgent-specific parameters. See each agent’s reference page.

Poll for Status

Jobs run asynchronously. Poll the status endpoint every 5–10 seconds until the status is completed or failed.
curl https://api.mindcase.co/api/v1/jobs/job_7f3a2b1c \
  -H "Authorization: Bearer mk_live_abc123def456"
Response
{
  "id": "job_7f3a2b1c",
  "status": "completed",
  "agent": "instagram/profile-scraper",
  "row_count": 3,
  "credits_used": 3,
  "created_at": "2026-03-30T10:15:00Z",
  "completed_at": "2026-03-30T10:15:32Z"
}

Get Results

Once the job status is completed, fetch the data:
curl https://api.mindcase.co/api/v1/jobs/job_7f3a2b1c/results \
  -H "Authorization: Bearer mk_live_abc123def456"
Response
{
  "status": "completed",
  "row_count": 3,
  "data": [
    {
      "username": "nike",
      "fullName": "Nike",
      "followersCount": 306000000,
      "verified": true,
      "biography": "Just Do It.",
      "externalUrl": "https://www.nike.com"
    },
    {
      "username": "adidas",
      "fullName": "adidas",
      "followersCount": 67000000,
      "verified": true,
      "biography": "Through sport, we have the power to change lives."
    },
    {
      "username": "puma",
      "fullName": "PUMA",
      "followersCount": 32000000,
      "verified": true,
      "biography": "Forever Faster."
    }
  ]
}

Complete Example

A full bash script that runs an agent and waits for results:
complete-flow.sh
#!/bin/bash
API_KEY="mk_live_abc123def456"
BASE="https://api.mindcase.co/api/v1"

# 1. Start the agent
RESPONSE=$(curl -s -X POST "$BASE/agents/linkedin/profile-scraper/run" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"params": {"queries": ["https://www.linkedin.com/in/satyanadella"]}}')

JOB_ID=$(echo $RESPONSE | grep -o '"job_id":"[^"]*"' | cut -d'"' -f4)
echo "Job started: $JOB_ID"

# 2. Poll until complete
while true; do
  STATUS=$(curl -s "$BASE/jobs/$JOB_ID" \
    -H "Authorization: Bearer $API_KEY" | grep -o '"status":"[^"]*"' | cut -d'"' -f4)
  echo "Status: $STATUS"
  if [ "$STATUS" = "completed" ] || [ "$STATUS" = "failed" ]; then
    break
  fi
  sleep 5
done

# 3. Get results
if [ "$STATUS" = "completed" ]; then
  curl -s "$BASE/jobs/$JOB_ID/results" \
    -H "Authorization: Bearer $API_KEY" | python3 -m json.tool
fi