API Documentation | RIRD
Home / Docs / API Reference

API Reference

Programmatic access to RIRD cloud automation. Submit tasks, receive webhooks, and integrate with your stack.

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

API Key - Starts with rird_. Best for server-to-server integration.
License Key - From CLI login. Works but API keys are preferred for programmatic access.

Endpoints

Cloud Tasks

POST /api/cloud/tasks

Submit a new task for cloud execution.

Request Body

FieldTypeRequiredDescription
promptstringYesNatural language task description
configobjectNoTask configuration options
webhook_urlstringNoURL to POST results when task completes
prioritystringNolow, 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"
  }
}
GET /api/cloud/tasks

List your tasks with optional filtering.

Query Parameters

ParameterDefaultDescription
limit20Max results (1-100)
offset0Pagination offset
status-Filter: queued, processing, completed, failed
GET /api/cloud/tasks/:id

Get 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

POST /api/rird/api-keys

Generate 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"
  }
}
GET /api/rird/api-keys

List your API keys (keys are masked).

DELETE /api/rird/api-keys/:id

Revoke an API key.

Webhooks

POST /api/rird/webhooks

Create 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 successfully
  • task.failed - Task failed after retries
  • task.started - Task began processing
  • * - All events
GET /api/rird/webhooks

List your webhooks with delivery stats.

DELETE /api/rird/webhooks/:id

Delete 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 verification
  • X-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

PlanRequests/MinuteRequests/HourConcurrent Tasks
Basic ($99/mo)601,0005
Starter ($199/mo)1205,00010
Pro ($399/mo)30010,00025

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

CodeDescription
400Bad Request - Invalid parameters
401Unauthorized - Invalid or missing API key
403Forbidden - Insufficient permissions
404Not Found - Resource does not exist
429Rate Limited - Too many requests
500Server Error - Contact support

Need Help?

Our team is here to help you integrate RIRD into your stack.

Contact Support
R
RIRD

Define the job. Come back to results.

Company

Trust

  • Credentials stay on your machine
  • Full activity logs
  • Air-gapped deployment available

2025 rird.ai - All rights reserved.