Skip to main content
The Ninja API is currently in beta. Email hey@molin.ai to request access and receive your API key.
The Ninja API lets you submit prompts to Ninja, optionally define a structured output schema, and retrieve results — all over HTTP.

Base URL

https://ninja.new

Authentication

All requests require a Bearer token in the Authorization header. API keys are prefixed with nsk_.
Authorization: Bearer nsk_your_api_key_here

Endpoints

Create a task

POST /v0/api/task — submit a prompt and start execution.

Get task result

GET /v0/api/task/result — retrieve status and result.

Typical usage pattern

  1. Create a taskPOST /v0/api/task — save the returned taskId.
  2. Poll for resultGET /v0/api/task/result?taskId=...&wait=1.
  3. If status is pending — the task hasn’t started yet. wait=1 has no effect for pending tasks. Wait a short moment and poll again.
  4. If status is in_progress — the long-poll is active and the request will block until the task completes. Poll again if the request times out.
  5. When status is completed or failed — read the result or error field and stop polling.

Task statuses

StatusDescription
pendingTask created, hasn’t started yet.
in_progressTask is currently executing.
completedTask finished successfully. result is available.
failedTask encountered an error. error contains the message.
cancelledTask was cancelled.
pausedTask is paused, waiting for user input.
stoppedTask was stopped.
impossibleTask cannot be completed.
out_of_creditsUser ran out of credits during execution.

Rate limits

Both endpoints share a limit of 10 requests per minute per user. Exceeding the rate limit returns 429 Too Many Requests.

Error responses

Status codeDescription
400Invalid request body or query parameters (e.g. prompt too long, invalid resultSchema, malformed taskId).
401Missing or invalid API key.
404Task not found or not owned by the authenticated user.
429Rate limit exceeded (10 req/min) or free-plan task quota exhausted.