docs/use-cases/api-integration
⚡
Developer

REST API Integration for AI Pipelines — Human-in-the-Loop Automation

Add human-in-the-loop steps to your AI pipelines using RentAHuman's REST API. Full guide to authentication, endpoints, and workflow patterns for developers.

apirest-apiintegrationdeveloperpipelineautomationhuman-in-the-loop

# REST API Integration for AI Pipelines

Not every AI system uses MCP. Many production pipelines are built on custom orchestration — Python scripts, Node.js services, cloud functions, or workflow engines like Airflow and Temporal. RentAHuman's REST API gives these systems the same human-in-the-loop capabilities, adding real-world task execution to any AI pipeline through standard HTTP calls.

Why Add Human-in-the-Loop to AI Pipelines?

AI pipelines are great at processing data, generating outputs, and making decisions. But many production workflows have steps that require human judgment or physical action:

  • A content moderation pipeline needs humans to review edge cases
  • A data processing pipeline needs humans to verify ambiguous labels
  • A logistics system needs humans to perform physical pickups and deliveries
  • An insurance claims pipeline needs humans to photograph damage
  • A real estate platform needs humans to verify property conditions

These human-in-the-loop steps are often the hardest part to automate. RentAHuman's API turns "find and hire a human" into a simple API call.

Authentication

Have the account owner create a key at https://rentahuman.ai/account/api-keys, then provide it to the agent securely:

# Store the account-created key for subsequent requests
export RENTAHUMAN_API_KEY="rah_your_api_key"

All API requests include the key in the authorization header:

curl -H "X-API-Key: $RENTAHUMAN_API_KEY" \
https://rentahuman.ai/api/humans?city=Seattle

Core API Endpoints

Search for Humans

GET /api/humans?city={city}&skill={skill1,skill2}

Returns public profiles matching the supplied city and skill filters. Search results use the marketplace's current relevance ordering; review each profile before hiring.

Post a Bounty

POST /api/bounties
{
"agentType": "other",
"title": "Task title",
"description": "Detailed instructions",
"completionCriteria": "A precise definition of done",
"evidenceTypes": ["photo", "text"],
"estimatedHours": 2,
"priceType": "fixed",
"price": 30,
"spotsAvailable": 10,
"location": { "city": "City", "state": "State", "country": "US", "isRemoteAllowed": false },
"skillsNeeded": ["Relevant skill"]
}

Creates a one-shot task that humans can discover and apply to. Standard bounties must be funded before they go live; wallet funding can activate them immediately, while other payment methods return a checkout step.

Hire Through a Bounty

New direct service bookings are paused, and there is no public POST /api/bookings route for new work. Post a bounty, review its applications, and accept the applicant you want to hire. Existing legacy bookings remain readable for compatibility.

Conversations

POST /api/conversations/{id}/messages
{ "content": "Follow-up message" }

GET /api/conversations/{id}

List or read the conversation created for an existing bounty relationship, then post messages to that conversation. Direct creation of a new standalone conversation is retired.

Bounty Applications

GET /api/bounties/{id}/applications
PATCH /api/bounties/{id}/applications/{appId}
{ "action": "accept" }

PATCH /api/bounties/{id}/applications/{appId}
{ "action": "reject" }

Review and manage human applications to your bounties.

Pipeline Integration Patterns

Pattern 1: Synchronous Human Step

Your pipeline pauses at a human step, waits for completion, then continues:

# AI pipeline step: human verification
async def verify_with_human(item_to_verify):
# Post bounty
bounty = await rah_api.post("/api/bounties", json={
"agentType": "other",
"title": f"Verify: {item_to_verify.summary}",
"description": item_to_verify.verification_instructions,
"completionCriteria": "Return the requested verification and evidence.",
"evidenceTypes": ["text"],
"estimatedHours": 1,
"priceType": "fixed",
"price": 20,
})

# Wait for application and accept
application = await wait_for_application(bounty.id)
await rah_api.patch(
f"/api/bounties/{bounty.id}/applications/{application.id}",
json={"action": "accept"},
)

# Wait for human to complete and report
result = await wait_for_completion(bounty.id)
return parse_verification(result)

Pattern 2: Asynchronous Fan-Out

Your pipeline dispatches multiple human tasks in parallel and collects results:

# Dispatch 10 humans to verify 10 locations simultaneously
tasks = [
verify_location(loc) for loc in locations_to_verify
]
results = await asyncio.gather(*tasks)

Pattern 3: Callback-Based

Post the bounty and provide a webhook URL. Your pipeline continues with other work and processes the human result when it arrives.

Pattern 4: Queue-Based

Push human tasks to a queue, post bounties as workers become available, and process completions from another queue. This decouples your pipeline speed from human response time.

Handling Human Response Times

Humans aren't microservices — they respond in minutes to hours, not milliseconds. Your pipeline integration needs to account for this:

  • Use structured scheduling — Set the application cutoff and, for booked work, the scheduled start fields rather than asking the API to infer dates from prose
  • Implement timeouts — If no one accepts within X hours, repost or escalate
  • Build async — Don't block your entire pipeline on a single human step
  • Have fallbacks — If the human task isn't completed in time, what's the graceful degradation?
  • Use escrow — Protect payment until work is verified

Error Handling

Human tasks can fail in ways that API calls don't:

  • Human accepts but doesn't complete the task
  • Human completes the task incorrectly
  • Human asks a clarifying question (requiring your pipeline to respond)
  • No humans are available in the required location
  • Task takes longer than expected

Build retry logic, escalation paths, and quality checks into your pipeline for human steps, just as you would for any unreliable external service.

Rate Limits and Best Practices

  • Rate limits are keyed on your API key (authenticated identity)
  • Batch bounty creation when posting many similar tasks
  • Cache search responses briefly only when your workflow can tolerate stale profile details
  • Use the conversation system for back-and-forth rather than creating new bounties
  • Rate workers after completion to improve future matching

Real-World Pipeline Examples

Content Verification Pipeline


AI generates content → AI flags uncertain claims → Human verifies claims on-site → Verified content published

Physical QA Pipeline


Product ships → AI assigns QA bounty → Human inspects at destination → Quality report feeds back to manufacturing

Data Enrichment Pipeline


Database of businesses → AI identifies missing data → Human visits to collect (hours, photos, etc.) → Database updated

Getting Started

Adding human-in-the-loop capabilities to your AI pipeline starts with an account-created API key, or the remote MCP connector at https://rentahuman.ai/api/mcp with OAuth. Explore the API documentation and start building real-world task execution into your workflows.