Skip to main content

API Reference

Complete REST API reference for QCOS.

Base URL

https://api.softquantus.com

Authentication

All endpoints require authentication via API key:

# Header method (recommended)
X-API-Key: your-api-key

# Bearer token method
Authorization: Bearer your-api-key

Endpoints

Health Check

GET /

Check API health status.

Response:

{
"status": "healthy",
"version": "1.0.0",
"queue_connected": true
}

Execute Circuit

POST /execute

Submit a quantum circuit for execution.

Request Body:

{
"qasm": "OPENQASM 2.0; include \"qelib1.inc\"; qreg q[2]; creg c[2]; h q[0]; cx q[0],q[1]; measure q -> c;",
"shots": 1024,
"job_id": "optional-custom-id"
}
FieldTypeRequiredDescription
qasmstringYesOpenQASM 2.0 circuit
shotsintegerNoNumber of shots (default: 1024)
job_idstringNoCustom job identifier

Response:

{
"job_id": "abc123-def456-ghi789",
"status": "queued",
"message": "Job queued for GPU execution on LUMI",
"estimated_time_seconds": 30
}

Example:

curl -X POST https://api.softquantus.com/execute \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-d '{
"qasm": "OPENQASM 2.0; include \"qelib1.inc\"; qreg q[2]; creg c[2]; h q[0]; cx q[0],q[1]; measure q -> c;",
"shots": 1024
}'

Get Job Status

GET /status/{job_id}

Get the status of a submitted job.

Path Parameters:

ParameterTypeDescription
job_idstringJob identifier

Response:

{
"job_id": "abc123-def456-ghi789",
"status": "completed",
"result": {
"counts": {"00": 512, "11": 512},
"num_qubits": 2,
"shots": 1024,
"execution_time_seconds": 0.05,
"backend": "cuStateVec",
"device": "NVIDIA A100"
},
"error": null,
"created_at": "2024-01-15T10:30:00Z",
"completed_at": "2024-01-15T10:30:02Z"
}

Status Values:

StatusDescription
queuedJob is waiting in queue
processingJob is being executed
completedJob finished successfully
failedJob failed with error

Get Job Results

GET /results/{job_id}

Get results with optional wait.

Query Parameters:

ParameterTypeDefaultDescription
waitbooleanfalseWait for completion
timeoutinteger30Max seconds to wait

Response (completed):

{
"job_id": "abc123-def456-ghi789",
"status": "completed",
"result": {
"counts": {"00": 512, "11": 512}
}
}

Response (pending):

{
"job_id": "abc123-def456-ghi789",
"status": "pending",
"message": "Job not yet completed"
}

User Information

GET /user/me

Get current user information.

Response:

{
"user_id": "user_abc123",
"email": "demo@example.com",
"tier": "pro",
"daily_job_limit": 100,
"max_qubits": 50,
"max_shots": 100000,
"jobs_today": 23,
"jobs_total": 456
}

User Usage

GET /user/usage

Get usage statistics.

Response:

{
"user_id": "user_abc123",
"period": "2024-01",
"jobs_executed": 234,
"total_shots": 1234567,
"total_qubits_hours": 45.6,
"daily_usage": [
{"date": "2024-01-15", "jobs": 12},
{"date": "2024-01-14", "jobs": 8}
]
}

Pricing Information

GET /pricing

Get pricing tiers (no auth required).

Response:

{
"tiers": [
{
"name": "free",
"price_monthly": 0,
"daily_job_limit": 10,
"max_qubits": 20,
"max_shots": 10000
},
{
"name": "pro",
"price_monthly": 49,
"daily_job_limit": 100,
"max_qubits": 50,
"max_shots": 100000
},
{
"name": "enterprise",
"price_monthly": null,
"daily_job_limit": -1,
"max_qubits": 100,
"max_shots": 1000000
}
]
}

Error Responses

All errors follow this format:

{
"detail": "Error message",
"error_code": "ERROR_CODE",
"request_id": "req_abc123"
}

HTTP Status Codes

CodeMeaning
200Success
201Created
400Bad Request
401Unauthorized
403Forbidden
404Not Found
429Rate Limited
500Server Error
503Service Unavailable

Error Codes

CodeDescription
AUTH_REQUIREDNo API key provided
AUTH_INVALIDInvalid API key
RATE_LIMITEDToo many requests
QUOTA_EXCEEDEDTier limit exceeded
CIRCUIT_INVALIDInvalid circuit syntax
JOB_NOT_FOUNDJob ID not found
JOB_FAILEDExecution failed

Rate Limits

TierRequests/MinuteRequests/Day
Free10100
Pro601000
Enterprise300Unlimited

Rate limit headers:

X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1705312800

OpenAPI Specification

Interactive API documentation available at:


SDKs & Libraries

LanguagePackageInstall
Pythonqcos-sdkpip install qcos-sdk
JavaScript@softquantus/qcosnpm install @softquantus/qcos
Rustqcoscargo add qcos
Goqcos-gogo get github.com/softquantus/qcos-go