API Reference
Programmatic access to RIRD automation. Submit tasks, receive webhooks, and integrate with your stack.
Note: The Cloud Tasks API below is available to all paid plan customers.
For self-hosted deployments, use the Local API Server (rird --server).
Quick Start
1. Get Your API Key
Generate an API key from your dashboard.
API keys start with rird_ and provide programmatic access.
2. Submit Your First Task
curl -X POST https://rird.ai/api/cloud/tasks \
-H "Authorization: Bearer rird_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Find 10 software companies on LinkedIn"
}' 3. Get Results
Poll for completion or use webhooks for async notification:
curl https://rird.ai/api/cloud/tasks/TASK_ID \
-H "Authorization: Bearer rird_your_api_key"Authentication
All API requests require authentication via Bearer token in the Authorization header:
Authorization: Bearer rird_your_api_key Authentication Methods
rird_. Best for server-to-server integration.Endpoints
Cloud Tasks
/api/cloud/tasksSubmit a new task for cloud execution.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Natural language task description |
config | object | No | Task configuration options |
webhook_url | string | No | URL to POST results when task completes |
priority | string | No | low, normal, high (default: normal) |
Example Request
{
"prompt": "Find 50 contractors on SAM.gov, save to CSV",
"webhook_url": "https://your-server.com/webhook",
"priority": "high"
}Response
{
"success": true,
"task": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"status": "queued",
"queuePosition": 3,
"createdAt": "2025-01-15T10:30:00Z"
},
"webhook": {
"url": "https://your-server.com/webhook",
"secret": "abc123...",
"message": "Store this secret securely"
}
}/api/cloud/tasksList your tasks with optional filtering.
Query Parameters
| Parameter | Default | Description |
|---|---|---|
limit | 20 | Max results (1-100) |
offset | 0 | Pagination offset |
status | - | Filter: queued, processing, completed, failed |
/api/cloud/tasks/:idGet a specific task's status and results.
Response (Completed Task)
{
"success": true,
"task": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"prompt": "Find 50 contractors on SAM.gov",
"status": "completed",
"result": { ... },
"resultSummary": "Found 50 contractors, saved to contractors.csv",
"startedAt": "2025-01-15T10:31:00Z",
"completedAt": "2025-01-15T10:35:00Z",
"processingTimeMs": 240000
}
}API Keys
/api/rird/api-keysGenerate a new API key.
Request Body
{
"name": "Production Server",
"permissions": ["cloud_tasks"],
"expiresInDays": 365
} Response
{
"success": true,
"apiKey": {
"id": "...",
"key": "rird_abc12345_x7k9m2p4n8q1w5r3",
"name": "Production Server",
"message": "Store this key securely - shown only once"
}
}/api/rird/api-keysList your API keys (keys are masked).
/api/rird/api-keys/:idRevoke an API key.
Webhooks
/api/rird/webhooksCreate a webhook endpoint for task notifications.
Request Body
{
"name": "My Backend",
"url": "https://your-server.com/webhooks/rird",
"events": ["task.completed", "task.failed"]
} Available Events
task.completed- Task finished successfullytask.failed- Task failed after retriestask.started- Task began processing*- All events
/api/rird/webhooksList your webhooks with delivery stats.
/api/rird/webhooks/:idDelete a webhook.
Webhook Payloads
Payload Format
{
"event": "task.completed",
"timestamp": "2025-01-15T10:35:00Z",
"task": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"prompt": "Find 50 contractors on SAM.gov",
"status": "completed",
"result": { ... },
"resultSummary": "Found 50 contractors",
"startedAt": "2025-01-15T10:31:00Z",
"completedAt": "2025-01-15T10:35:00Z",
"processingTimeMs": 240000
}
}Signature Verification
Verify webhook authenticity using the X-RIRD-Signature header:
// Node.js example
const crypto = require('crypto');
function verifySignature(payload, signature, secret) {
const expected = crypto
.createHash('sha256')
.update(payload + secret)
.digest('hex');
return signature === expected;
}
// In your webhook handler
app.post('/webhooks/rird', (req, res) => {
const signature = req.headers['x-rird-signature'];
const payload = JSON.stringify(req.body);
if (!verifySignature(payload, signature, WEBHOOK_SECRET)) {
return res.status(401).send('Invalid signature');
}
// Process the webhook
console.log('Task completed:', req.body.task.id);
res.status(200).send('OK');
}); Webhook Headers
X-RIRD-Signature- HMAC signature for verificationX-RIRD-Timestamp- Event timestamp (ISO 8601)X-RIRD-Event- Event type (task.completed, etc.)
Retry Policy
Failed webhook deliveries are retried with exponential backoff:
- Attempt 1: Immediate
- Attempt 2: After 1 second
- Attempt 3: After 5 seconds
Webhooks are disabled after 10 consecutive failures (circuit breaker).
Rate Limits
| Plan | Requests/Minute | Requests/Hour | Concurrent Tasks |
|---|---|---|---|
| All plans | 60 | 1,000 | 5 |
Rate limit headers: X-RateLimit-Remaining, X-RateLimit-Reset
SDK Examples
JavaScript / Node.js
const RIRD_API_KEY = 'rird_your_api_key';
async function runTask(prompt) {
const response = await fetch('https://rird.ai/api/cloud/tasks', {
method: 'POST',
headers: {
'Authorization': `Bearer ${RIRD_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ prompt })
});
return response.json();
}
async function getTask(taskId) {
const response = await fetch(`https://rird.ai/api/cloud/tasks/${taskId}`, {
headers: { 'Authorization': `Bearer ${RIRD_API_KEY}` }
});
return response.json();
}
// Usage
const { task } = await runTask('Find 10 tech companies in NYC');
console.log('Task submitted:', task.id);
// Poll for completion
let result;
do {
await new Promise(r => setTimeout(r, 5000));
result = await getTask(task.id);
} while (result.task.status === 'queued' || result.task.status === 'processing');
console.log('Result:', result.task.resultSummary);Python
import requests
import time
RIRD_API_KEY = 'rird_your_api_key'
BASE_URL = 'https://rird.ai/api'
def run_task(prompt: str, webhook_url: str = None):
response = requests.post(
f'{BASE_URL}/cloud/tasks',
headers={'Authorization': f'Bearer {RIRD_API_KEY}'},
json={'prompt': prompt, 'webhook_url': webhook_url}
)
return response.json()
def get_task(task_id: str):
response = requests.get(
f'{BASE_URL}/cloud/tasks/{task_id}',
headers={'Authorization': f'Bearer {RIRD_API_KEY}'}
)
return response.json()
def wait_for_completion(task_id: str, poll_interval: int = 5):
while True:
result = get_task(task_id)
status = result['task']['status']
if status in ('completed', 'failed'):
return result
time.sleep(poll_interval)
# Usage
result = run_task('Scrape the top 20 products from ProductHunt')
task_id = result['task']['id']
print(f'Task submitted: {task_id}')
final = wait_for_completion(task_id)
print(f'Result: {final["task"]["resultSummary"]}')cURL
# Submit task
curl -X POST https://rird.ai/api/cloud/tasks \
-H "Authorization: Bearer rird_your_api_key" \
-H "Content-Type: application/json" \
-d '{"prompt": "Find 100 restaurants in Miami"}'
# Get task status
curl https://rird.ai/api/cloud/tasks/TASK_ID \
-H "Authorization: Bearer rird_your_api_key"
# List tasks
curl "https://rird.ai/api/cloud/tasks?status=completed&limit=10" \
-H "Authorization: Bearer rird_your_api_key"
# Generate API key
curl -X POST https://rird.ai/api/rird/api-keys \
-H "Authorization: Bearer YOUR_LICENSE_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "Production"}'Error Codes
| Code | Description |
|---|---|
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid or missing API key |
403 | Forbidden - Insufficient permissions |
404 | Not Found - Resource does not exist |
429 | Rate Limited - Too many requests |
500 | Server Error - Contact support |