Skip to main content

Discovery Queue

Manage a queue of discovered creators for review, enrichment, and onboarding.

Endpoints

Add to Queue

POST /api/discovery/queue

Get Queue Items

GET /api/discovery/queue

Update Queue Item

PATCH /api/discovery/queue/{itemId}

Remove from Queue

DELETE /api/discovery/queue/{itemId}

Add to Queue

Request

profiles
array
required
Array of profile objects to add to the queue

Response

success
boolean
Indicates if profiles were added successfully
data
object

Get Queue Items

Request

status
string
Filter by status: pending, reviewing, enriched, approved, rejected
platform
string
Filter by platform
priority
string
Filter by priority
limit
number
default:"50"
Maximum results (1-100)
offset
number
default:"0"
Pagination offset

Response

success
boolean
Indicates if the request was successful
data
object

Update Queue Item

Request

itemId
string
required
Queue item ID
status
string
New status
priority
string
New priority
notes
string
Reviewer notes
enrichmentData
object
Additional enrichment data

Examples

Add Discovered Profiles to Queue

// After keyword discovery
const discoveryResults = await searchByKeywords(['fitness']);

// Add high-engagement profiles to queue
const highEngagement = discoveryResults.data.profiles.filter(
  p => (p.heartCount / p.followerCount) > 0.05
);

const queueItems = highEngagement.map(profile => ({
  platform: 'tiktok',
  username: profile.username,
  platformUserId: profile.id,
  discoverySource: 'keyword',
  discoveryKeywords: ['fitness'],
  priority: profile.verified ? 'high' : 'medium'
}));

const response = await fetch(
  'https://your-domain.com/api/discovery/queue',
  {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ profiles: queueItems })
  }
);

const { data } = await response.json();
console.log(`Added ${data.added} profiles to queue, ${data.duplicates} duplicates skipped`);

Review Queue

// Get pending items
const response = await fetch(
  'https://your-domain.com/api/discovery/queue?status=pending&priority=high',
  {
    headers: { 'Authorization': `Bearer ${apiKey}` }
  }
);

const { data } = await response.json();

// Process each item
for (const item of data.items) {
  // Enrich profile data
  const profile = await enrichProfile(item.platform, item.username);
  
  // Update queue item with enrichment
  await fetch(
    `https://your-domain.com/api/discovery/queue/${item.id}`,
    {
      method: 'PATCH',
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        status: 'enriched',
        enrichmentData: profile
      })
    }
  );
}

Approve and Create Profile

// Get enriched items ready for approval
const enriched = await fetch(
  'https://your-domain.com/api/discovery/queue?status=enriched',
  {
    headers: { 'Authorization': `Bearer ${apiKey}` }
  }
).then(r => r.json());

for (const item of enriched.data.items) {
  // Create creator profile
  const creatorProfile = await prisma.creatorProfile.create({
    data: {
      name: item.enrichmentData.name,
      bio: item.enrichmentData.bio,
      category: inferCategory(item.discoveryKeywords),
      tags: item.discoveryKeywords,
      platformIdentifiers: {
        [`${item.platform}_username`]: item.username
      },
      // ... other fields from enrichmentData
    }
  });
  
  // Update queue status
  await fetch(
    `https://your-domain.com/api/discovery/queue/${item.id}`,
    {
      method: 'PATCH',
      headers: {
        'Authorization': `Bearer ${apiKey}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        status: 'approved',
        notes: `Created profile ${creatorProfile.id}`
      })
    }
  );
}

Response Example

Add to Queue Response

{
  "success": true,
  "data": {
    "added": 5,
    "duplicates": 2,
    "items": [
      {
        "id": "queue_abc123",
        "platform": "tiktok",
        "username": "fitnesspro",
        "status": "pending",
        "priority": "high",
        "createdAt": "2026-03-06T12:00:00Z"
      }
    ]
  }
}

Get Queue Response

{
  "success": true,
  "data": {
    "items": [
      {
        "id": "queue_abc123",
        "platform": "tiktok",
        "username": "fitnesspro",
        "platformUserId": "7234567890",
        "status": "pending",
        "priority": "high",
        "discoverySource": "keyword",
        "discoveryKeywords": ["fitness", "workout"],
        "enrichmentData": null,
        "notes": null,
        "createdAt": "2026-03-06T12:00:00Z",
        "updatedAt": "2026-03-06T12:00:00Z"
      }
    ],
    "total": 15,
    "hasMore": true
  }
}

Queue Status Flow

Next Steps

Budget Overview

Track discovery costs

Monitoring

Set up queue alerts

Build docs developers (and LLMs) love