Discovery Queue
Manage a queue of discovered creators for review, enrichment, and onboarding.
Endpoints
Add to Queue
POST /api/discovery/queue
Get Queue Items
Update Queue Item
PATCH /api/discovery/queue/{itemId}
Remove from Queue
DELETE /api/discovery/queue/{itemId}
Add to Queue
Request
Array of profile objects to add to the queue
Platform: tiktok, instagram, youtube, twitter
Platform-specific user ID
How the profile was discovered: keyword, trending, manual
Keywords that led to discovery
Queue priority: low, medium, high, urgent
Response
Indicates if profiles were added successfully
Number of duplicates skipped
Array of created queue items with IDs
Get Queue Items
Request
Filter by status: pending, reviewing, enriched, approved, rejected
Response
Indicates if the request was successful
Array of queue items
Enriched profile data (if enriched)
Total items matching filter
Update Queue Item
Request
Additional enrichment data
Examples
Add Discovered Profiles to Queue
TypeScript
JavaScript
cURL
// 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`);
// Add single profile to queue
async function addToQueue(profile) {
const response = await fetch(
'https://your-domain.com/api/discovery/queue',
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
profiles: [{
platform: profile.platform,
username: profile.username,
platformUserId: profile.id,
discoverySource: 'manual',
priority: 'high'
}]
})
}
);
return await response.json();
}
curl -X POST https://your-domain.com/api/discovery/queue \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"profiles": [
{
"platform": "tiktok",
"username": "fitnesspro",
"platformUserId": "7234567890",
"discoverySource": "keyword",
"discoveryKeywords": ["fitness"],
"priority": "high"
}
]
}'
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