REST API
Build Against The Jungle Grid Execution API
Use the public orchestrator API from your own backend, workflow builder, or agent platform to estimate, submit, monitor, cancel, and retrieve outputs for Jungle Grid jobs.
Integration contract
- •Default base URL: https://api.junglegrid.dev. Set JUNGLE_GRID_API only for staging, local development, or private deployments.
- •Send API keys as Authorization: Bearer jg_... from server-side code only. Never expose keys in browser code.
- •Estimate before submit when users need a cost or capacity preview. Submit, cancel, and artifact download URL creation are side-effecting operations.
- •The public job lifecycle includes estimate, submit, list, status, runtime, logs, live logs, cancellation, artifact listing, and temporary artifact download URLs.
01
Authentication and scopes
Public API routes accept a browser-issued JWT session or a scoped API key. External integrations should use scoped API keys generated in the portal and keep them on the server. API keys are opaque jg_... values; the exact suffix is not part of the contract.
- •A missing or revoked key returns 401 UNAUTHORIZED.
- •A valid key without the required scope returns 403 FORBIDDEN.
- •Workspace-bound API keys can access only jobs and credentials in their bound workspace.
- •All examples below use placeholders; do not paste real keys into documentation, browser bundles, or public repos.
02
Execution lifecycle endpoints
These routes are the stable public contract for workflow builders. Jobs move through public statuses such as pending, queued, assigned, running, completed, failed, rejected, and cancelled. Terminal statuses are completed, failed, rejected, and cancelled.
- •POST /v1/jobs/estimate is read-only and does not start compute.
- •POST /v1/jobs queues real work and may reserve or consume credits based on the verified estimate and billing state.
- •POST /v1/jobs/{job_id}/cancel is side-effecting; it marks a non-terminal job cancelled and triggers managed teardown where applicable.
- •Common errors include INVALID_REQUEST, JOB_SCREENING_BLOCKED, INSUFFICIENT_FUNDS, MAINTENANCE_ACTIVE, CPU_ONLY_WORKLOAD_UNSUPPORTED, ACCELERATOR_REQUIREMENT_UNSPECIFIED, NOT_FOUND, FORBIDDEN, and CONFLICT.
03
Logs and artifacts
Logs and managed artifacts are public REST contracts. Availability still depends on the runtime path and storage configuration: managed providers can report unsupported or delayed runtime fields when the upstream provider does not expose stdout, stderr, or exit code.
- •Writing regular files under /workspace/artifacts in a managed job makes them eligible for automatic artifact upload.
- •Artifact download URL creation is side-effecting because it mints a temporary signed URL.
- •Signed URLs are temporary secrets; do not log them or share them publicly.
- •If artifact storage is not configured or under maintenance, artifact routes return ARTIFACTS_UNAVAILABLE or MAINTENANCE_ACTIVE.
04
Callbacks and webhook security
Job submission accepts per-job callback settings. Jungle Grid sends terminal lifecycle callbacks to the configured HTTPS URL and includes both configured bearer auth and Jungle Grid callback metadata headers.
- •callback_url must use HTTPS unless it targets localhost.
- •callback_auth_token is sent back as Authorization: Bearer <token>; treat it as a secret.
- •Callback requests include X-JungleGrid-Callback-Version, X-JungleGrid-Callback-Timestamp, X-JungleGrid-Job-ID, and X-JungleGrid-Job-Status.
- •Workspace webhook signing-secret and delivery inspection routes exist for the portal workflow; use the portal webhooks page for account-level setup.
05
Integration guides
Use these examples when Jungle Grid is called from your own backend service. Keep JUNGLE_GRID_API_KEY on the server, forward only the fields your app allows, and return the orchestrator response to your client or worker.
- •Do not put JUNGLE_GRID_API_KEY in browser code, mobile apps, static sites, or public repositories.
- •Validate your own request body before forwarding it so users cannot submit arbitrary images or commands through your backend.
- •Use POST /v1/jobs/estimate before POST /v1/jobs when the user needs a cost or capacity preview.
- •Callback URLs must use HTTPS unless they target localhost; callback_auth_token is sent back as Authorization: Bearer <token>.
- •Callback requests include X-JungleGrid-Callback-Version, X-JungleGrid-Callback-Timestamp, X-JungleGrid-Job-ID, and X-JungleGrid-Job-Status headers.
06
Jobs and runtime surfaces
Jobs are created and queried through Bearer-protected /v1 routes. The estimate endpoint uses the same draft job fields as submit and returns workload classification, route status, live versus managed capacity counts, likely placement, runtime range, cost range, queue wait range, and estimated start window before confirmation. Optional constraints can be supplied per job while keeping the API intent-first.
- •POST /v1/jobs queues a new workload for an authenticated account.
- •GET /v1/jobs lists the caller's own jobs; GET /v1/jobs/{job_id} returns the detail view.
- •GET /v1/jobs/{job_id}/runtime exposes runtime tails and exit information when available.
- •GET /v1/jobs/{job_id}/logs and GET /v1/jobs/{job_id}/logs/live expose stored and streamed runtime logs where the runtime path reports them.
- •GET /v1/jobs/{job_id}/artifacts and POST /v1/jobs/{job_id}/artifacts/{artifact_id}/download expose managed artifacts and temporary signed download URLs where artifact storage is configured.
- •Estimate responses now include estimated_hourly_rate_usd, min/max hourly range, estimated_queue_wait_min_sec, estimated_queue_wait_max_sec, estimated_start_time_min, estimated_start_time_max, and constraints_relaxed when soft preferences were auto-relaxed.
07
Nodes, provider operations, and account linking
Public capacity discovery and provider-owned node operations are split. Providers also have an authenticated route for linking an additional business role to the same account.
- •GET /v1/nodes is public capacity discovery.
- •GET /v1/nodes/mine and POST /v1/nodes/register are provider-facing authenticated routes.
- •Registry credential routes let the portal and CLI save private image credentials explicitly.
08
Billing, topups, and payouts
Billing surfaces are built around credits and use Paystack-backed wallet funding in USD. User and provider views share balance and history routes, while provider payout routes are currently unavailable as Jungle Grid standardizes on USD.
- •Users start USD wallet topups and verify them through the topup routes.
- •Provider payout endpoints remain present but currently return a temporary-unavailable response.
- •The Paystack webhook route is the settlement hook for billing events.
09
Implementation notes for consumers
The web portal and CLI both treat the orchestrator as the source of truth. Resource APIs require Bearer tokens, and the portal's public browser pages delegate session choice before handing off to authenticated /v1 routes.