HTTP API
Use the HTTP API when integrating mPaka without the CLI.
https://api.mpaka.devFor direct workload integrations, send an API key as a bearer credential:
Authorization: Bearer <MPAKA_API_KEY>Create the key in the mPaka console or with
mpaka api-keys create, keep it in a secret manager or environment variable,
and never put it in a URL or client-side browser state.
The API also accepts an authenticated account session on routes whose contract
lists cookie-session authentication; the HTTP examples below use a bearer key
for workload requests.
Account sessions and API keys
Section titled “Account sessions and API keys”Account endpoints use a web session, which is separate from the bearer API key
used for workload requests. POST /v1/login accepts email and password,
then returns HTTP 200 with the account identity and sets the
rustbox_session cookie. POST /v1/register has the same request shape and
also returns HTTP 200 with a session when registration is open; passwords
must be at least 12 characters. During the private beta, registration can
return HTTP 403 with registration_closed. Use the CLI’s interactive login
or --password-stdin flow to avoid putting a password in shell history.
GET /v1/me returns HTTP 200 with the current account identity.
POST /v1/logout revokes the current session and clears its cookie, returning
HTTP 204. The CLI commands whoami and logout use these endpoints.
API key routes manage workload credentials:
| Request | Authentication | Result |
|---|---|---|
GET /v1/api-keys |
Account session or tenant API key | HTTP 200; key metadata only, never existing secret tokens. |
POST /v1/api-keys with {"name":"development"} |
Owner account session | HTTP 201; creates a key and returns its token once. |
POST /v1/api-keys/{key_id}/rotate with {} |
Owner account session | HTTP 200; invalidates the old token and returns a replacement once. |
DELETE /v1/api-keys/{key_id} |
Owner account session | HTTP 204; revokes the key. |
Creation, rotation, and deletion require an account session for an owner; a
workload API key cannot perform these changes. Store the returned token as a
secret and update the client that uses it. See API keys for
storage and recovery guidance. The CLI provides the same lifecycle through
mpaka api-keys commands.
Create an execution
Section titled “Create an execution”POST /v1/executionsCreation requires an Idempotency-Key header with a non-empty value of at most
128 characters.
curl --fail-with-body --silent --show-error \ --request POST \ https://api.mpaka.dev/v1/executions \ --header "Authorization: Bearer $MPAKA_API_KEY" \ --header 'Idempotency-Key: hello-python-v1' \ --header 'Content-Type: application/json' \ --data '{ "language": "python", "code": "print(6 * 7)", "timeout_ms": 3000, "memory_mb": 128 }'timeout_ms and memory_mb are optional and use the defaults shown above.
You can also select named resource profiles or specify a vCPU count. Read the
current profile names and bounds from GET /v1/limits
instead of hardcoding deployment-specific values:
{ "language": "python", "code": "print(6 * 7)", "cpu_profile": "high_cpu", "memory_profile": "high_memory"}Set either cpu_profile or vcpu_count, not both. Set either
memory_profile or memory_mb, not both. A successful create is asynchronous:
poll GET /v1/executions/{id} until it reaches a terminal state. HTTP 202
means the request was accepted, not that the program succeeded; check the
terminal status, mode, and exit_code.
Accepted creation returns HTTP 202 and a full execution resource:
{ "id": "8f31cb95-486b-4f47-9837-51ec7a051879", "status": "queued", "language": "python", "timeout_ms": 3000, "memory_mb": 128, "vcpu_count": 1, "created_at": "2026-10-29T15:00:00Z", "finished_at": null, "stdout": "", "stderr": "", "exit_code": null, "mode": "pending"}Retry safely
Section titled “Retry safely”Retrying the same request with the same idempotency key returns the original execution and includes:
Idempotent-Replay: trueChanging the source or limits while reusing that key returns HTTP 409 with
idempotency_conflict. Generate a new key for a different logical execution.
Build a Python environment
Section titled “Build a Python environment”Python dependency environments are created from pinned name==version
requirements. Creation is asynchronous and uses a tenant-scoped idempotency
key:
curl --fail-with-body --silent --show-error \ --request POST \ https://api.mpaka.dev/v1/environments \ --header "Authorization: Bearer $MPAKA_API_KEY" \ --header 'Idempotency-Key: requests-env-v1' \ --header 'Content-Type: application/json' \ --data '{"requirements":["requests==2.32.3"]}'The API returns HTTP 202 with the initial environment resource. Poll
GET /v1/environments/{id} until the status is ready or failed; both are
terminal. Submit an execution only after ready. The artifact digest and
resolved dependency digest are available only after the build succeeds.
Reusing the key with different requirements returns HTTP 409.
The request must contain a non-empty list of pinned package versions; the
service accepts up to 32 requirements, each in name==version form. A
deployment can disable environment creation or lack its Builder configuration:
the API returns HTTP 403 when the tenant is not enabled and HTTP 503 when
environments or the Builder queue are unavailable. Check these errors before
making environment support a prerequisite for an integration.
Example 202 Accepted response while the build is queued:
{ "id": "b3d22156-c14c-4bdf-8b8a-57f2f94d6cf5", "status": "queued", "requirements": ["requests==2.32.3"], "artifact_sha256": null, "artifact_size_bytes": null, "resolved_digest": null, "created_at": "2026-11-27T15:00:00Z", "updated_at": "2026-11-27T15:00:00Z"}Pass the ready environment ID when creating an execution:
{ "language": "python", "code": "import requests; print(requests.__version__)", "timeout_ms": 3000, "memory_mb": 128, "environment_id": "<environment-id>"}The environment must belong to the authenticated tenant and be ready; a
queued, building, or failed environment cannot be used for an execution. The
environment ID is scoped to the authenticated tenant. Execution guests remain
networkless. Environment builds are isolated Builder VM jobs; they are not
performed by the API or execution guest.
List and inspect environments
Section titled “List and inspect environments”List the authenticated tenant’s environments:
curl --fail-with-body --silent --show-error \ 'https://api.mpaka.dev/v1/environments?page=1&page_size=25' \ --header "Authorization: Bearer $MPAKA_API_KEY"Pagination defaults to page=1 and page_size=25; page size is capped at 100.
The response contains items, page, page_size, total, and has_next.
Get an individual environment with GET /v1/environments/{id}. Its status is
queued, building, ready, or failed; artifact metadata is null until the
environment is ready. If the state becomes failed, stop polling and inspect
the returned resource rather than waiting indefinitely.
An example ready response includes artifact metadata:
{ "id": "b3d22156-c14c-4bdf-8b8a-57f2f94d6cf5", "status": "ready", "requirements": ["requests==2.32.3"], "artifact_sha256": "<sha256>", "artifact_size_bytes": 123456, "resolved_digest": "<sha256>", "created_at": "2026-11-27T15:00:00Z", "updated_at": "2026-11-27T15:01:00Z"}curl --fail-with-body --silent --show-error \ "https://api.mpaka.dev/v1/environments/$ENVIRONMENT_ID" \ --header "Authorization: Bearer $MPAKA_API_KEY"Creation, listing, and retrieval require environment support in the deployment.
Creation may return tenant_disabled (403) for a tenant or
environments_unavailable (503) when the environment service is not
configured. A wait or polling deadline belongs to the client; it does not stop
the build.
List executions
Section titled “List executions”GET /v1/executionscurl --fail-with-body --silent --show-error \ 'https://api.mpaka.dev/v1/executions?page=1&page_size=25&status=completed&language=python' \ --header "Authorization: Bearer $MPAKA_API_KEY"The response is a paginated envelope of summaries:
{ "items": [ { "id": "8f31cb95-486b-4f47-9837-51ec7a051879", "status": "completed", "language": "python", "created_at": "2026-10-29T15:00:00Z", "finished_at": "2026-10-29T15:00:01Z" } ], "page": 1, "page_size": 25, "total": 1, "has_next": false}List items do not contain source or execution output. Use the detail endpoint
when you need stdout, stderr, exit code, mode, or requested limits.
Query parameters
Section titled “Query parameters”| Parameter | Meaning |
|---|---|
page |
Positive page number; defaults to 1. |
page_size |
Positive page size; defaults to 25 and is capped at 100. |
status |
Exact lifecycle status. |
language |
Case-insensitive language filter. |
q |
Search by execution ID text or language. |
created_on |
Creation date in YYYY-MM-DD format. |
Invalid page values, status, or date format return HTTP 422 with
invalid_execution_query.
Get an execution
Section titled “Get an execution”GET /v1/executions/{id}curl --fail-with-body --silent --show-error \ "https://api.mpaka.dev/v1/executions/$EXECUTION_ID" \ --header "Authorization: Bearer $MPAKA_API_KEY"The response uses the full execution shape shown for creation. Submitted source is not returned in the resource.
Request cancellation
Section titled “Request cancellation”POST /v1/executions/{id}/cancelcurl --fail-with-body --silent --show-error \ --request POST \ "https://api.mpaka.dev/v1/executions/$EXECUTION_ID/cancel" \ --header "Authorization: Bearer $MPAKA_API_KEY"Cancellation is a request, not a promise that it wins every race. If the workload finishes first, the response can contain that terminal result instead.
Read the request limits
Section titled “Read the request limits”GET /v1/limitscurl --fail-with-body --silent --show-error \ https://api.mpaka.dev/v1/limits \ --header "Authorization: Bearer $MPAKA_API_KEY"{ "language": "python", "max_code_bytes": 16384, "min_timeout_ms": 100, "max_timeout_ms": 10000, "default_timeout_ms": 3000, "min_memory_mb": 32, "max_memory_mb": 512, "default_memory_mb": 128, "guest_memory_profiles": ["standard", "high_memory"], "guest_cpu_profiles": ["standard", "high_cpu"], "min_vcpu_count": 1, "max_vcpu_count": 2, "default_vcpu_count": 1}These are the bounds the API enforces before an execution is accepted, served
from the same values the validator uses, so a client can check them instead of
hardcoding a copy. They are identical for every workspace and change only with
a release. Your workspace quotas are reported separately by GET /v1/quota.
Profile and vCPU values in the example reflect the current contract; use the live response as the source of truth if a deployment or later release changes them.
Read quota and usage
Section titled “Read quota and usage”GET /v1/quota returns the authenticated tenant’s current unit and active
execution quota:
curl --fail-with-body --silent --show-error \ https://api.mpaka.dev/v1/quota \ --header "Authorization: Bearer $MPAKA_API_KEY"The response fields are used_units, limit_units, active_count, and
active_limit. This is tenant quota information and is separate from the
request bounds returned by GET /v1/limits.
GET /v1/usage lists execution attempts and aggregate provisioned
resource time. It defaults to the previous 30 days, up to 100 records per page.
Use next_cursor with the same until value for stable cursor pagination:
curl --fail-with-body --silent --show-error \ 'https://api.mpaka.dev/v1/usage?since=2026-11-01T00%3A00%3A00Z&until=2026-11-27T00%3A00%3A00Z&limit=100' \ --header "Authorization: Bearer $MPAKA_API_KEY"The response includes attempt counts, provisioned_vcpu_ms,
provisioned_mib_ms, items, and next_cursor when more records are
available. For cursor pagination, pass the returned cursor on the next call;
do not combine a cursor with a non-zero offset. The API allows a time range
of up to 366 days and a page limit from 1 to 1,000.
Use GET /v1/usage/summary for aggregate totals and daily rows:
curl --fail-with-body --silent --show-error \ 'https://api.mpaka.dev/v1/usage/summary?since=2026-11-01T00%3A00%3A00Z&until=2026-11-27T00%3A00%3A00Z&group_by=day' \ --header "Authorization: Bearer $MPAKA_API_KEY"Both endpoints accept RFC 3339 since and until timestamps; the end must be
in the past and the interval cannot exceed 366 days. group_by accepts day.
Usage reports provisioned resource metering, including measured, pending, and
unmeasured attempt counts. It is not a monetary charge. If metering is not
available, the API returns HTTP 503 with usage_unavailable.
Lifecycle states
Section titled “Lifecycle states”An execution can report queued, assigned, leased, provisioning,
running, completed, failed, timed_out, or cancelled. Only the last four
are terminal. Read Limits and results before treating completed
as program success.
Errors
Section titled “Errors”API errors use one envelope:
{ "error": { "code": "invalid_execution_parameters", "message": "execution parameters are invalid" }}Common responses include:
| HTTP | Code | Meaning |
|---|---|---|
400 |
idempotency_key_required |
The create request has no usable idempotency key. |
400 |
invalid_execution_parameters |
Language, source, timeout, or memory is invalid. |
400 |
invalid_requirements |
Environment requirements must be a non-empty list of pinned package versions. |
400 |
invalid_usage_period |
Usage timestamps, interval, limit, or grouping are invalid. |
400 |
invalid_usage_cursor |
The usage cursor is invalid. |
401 |
invalid_api_key |
The bearer key is missing, invalid, revoked, or rotated. |
401 |
invalid_credentials / invalid_session |
Account login credentials or the account session are invalid. |
403 |
tenant_disabled |
The workspace is not accepting workload requests. |
403 |
registration_closed |
Account registration is closed during the private beta. |
403 |
resource_quota_exceeded |
The requested CPU resources exceed the tenant’s assigned limit. |
404 |
execution_not_found |
The execution does not exist in this workspace. |
404 |
environment_not_found / api_key_not_found |
The environment or key does not exist in the authenticated tenant/account. |
409 |
idempotency_conflict |
The key was reused with a different request. |
409 |
environment_not_ready |
The environment is not ready to use for execution. |
400 |
cpu_profile_conflict |
Set either cpu_profile or vcpu_count, not both. |
400 |
memory_profile_conflict |
Set either memory_profile or memory_mb, not both. |
422 |
invalid_execution_query |
A list filter or pagination value is invalid. |
422 |
invalid_environment_query |
Environment pagination values must be positive integers. |
429 |
concurrency_quota_exceeded |
Too many executions are active. |
429 |
daily_budget_exceeded |
The workspace daily execution budget is exhausted. |
429 |
rate_limit_exceeded |
Requests are arriving too quickly. |
503 |
queue_full |
The service cannot accept another execution right now. |
503 |
environments_unavailable |
Environment builds are not configured or available on this deployment. |
503 |
usage_unavailable |
Tenant execution metering is not available. |
503 |
api_keys_unavailable / dashboard_unavailable |
API key metadata or account key management is not available. |
503 |
web_authentication_unavailable |
Account login or registration is not available. |
See Troubleshooting for the appropriate retry or credential action.