POST
https://spideriq.di-atomic.com
/
api
/
v1
/
jobs
/
spiderMaps
/
campaigns
/
{campaign_id}
/
next
Get Next Location
curl --request POST \
  --url https://spideriq.di-atomic.com/api/v1/jobs/spiderMaps/campaigns/{campaign_id}/next \
  --header 'Authorization: Bearer <token>'
{
  "has_more": true,
  "status": "<string>",
  "current_task": {
    "job_id": "<string>",
    "location_id": 123,
    "search_string": "<string>",
    "display_name": "<string>"
  },
  "progress": {
    "total": 123,
    "pending": 123,
    "submitted": 123,
    "completed": 123,
    "failed": 123,
    "percentage": 123
  }
}

Overview

This endpoint is the core of the campaign workflow. Each call:
  1. Finds the next pending location in the campaign
  2. Automatically submits a SpiderMaps job for that location
  3. Updates campaign progress
  4. Returns job details and progress statistics
Workflow Pattern: Call /next in a loop until has_more is false to process all locations in a campaign.

Path Parameters

campaign_id
string
required
The campaign ID returned from /submit

Response

has_more
boolean
true if more locations remain, false when campaign is complete
status
string
Campaign status: active, completed, stopped
current_task
object
Details of the submitted job (null when complete)
progress
object
Campaign progress statistics

Examples

Basic Usage

curl -X POST https://spideriq.di-atomic.com/api/v1/jobs/spiderMaps/campaigns/camp_lu_restaurants_abc123/next \
  -H "Authorization: Bearer <your_token>"
Response (In Progress):
{
  "has_more": true,
  "status": "active",
  "current_task": {
    "job_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "location_id": 28451,
    "search_string": "restaurants Luxembourg City, Luxembourg",
    "display_name": "Luxembourg City"
  },
  "progress": {
    "total": 12,
    "pending": 10,
    "submitted": 2,
    "completed": 0,
    "failed": 0,
    "percentage": 16.67
  }
}
Response (Campaign Complete):
{
  "has_more": false,
  "status": "completed",
  "current_task": null,
  "progress": {
    "total": 12,
    "pending": 0,
    "submitted": 0,
    "completed": 12,
    "failed": 0,
    "percentage": 100.0
  }
}

Complete Campaign Loop

import requests
import time

API_BASE = "https://spideriq.di-atomic.com/api/v1"
TOKEN = "<your_token>"
headers = {"Authorization": f"Bearer {TOKEN}"}

# Create campaign
campaign = requests.post(
    f"{API_BASE}/jobs/spiderMaps/campaigns/submit",
    headers=headers,
    json={"query": "restaurants", "country_code": "LU"}
).json()

campaign_id = campaign["campaign_id"]
print(f"Created campaign: {campaign_id}")
print(f"Total locations: {campaign['total_locations']}")

# Process all locations
job_ids = []
while True:
    result = requests.post(
        f"{API_BASE}/jobs/spiderMaps/campaigns/{campaign_id}/next",
        headers=headers
    ).json()

    if result["current_task"]:
        job_ids.append(result["current_task"]["job_id"])
        print(f"Submitted: {result['current_task']['display_name']} ({result['progress']['percentage']:.0f}%)")

    if not result["has_more"]:
        print(f"\nCampaign complete! Submitted {len(job_ids)} jobs.")
        break

    # Optional: small delay between submissions
    time.sleep(0.5)

N8N / Xano Integration

The /next endpoint is designed for easy integration with workflow automation tools:
Loop Node:
  Condition: response.has_more == true

  HTTP Request:
    Method: POST
    URL: /api/v1/jobs/spiderMaps/campaigns/{{campaign_id}}/next

  Store: response.current_task.job_id → job_ids[]

  Wait: 500ms (optional)

Error Responses

Campaign Not Found

{
  "detail": "Campaign not found: invalid_campaign_id"
}

Campaign Already Completed

When calling /next on an already-completed campaign:
{
  "has_more": false,
  "status": "completed",
  "current_task": null,
  "progress": {
    "total": 12,
    "pending": 0,
    "submitted": 0,
    "completed": 12,
    "failed": 0,
    "percentage": 100.0
  }
}