API Reference

Complete reference for HarchOS REST, gRPC, and WebSocket APIs. Authenticate, create workloads, deploy models, and monitor your infrastructure.

Base URL: https://api.harchos.io

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_abc123def456

Use 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 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
POST/v1/compute/workloads
GET/v1/compute/workloads
GET/v1/compute/workloads/:id
PATCH/v1/compute/workloads/:id
DELETE/v1/compute/workloads/:id
POST/v1/compute/workloads/:id/scale
POST/v1/compute/workloads/:id/migrate

Carbon-Aware Scheduling

6 endpoints
GET/v1/carbon/intensity
GET/v1/carbon/optimal-hub
POST/v1/carbon/optimize
GET/v1/carbon/forecast
GET/v1/carbon/metrics
GET/v1/carbon/dashboard

Data

5 endpoints
POST/v1/data/pipelines
GET/v1/data/pipelines
POST/v1/data/pipelines/:id/ingest
GET/v1/data/lakes
POST/v1/data/lakes/:id/snapshot

Models

6 endpoints
POST/v1/models
GET/v1/models
POST/v1/models/:id/deploy
POST/v1/models/:id/train
GET/v1/models/:id/metrics
POST/v1/inference

Pricing

5 endpoints
GET/v1/pricing/plans
GET/v1/pricing/plans/:id
GET/v1/pricing/estimate
GET/v1/pricing/billing/records
GET/v1/pricing/billing/records/:id

Regions

2 endpoints
GET/v1/regions
GET/v1/regions/:code

Operations

5 endpoints
GET/v1/operations/hubs
GET/v1/operations/hubs/:id
POST/v1/operations/failover
GET/v1/operations/energy
POST/v1/operations/schedule

Monitoring

6 endpoints
GET/v1/monitoring/metrics
GET/v1/monitoring/health/detailed
GET/v1/monitoring/alerts
POST/v1/monitoring/alerts/rules
GET/v1/monitoring/traces
GET/v1/monitoring/logs

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

CreateWorkload
GetWorkload
ListWorkloads
ScaleWorkload
MigrateWorkload
StreamWorkloadEvents

DataService

Data pipeline management, ingestion, and lake operations

CreatePipeline
IngestData
GetSnapshot
StreamData

ModelService

Model registration, training, and inference endpoints

RegisterModel
DeployModel
TrainModel
StreamInference

MeshService

Hub topology, health monitoring, and mesh orchestration

GetHubStatus
StreamMetrics
InitiateFailover
GetEnergyReport

IdentityService

Authentication, authorization, and audit logging

Authenticate
Authorize
StreamAuditEvents
RevokeToken

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 WebSocket

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.

TierRequestsBurstComputeData
Free100 req/min50 req10 GPU-hours/month free tier5 GB/month
Developer1,000 req/min500 req10 GPU-hours/day50 GB/month
Professional10,000 req/min5,000 req100 GPU-hours/day500 GB/month
EnterpriseCustomCustomUnlimitedUnlimited
SovereignCustomCustomDedicatedDedicated

Error Codes

400

Bad Request

Invalid request body, missing required fields, or malformed parameters.

401

Unauthorized

Missing or invalid authentication credentials. Check API key or JWT token.

403

Forbidden

Insufficient permissions or sovereignty constraint violation. Data cannot leave the designated jurisdiction.

404

Not Found

The requested resource does not exist or has been decommissioned.

409

Conflict

Resource state conflict, such as attempting to deploy a model that is already deployed.

429

Rate Limited

Request rate exceeds your tier limit. Retry after the time specified in Retry-After header.

500

Internal Error

Unexpected server error. HarchOS operations team is automatically notified.

503

Service Unavailable

Hub is temporarily offline for maintenance. Traffic is rerouted to the nearest available hub.

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"
  }'