एजेंट कंप्यूटर एपीआई
इसे एपीआई प्लेग्राउंड में आज़माएं।
Base URL
Section titled “Base URL”https://api.rebyte.ai/v1Authentication
Section titled “Authentication”प्रत्येक अनुरोध के लिए एक API_KEY हेडर की आवश्यकता होती है। अपनी कुंजी सेटिंग्स > एपीआई कुंजी से प्राप्त करें।
curl https://api.rebyte.ai/v1/tasks \ -H "API_KEY: rbk_your_key_here"हेडर का नाम केस-संवेदी नहीं है। API_KEY, api-key, और x-api-key सभी काम करते हैं।
Endpoints
Section titled “Endpoints”| Method | Path | Description |
|---|---|---|
| POST | /tasks | Create a task |
| GET | /tasks | List tasks |
| GET | /tasks/:id | Get task with status and prompt history |
| POST | /tasks/:id/prompts | Send a follow-up prompt |
| PATCH | /tasks/:id/visibility | Change task visibility |
| DELETE | /tasks/:id | Soft-delete a task |
| GET | /tasks/:id/events | SSE stream of execution events |
| POST | /files | Get a signed file upload URL |
| POST | /webhooks | Register a webhook |
| GET | /webhooks | List webhooks |
| GET | /webhooks/:id | Get webhook details |
| DELETE | /webhooks/:id | Delete a webhook |
सभी पाथ बेस यूआरएल (https://api.rebyte.ai/v1) के सापेक्ष हैं। |
कार्य बनाएं
Section titled “कार्य बनाएं”POST /tasksएक नया कार्य बनाता है। डिफ़ॉल्ट रूप से, एक नया VM (एजेंट कंप्यूटर) प्रावधान करता है। इसके बजाय किसी मौजूदा वर्कस्पेस पर कार्य चलाने के लिए workspaceId पास करें — यह प्रावधान को छोड़ देता है और काफी तेज़ होता है।
कॉल तब तक ब्लॉक रहता है जब तक VM का प्रावधान नहीं हो जाता और पहला प्रॉम्प्ट सबमिट नहीं हो जाता।
अनुरोध बॉडी:
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Task description (max 100,000 chars) |
executor | string | No | claude (default), gemini, codex, opencode |
model | string | No | Model tier for the executor. See Models. |
workspaceId | string | No | UUID of an existing workspace to reuse |
files | object[] | No | Files from POST /files. Each: {"id": "...", "filename": "..."} |
skills | string[] | No | Skill slugs (e.g., ["deep-research", "pdf"]) |
githubUrl | string | No | GitHub repo in owner/repo format |
branchName | string | No | Branch name (default: main) |
curl -X POST https://api.rebyte.ai/v1/tasks \ -H "API_KEY: rbk_xxx" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Build a REST API with Express and add tests", "executor": "claude", "skills": ["deep-research"], "githubUrl": "your-org/your-repo" }'प्रतिक्रिया (201):
{ "id": "550e8400-e29b-41d4-a716-446655440000", "workspaceId": "660e8400-e29b-41d4-a716-446655440001", "url": "https://app.rebyte.ai/run/550e8400-e29b-41d4-a716-446655440000", "status": "running", "createdAt": "2026-01-28T12:00:00.000Z"}उसी एजेंट कंप्यूटर पर अनुवर्ती कार्य बनाने के लिए प्रतिक्रिया से workspaceId सहेजें:
# First task -- provisions a new VMRESP=$(curl -s -X POST https://api.rebyte.ai/v1/tasks \ -H "API_KEY: rbk_xxx" -H "Content-Type: application/json" \ -d '{"prompt": "Set up the project"}')WS_ID=$(echo $RESP | jq -r '.workspaceId')
# Second task -- reuses the same VM (much faster)curl -s -X POST https://api.rebyte.ai/v1/tasks \ -H "API_KEY: rbk_xxx" -H "Content-Type: application/json" \ -d "{\"prompt\": \"Now add tests\", \"workspaceId\": \"$WS_ID\"}"उपलब्ध मॉडल निष्पादक पर निर्भर करते हैं:
| Executor | Available Models | Default |
|---|---|---|
claude | claude-sonnet-4.6, claude-opus-4.6, gemini-3.1-pro, gpt-5.3-codex, gpt-5.4, minimax-m2.7, kimi-k2.5, glm-5, gemini-3-flash | claude-sonnet-4.6 |
codex | gpt-5.4, gpt-5.3-codex | gpt-5.4 |
gemini | auto-gemini-3 (auto-routes between flash and pro) | auto-gemini-3 |
opencode | Same as claude | gemini-3.1-pro |
BYOK (अपनी खुद की एपीआई कुंजी लाएं) के साथ, केवल निष्पादक के मूल प्रदाता मॉडल उपलब्ध हैं (उदाहरण के लिए, BYOK के साथ claude निष्पादक को केवल claude-sonnet-4.6 और claude-opus-4.6 मिलते हैं)।
कार्य सूचीबद्ध करें
Section titled “कार्य सूचीबद्ध करें”GET /tasks?limit=50&offset=0एपीआई के माध्यम से बनाए गए कार्यों को लौटाता है, जो निर्माण समय (नवीनतम पहले) के अनुसार क्रमबद्ध होते हैं।
| Param | Type | Default | Description |
|---|---|---|---|
limit | number | 50 | Results per page (max 100) |
offset | number | 0 | Pagination offset |
curl "https://api.rebyte.ai/v1/tasks?limit=10" \ -H "API_KEY: rbk_xxx"प्रतिक्रिया:
{ "data": [ { "id": "550e8400-...", "url": "https://app.rebyte.ai/run/550e8400-...", "title": "Build REST API with Express", "executor": "claude", "model": "claude-sonnet-4.6", "createdAt": "2026-01-28T12:00:00.000000+00:00", "completedAt": "2026-01-28T12:05:00.000000+00:00" } ], "total": 42, "limit": 10, "offset": 0}कार्य प्राप्त करें
Section titled “कार्य प्राप्त करें”GET /tasks/:idप्रॉम्प्ट इतिहास और व्युत्पन्न स्थिति सहित पूर्ण कार्य विवरण लौटाता है।
curl https://api.rebyte.ai/v1/tasks/550e8400-... \ -H "API_KEY: rbk_xxx"प्रतिक्रिया:
{ "id": "550e8400-...", "url": "https://app.rebyte.ai/run/550e8400-...", "status": "running", "title": "Build REST API with Express", "executor": "claude", "model": "claude-sonnet-4.6", "createdAt": "2026-01-28T12:00:00.000000+00:00", "completedAt": null, "prompts": [ { "id": "660e8400-...", "status": "running", "submittedAt": "2026-01-28T12:05:00.000000+00:00", "completedAt": null }, { "id": "550e8400-...", "status": "succeeded", "submittedAt": "2026-01-28T12:00:01.000000+00:00", "completedAt": "2026-01-28T12:03:00.000000+00:00" } ]}कार्य की स्थिति प्रॉम्प्ट अवस्थाओं से प्राप्त होती है:
| Status | Condition |
|---|---|
running | Any prompt is pending or running |
completed | All prompts terminal, latest is succeeded |
failed | All prompts terminal, latest is failed |
canceled | All prompts terminal, latest is canceled |
अनुवर्ती भेजें
Section titled “अनुवर्ती भेजें”POST /tasks/:id/promptsचल रहे या पूर्ण किए गए कार्य को अनुवर्ती प्रॉम्प्ट भेजें। यदि VM बंद हो जाता है, तो यह स्वचालित रूप से फिर से शुरू हो जाता है।
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Follow-up prompt (max 100,000 chars) |
skills | string[] | No | Additional skill slugs for this prompt |
curl -X POST https://api.rebyte.ai/v1/tasks/550e8400-.../prompts \ -H "API_KEY: rbk_xxx" \ -H "Content-Type: application/json" \ -d '{"prompt": "Now add authentication with JWT"}'प्रतिक्रिया (201):
{ "promptId": "770f9500-..."}इवेंट स्ट्रीम करें (SSE)
Section titled “इवेंट स्ट्रीम करें (SSE)”GET /tasks/:id/eventsकार्य के नवीनतम प्रॉम्प्ट के लिए एक सर्वर-सेंट इवेंट स्ट्रीम खोलता है। इवेंट में एजेंट आउटपुट (stdout, stderr), टूल कॉल और पूर्णता संकेत शामिल हैं।
curl -N https://api.rebyte.ai/v1/tasks/550e8400-.../events \ -H "API_KEY: rbk_xxx"स्ट्रीम दो इवेंट प्रकार उत्सर्जित करता है:
event— निष्पादन इवेंट (एजेंट आउटपुट, टूल कॉल)done— पूर्णता स्थिति के साथ अंतिम इवेंट, फिर स्ट्रीम बंद हो जाती है
दृश्यता बदलें
Section titled “दृश्यता बदलें”PATCH /tasks/:id/visibility| Field | Type | Required | Description |
|---|---|---|---|
visibility | string | Yes | private, shared, or public |
| Level | Who can view |
|---|---|
private | Only the API key owner |
shared | All organization members (default) |
public | Anyone with the link (read-only) |
curl -X PATCH https://api.rebyte.ai/v1/tasks/550e8400-.../visibility \ -H "API_KEY: rbk_xxx" \ -H "Content-Type: application/json" \ -d '{"visibility": "public"}'जब public पर सेट किया जाता है, तो प्रतिक्रिया में अप्रमाणित पहुंच के लिए एक shareUrl शामिल होता है।
कार्य हटाएं
Section titled “कार्य हटाएं”DELETE /tasks/:idकार्य को सॉफ्ट-डिलीट करता है। 204 No Content लौटाता है।
curl -X DELETE https://api.rebyte.ai/v1/tasks/550e8400-... \ -H "API_KEY: rbk_xxx"फ़ाइलें
Section titled “फ़ाइलें”कार्यों से संलग्न करने के लिए फ़ाइलें अपलोड करें। दो-चरणीय हस्ताक्षरित-यूआरएल प्रवाह का उपयोग करता है।
चरण 1: अपलोड यूआरएल प्राप्त करें
Section titled “चरण 1: अपलोड यूआरएल प्राप्त करें”POST /files| Field | Type | Required | Description |
|---|---|---|---|
filename | string | Yes | File name (max 255 chars) |
contentType | string | No | MIME type (default: application/octet-stream) |
प्रतिक्रिया (201):
{ "id": "550e8400-...", "filename": "data.csv", "uploadUrl": "https://storage.googleapis.com/...", "maxFileSize": 52428800}अपलोड यूआरएल 1 घंटे में समाप्त हो जाता है।
चरण 2: फ़ाइल अपलोड करें
Section titled “चरण 2: फ़ाइल अपलोड करें”curl -X PUT "UPLOAD_URL_FROM_STEP_1" \ -H "Content-Type: application/octet-stream" \ --data-binary @data.csvचरण 3: कार्य से संलग्न करें
Section titled “चरण 3: कार्य से संलग्न करें”कार्य बनाते समय चरण 1 से id और filename पास करें:
{ "prompt": "Analyze the uploaded data", "files": [ {"id": "550e8400-...", "filename": "data.csv"} ]}निष्पादन शुरू होने पर फ़ाइलें स्वचालित रूप से कार्य के VM में कॉपी हो जाती हैं।
वेबहुक
Section titled “वेबहुक”कार्य इवेंट होने पर HTTP POST सूचनाएं प्राप्त करें। वेबहुक सार्वभौमिक हैं — वे आपके संगठन के सभी कार्यों के लिए सक्रिय होते हैं, चाहे वे एपीआई, यूआई, या किसी अन्य चैनल के माध्यम से बनाए गए हों।
| Event | Fires when |
|---|---|
task.created | A new task is created |
task.running | The agent starts executing |
task.completed | Task finishes successfully |
task.failed | Task fails |
task.canceled | Task is canceled by user |
वेबहुक बनाएं
Section titled “वेबहुक बनाएं”POST /webhooks| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | HTTPS endpoint URL |
events | string[] | Yes | Events to subscribe to |
description | string | No | Human-readable label (max 500 chars) |
secret | string | No | Pre-shared secret (max 500 chars). When set, included as X-Webhook-Secret header in every delivery. |
# Webhook without secretcurl -X POST https://api.rebyte.ai/v1/webhooks \ -H "API_KEY: rbk_xxx" \ -H "Content-Type: application/json" \ -d '{ "url": "https://your-server.com/webhook", "events": ["task.completed", "task.failed"] }'
# Webhook with pre-shared secretcurl -X POST https://api.rebyte.ai/v1/webhooks \ -H "API_KEY: rbk_xxx" \ -H "Content-Type: application/json" \ -d '{ "url": "https://your-server.com/webhook", "events": ["task.completed", "task.failed"], "secret": "my-shared-secret-value" }'प्रतिक्रिया (201):
{ "id": "880e8400-...", "url": "https://your-server.com/webhook", "events": ["task.completed", "task.failed"], "description": null, "hasSecret": true, "isActive": true, "createdAt": "2026-01-28T12:00:00.000Z", "lastTriggeredAt": null, "failureCount": 0}व्यवहार संबंधी नोट्स:
- डुप्लिकेट यूआरएल: एक ही यूआरएल को दो बार पंजीकृत करने पर मौजूदा वेबहुक वापस आ जाता है (आइडम्पोटेंट)
- सीमा: प्रति संगठन अधिकतम 3 वेबहुक। चौथा
limit_exceededलौटाता है। - गुप्त भंडारण: गुप्त मान किसी भी प्रतिक्रिया में कभी वापस नहीं किया जाता है। केवल
hasSecret: true/falseही उजागर होता है।
वेबहुक सूचीबद्ध करें
Section titled “वेबहुक सूचीबद्ध करें”GET /webhooksआपके संगठन के सभी वेबहुक को स्थिति जानकारी (lastTriggeredAt, failureCount, isActive) के साथ लौटाता है। रहस्य कभी उजागर नहीं होते हैं।
वेबहुक प्राप्त करें
Section titled “वेबहुक प्राप्त करें”GET /webhooks/:idवेबहुक हटाएं
Section titled “वेबहुक हटाएं”DELETE /webhooks/:id204 No Content लौटाता है। हटाए गए वेबहुक तुरंत डिलीवरी प्राप्त करना बंद कर देते हैं।
डिलीवरी
Section titled “डिलीवरी”जब कोई कार्य इवेंट वेबहुक के सब्सक्राइब किए गए इवेंट से मेल खाता है, तो Rebyte वेबहुक यूआरएल पर एक HTTP POST भेजता है।
पेलोड:
{ "event": "task.completed", "taskId": "550e8400-e29b-41d4-a716-446655440000", "timestamp": 1706443200, "data": { "status": "succeeded", "taskUrl": "https://app.rebyte.ai/run/550e8400-...", "result": "Created CSV file with 10 Hacker News posts..." }}status— प्रॉम्प्ट स्थिति:pending(task.created),running(task.running),succeeded(task.completed),failed(task.failed),canceled(task.canceled)taskUrl— Rebyte UI में कार्य का सीधा लिंक (हमेशा मौजूद)result— अंतिम एआई आउटपुट टेक्स्ट (टर्मिनल इवेंट पर मौजूद:task.completed,task.failed,task.canceled;task.createdऔरtask.runningपर अनुपस्थित)
प्रॉम्प्ट इतिहास सहित पूर्ण कार्य विवरण के लिए GET /tasks/:id कॉल करें।
डिलीवरी हेडर:
| Header | Always present | Description |
|---|---|---|
Content-Type | Yes | application/json |
X-Webhook-Signature | Yes | Base64-encoded RSA-SHA256 signature |
X-Webhook-Timestamp | Yes | Unix timestamp (seconds) |
X-Webhook-Secret | Only if secret configured | The pre-shared secret value you set on creation |
टाइमआउट: डिलीवरी 10 सेकंड के बाद टाइम आउट हो जाती है।
विफलता प्रबंधन:
- डिलीवरी फायर-एंड-फॉरगेट है — विफलता पर कोई स्वचालित पुनः प्रयास नहीं होता है
- गैर-2xx प्रतिक्रियाएं
failureCountको बढ़ाती हैं - 10 लगातार विफलताओं के बाद, वेबहुक स्वचालित रूप से अक्षम हो जाता है (
isActive: false) - सफल डिलीवरी
failureCountको 0 पर रीसेट करती है
हस्ताक्षर सत्यापन
Section titled “हस्ताक्षर सत्यापन”प्रत्येक डिलीवरी आपके संगठन के RSA-2048 कुंजी जोड़े के साथ हस्ताक्षरित होती है, भले ही एक पूर्व-साझा रहस्य कॉन्फ़िगर किया गया हो या नहीं।
यह कैसे काम करता है:
- Rebyte
{timestamp}.{body}को जोड़ता है (उदाहरण के लिए,1706443200.{"event":"task.completed",...}) - आपके संगठन की निजी कुंजी का उपयोग करके RSA-SHA256 के साथ स्ट्रिंग पर हस्ताक्षर करता है
X-Webhook-Signatureमें base64-एन्कोडेड हस्ताक्षर भेजता है
अपनी सार्वजनिक कुंजी प्राप्त करें: सहायता से संपर्क करें या इसे Rebyte डैशबोर्ड से प्राप्त करें। RSA-2048 कुंजी जोड़ा पहले वेबहुक निर्माण पर स्वचालित रूप से उत्पन्न होता है और संगठन के लिए बना रहता है।
सत्यापन उदाहरण (Node.js):
const crypto = require('crypto');
function verifyWebhook(rawBody, timestamp, signature, publicKey) { const payload = `${timestamp}.${rawBody}`; const verifier = crypto.createVerify('RSA-SHA256'); verifier.update(payload); return verifier.verify(publicKey, signature, 'base64');}
// In your webhook handler:app.post('/webhook', (req, res) => { const rawBody = req.body; // must be raw string, not parsed JSON const timestamp = req.headers['x-webhook-timestamp']; const signature = req.headers['x-webhook-signature'];
if (!verifyWebhook(rawBody, timestamp, signature, PUBLIC_KEY)) { return res.status(401).send('Invalid signature'); }
const event = JSON.parse(rawBody); console.log(`Task ${event.taskId}: ${event.event}`); res.status(200).send('OK');});सत्यापन उदाहरण (Python):
from cryptography.hazmat.primitives import hashes, serializationfrom cryptography.hazmat.primitives.asymmetric import paddingimport base64
def verify_webhook(raw_body: str, timestamp: str, signature: str, public_key_pem: str) -> bool: public_key = serialization.load_pem_public_key(public_key_pem.encode()) payload = f"{timestamp}.{raw_body}".encode() try: public_key.verify( base64.b64decode(signature), payload, padding.PKCS1v15(), hashes.SHA256() ) return True except Exception: return Falseदो-परत सुरक्षा
Section titled “दो-परत सुरक्षा”वेबहुक दो स्वतंत्र सत्यापन विधियों का समर्थन करते हैं जिनका एक साथ उपयोग किया जा सकता है:
| Method | Header | How it works | Use case |
|---|---|---|---|
| RSA signature | X-Webhook-Signature | Cryptographic proof the payload came from Rebyte | Tamper-proof verification |
| Pre-shared secret | X-Webhook-Secret | Static string you set on creation, echoed back in every delivery | Simple shared-secret check |
RSA हस्ताक्षर हमेशा मौजूद होते हैं। पूर्व-साझा रहस्य वैकल्पिक है — यदि आप एक सरल सत्यापन पथ चाहते हैं तो वेबहुक बनाते समय इसे सेट करें।
पोलिंग उदाहरण
Section titled “पोलिंग उदाहरण”पूर्ण उदाहरण: एक कार्य बनाएं, पूर्ण होने तक पोल करें, फिर एक अनुवर्ती भेजें।
# Create taskTASK_ID=$(curl -s -X POST https://api.rebyte.ai/v1/tasks \ -H "API_KEY: rbk_xxx" \ -H "Content-Type: application/json" \ -d '{"prompt": "Write a Python CLI that converts CSV to JSON"}' | jq -r '.id')
echo "Task: https://app.rebyte.ai/run/$TASK_ID"
# Poll until donewhile true; do STATUS=$(curl -s https://api.rebyte.ai/v1/tasks/$TASK_ID \ -H "API_KEY: rbk_xxx" | jq -r '.status') echo "Status: $STATUS" [[ "$STATUS" == "completed" || "$STATUS" == "failed" ]] && break sleep 5done
# Send a follow-upcurl -s -X POST https://api.rebyte.ai/v1/tasks/$TASK_ID/prompts \ -H "API_KEY: rbk_xxx" \ -H "Content-Type: application/json" \ -d '{"prompt": "Now add support for nested JSON objects"}'त्रुटि प्रारूप
Section titled “त्रुटि प्रारूप”सभी त्रुटियां इस संरचना का पालन करती हैं:
{ "error": { "code": "validation_error", "message": "Invalid request body" }}| Code | HTTP Status | Description |
|---|---|---|
missing_api_key | 401 | API_KEY header not provided |
invalid_api_key | 401 | Invalid or expired API key |
validation_error | 400 | Request body failed validation |
not_found | 404 | Resource does not exist or is not accessible |
limit_exceeded | 400 | Organization limit reached (e.g., max webhooks) |
agent_disabled | 403 | The requested executor is disabled for this organization |
internal_error | 500 | Server-side failure |
दर सीमित करना
Section titled “दर सीमित करना”एपीआई वर्तमान में प्रति-कुंजी दर सीमाओं को लागू नहीं करता है। प्रत्येक POST /tasks एक वास्तविक VM का प्रावधान करता है, इसलिए लागत उपयोग के साथ बढ़ती है। अनावश्यक अनुरोधों को कम करने के लिए आक्रामक पोलिंग के बजाय वेबहुक का उपयोग करें।