HarchOS API /0.1
API Reference
Complete reference for HarchOS REST, gRPC, and WebSocket APIs. Authenticate, create workloads, deploy models, and monitor your infrastructure.
Authentication
Authenticate Your Requests
API Keys
Simple key-based authentication for server-to-server communication. Pass your API key via the X-API-Key header or Authorization Bearer token.
X-API-Key: hrch_live_sk_abc123def456Use case: Backend services, CLI tools, automation scripts
OAuth 2.0
Industry-standard authorization framework for third-party integrations. Supports Authorization Code, Client Credentials, and Device Code flows.
Authorization: Bearer eyJhbGciOiJSUzI1NiIs...Use case: Third-party integrations, user-facing applications
JWT Tokens
JSON Web Tokens for stateless session management. Tokens are signed with RSA-4096 and include sovereignty claims for data residency enforcement.
Authorization: Bearer <jwt_token>Use case: Session management, service mesh authentication
REST API
REST Endpoints
The HarchOS REST API provides comprehensive access to compute, data, model, and operations resources. All endpoints use JSON for request and response bodies, follow OpenAPI 3.1 specification, and support pagination, filtering, and field selection.
Compute
7 endpoints/v1/compute/workloads/v1/compute/workloads/v1/compute/workloads/:id/v1/compute/workloads/:id/v1/compute/workloads/:id/v1/compute/workloads/:id/scale/v1/compute/workloads/:id/migrateCarbon-Aware Scheduling
6 endpoints/v1/carbon/intensity/v1/carbon/optimal-hub/v1/carbon/optimize/v1/carbon/forecast/v1/carbon/metrics/v1/carbon/dashboardData
5 endpoints/v1/data/pipelines/v1/data/pipelines/v1/data/pipelines/:id/ingest/v1/data/lakes/v1/data/lakes/:id/snapshotModels
6 endpoints/v1/models/v1/models/v1/models/:id/deploy/v1/models/:id/train/v1/models/:id/metrics/v1/inferencePricing
5 endpoints/v1/pricing/plans/v1/pricing/plans/:id/v1/pricing/estimate/v1/pricing/billing/records/v1/pricing/billing/records/:idRegions
2 endpoints/v1/regions/v1/regions/:codeOperations
5 endpoints/v1/operations/hubs/v1/operations/hubs/:id/v1/operations/failover/v1/operations/energy/v1/operations/scheduleMonitoring
6 endpoints/v1/monitoring/metrics/v1/monitoring/health/detailed/v1/monitoring/alerts/v1/monitoring/alerts/rules/v1/monitoring/traces/v1/monitoring/logsgRPC API
gRPC Service Definitions
High-performance gRPC services for latency-sensitive workloads and streaming operations. Uses Protocol Buffers v3 for schema definition and supports bi-directional streaming for real-time data flows.
ComputeService
Manage workloads, scaling, and GPU allocation across the mesh
CreateWorkloadGetWorkloadListWorkloadsScaleWorkloadMigrateWorkloadStreamWorkloadEventsDataService
Data pipeline management, ingestion, and lake operations
CreatePipelineIngestDataGetSnapshotStreamDataModelService
Model registration, training, and inference endpoints
RegisterModelDeployModelTrainModelStreamInferenceMeshService
Hub topology, health monitoring, and mesh orchestration
GetHubStatusStreamMetricsInitiateFailoverGetEnergyReportIdentityService
Authentication, authorization, and audit logging
AuthenticateAuthorizeStreamAuditEventsRevokeTokenWebSocket API
Real-Time Streaming
WebSocket endpoints for real-time event streaming. Connect once, receive continuous updates for workload state changes, metrics, inference results, and audit events.
Streaming Endpoints
/v1/ws/workloads/:id/eventsReal-time workload state changes, logs, and metricsJSON over WebSocket/v1/ws/metrics/streamLive platform metrics with configurable granularityJSON over WebSocket/v1/ws/models/:id/inferenceStreaming inference for real-time model predictionsJSON over WebSocket/v1/ws/audit/eventsReal-time audit event stream for compliance monitoringJSON over WebSocket/v1/ws/hubs/:id/telemetryLive hub telemetry data including power, thermal, and networkProtobuf over WebSocketRate Limits
API Rate Limits
Rate limits protect the platform and ensure fair resource allocation. Headers include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset for real-time tracking.
| Tier | Requests | Burst | Compute | Data |
|---|---|---|---|---|
| Free | 100 req/min | 50 req | 10 GPU-hours/month free tier | 5 GB/month |
| Developer | 1,000 req/min | 500 req | 10 GPU-hours/day | 50 GB/month |
| Professional | 10,000 req/min | 5,000 req | 100 GPU-hours/day | 500 GB/month |
| Enterprise | Custom | Custom | Unlimited | Unlimited |
| Sovereign | Custom | Custom | Dedicated | Dedicated |
Error Handling
Error Codes
Bad Request
Invalid request body, missing required fields, or malformed parameters.
Unauthorized
Missing or invalid authentication credentials. Check API key or JWT token.
Forbidden
Insufficient permissions or sovereignty constraint violation. Data cannot leave the designated jurisdiction.
Not Found
The requested resource does not exist or has been decommissioned.
Conflict
Resource state conflict, such as attempting to deploy a model that is already deployed.
Rate Limited
Request rate exceeds your tier limit. Retry after the time specified in Retry-After header.
Internal Error
Unexpected server error. HarchOS operations team is automatically notified.
Service Unavailable
Hub is temporarily offline for maintenance. Traffic is rerouted to the nearest available hub.
Code Examples
Quick Code Samples
curl -X POST https://api.harchos.io/v1/compute/workloads \
-H "Authorization: Bearer hrch_live_sk_abc123" \
-H "Content-Type: application/json" \
-d '{
"name": "llama-inference-prod",
"gpu": "H100",
"count": 8,
"region": "morocco-dakhla",
"sovereignty": "strict",
"carbonAware": true,
"schedule": "carbon-optimal"
}'