Documentation

API Reference

haas-lab exposes a REST API for programmatic firmware testing. Sign in to generate a Personal Access Token.

Authentication

All API requests require a Personal Access Token (PAT) in the Authorization header. Generate one at /dashboard/tokens after signing in.

http
# All requests require:
Authorization: Bearer pat_<your-token>

Validate a restricted module

Upload a .wasm module (max 128 KiB). This validates policy only; public hardware queueing opens after trusted-runtime provisioning.

bash
curl -X POST \
  -H "Authorization: Bearer $PAT" \
  -F [email protected] \
  https://haas-lab.com/api/v1/sandbox/validate

Administrator native jobs

The native .bin job endpoint is reserved for trusted administrators. Public clients receive 403 unless an operator explicitly enables the unsafe compatibility mode.

http
# Administrator-only compatibility endpoint:
POST https://haas-lab.com/api/v1/jobs

List your jobs

Returns a paginated list of your jobs, newest first.

bash
curl \
  -H "Authorization: Bearer $PAT" \
  "https://haas-lab.com/api/v1/jobs?page=1&limit=20"

Get job status

Poll for job status. Status progresses: QUEUED → FLASHING → RUNNING → COMPLETED.

bash
curl \
  -H "Authorization: Bearer $PAT" \
  https://haas-lab.com/api/v1/jobs/<job-id>

Stream live serial output

Connect to the SSE stream for a running job. Each event contains one line of serial output.

bash
curl -N \
  -H "Authorization: Bearer $PAT" \
  -H "Accept: text/event-stream" \
  https://haas-lab.com/api/v1/jobs/<job-id>/stream

Get archived serial log

After a job completes, retrieve the full serial log as plain text.

bash
curl \
  -H "Authorization: Bearer $PAT" \
  https://haas-lab.com/api/v1/jobs/<job-id>/serial

Manage API tokens

Create, list, and revoke Personal Access Tokens.

bash
# Create a new token
curl -X POST \
  -H "Authorization: Bearer $PAT" \
  -H "Content-Type: application/json" \
  -d '{"name":"ci-token"}' \
  https://haas-lab.com/api/v1/tokens

# List tokens (plaintext never returned after creation)
curl -H "Authorization: Bearer $PAT" https://haas-lab.com/api/v1/tokens

# Revoke a token
curl -X DELETE \
  -H "Authorization: Bearer $PAT" \
  https://haas-lab.com/api/v1/tokens/<token-id>