DCP API

API Reference + Try It Out

Use proxy base /api/dc1 in browser and direct base https://api.dcp.sa/api for backend/server-side calls.

تكامل تفاعلي لتجربة الطلبات مباشرة من التوثيق مع دعم مفاتيح المزود والمستأجر والإدارة.

Interactive Try It Out

Select an endpoint, fill keys/body, and execute against the live proxy.

Endpoint Notes

Register a provider and return provider API key.

تسجيل مزود جديد وإرجاع مفتاح API.

Auth: None

Request Body (JSON)

Requests are executed from browser context using same-origin proxy.

Response

No response yet.

// Execute a request to view response payload.

Provider Endpoints

نقاط المزود

POST/api/providers/register

Register a provider and return provider API key.

تسجيل مزود جديد وإرجاع مفتاح API.

Auth: None

Example Request

{
  "name": "Riyadh RTX Node",
  "email": "provider@example.com",
  "gpu_model": "RTX 4090",
  "os": "linux",
  "phone": "+966500000000"
}

Example Response

{
  "success": true,
  "provider_id": 42,
  "api_key": "dcp-provider-..."
}
GET/api/providers/me?key=:api_key

Provider profile, jobs, earnings, and heartbeat summary.

ملف المزود والوظائف والأرباح وملخص heartbeat.

Auth: Provider API key

Example Response

{
  "provider": { "id": 42, "status": "online", "total_jobs": 19 },
  "recent_jobs": []
}
POST/api/providers/heartbeat

Daemon heartbeat with GPU utilization telemetry.

نبضة daemon مع بيانات استخدام GPU.

Auth: Provider API key

Example Request

{
  "api_key": "dcp-provider-...",
  "gpu_status": { "gpu_name": "NVIDIA RTX 4090", "gpu_util_pct": 42 }
}

Example Response

{
  "success": true,
  "status": "online",
  "update_available": false
}

Renter Endpoints

نقاط المستأجر

POST/api/renters/register

Register a renter account and return renter key.

تسجيل مستأجر جديد وإرجاع مفتاح المستأجر.

Auth: None

Example Request

{
  "name": "Acme AI",
  "email": "renter@example.com",
  "organization": "Acme"
}

Example Response

{
  "success": true,
  "renter_id": 7,
  "api_key": "dcp-renter-..."
}
GET/api/renters/me?key=:api_key

Renter profile and wallet state.

ملف المستأجر وحالة المحفظة.

Auth: Renter API key

Example Response

{
  "renter": { "id": 7, "balance_halala": 5000 },
  "recent_jobs": []
}
GET/api/renters/available-providers

List currently online providers for marketplace.

قائمة المزودين المتصلين لسوق الاستئجار.

Auth: Public

Example Response

{
  "providers": [{ "id": 42, "gpu_model": "RTX 4090", "is_live": true }],
  "total": 1
}

Job Endpoints

نقاط المهام

POST/api/jobs/submit

Submit renter compute job with billing pre-hold.

إرسال مهمة حوسبة مع احتجاز تكلفة مسبق.

Auth: x-renter-key

Example Request

{
  "provider_id": 42,
  "job_type": "llm-inference",
  "duration_minutes": 3,
  "container_spec": { "image_type": "vllm-serve" },
  "params": {
    "model": "TinyLlama/TinyLlama-1.1B-Chat-v1.0",
    "prompt": "Summarize DCP in three bullets"
  }
}

Example Response

{
  "success": true,
  "job": { "job_id": "job-...", "status": "pending", "cost_halala": 450 }
}
GET/api/jobs/:job_id

Fetch current job state and execution details.

جلب حالة المهمة الحالية وتفاصيل التنفيذ.

Auth: Renter/Provider/Admin key

Example Response

{
  "job": { "job_id": "job-abc123", "status": "running" }
}
GET/api/jobs/:job_id/output

Fetch job output; returns 202 while still running.

جلب مخرجات المهمة؛ ترجع 202 أثناء التشغيل.

Auth: Renter/Provider/Admin key

Example Response

{
  "type": "text",
  "response": "Model output...",
  "billing": { "actual_cost_halala": 188 }
}

Admin Endpoints

نقاط الإدارة

GET/api/admin/dashboard

Platform metrics for operations and finance.

مؤشرات المنصة التشغيلية والمالية.

Auth: x-admin-token

Example Response

{
  "stats": { "total_providers": 120, "online_now": 48 }
}
GET/api/admin/withdrawals

List provider withdrawal requests and status breakdown.

قائمة طلبات السحب وحالتها.

Auth: x-admin-token

Example Response

{
  "pending": [],
  "all": [],
  "summary": { "pending_count": 0 }
}