API

Quote, 202 scan, SSE, milliscale.

Hunt API on Detective, Chief, and Director.

Get started

  1. 1

    Mint

    Session cookie. Plaintext mago_sk_ once. Customer keys cannot call /api/keys.

    Request
    curl -sS https://mago.team/api/keys/generate \
      -H "Cookie: mago-token=…" \
      -H "Content-Type: application/json" \
      -d '{"name":"desk"}'
  2. 2

    Quote

    Milliscale estimate. No debit. estimated_credits is what the scan reserves.

    curl -sS https://mago.team/api/v1/quote \
      -H "X-API-Key: mago_sk_…" \
      -H "Content-Type: application/json" \
      -d '{"target":"example.com"}'
  3. 3

    Scan

    authorization_confirmed must be true. Live keys hunt. mago_sk_test_ is client-dev: sandbox-example, no hunt.

    curl -sS https://mago.team/api/v1/scans \
      -H "X-API-Key: mago_sk_…" \
      -H "Content-Type: application/json" \
      -d '{"target":"example.com","authorization_confirmed": true,"passive_only":true,"ai":false}'
  4. 4

    Stream

    SSE until done, failed, or cancelled. Then GET the report.

    curl -N https://mago.team/api/billing/order/{order_id}/stream \
      -H "X-API-Key: mago_sk_…"

Authentication

Hunt calls take X-API-Key or Authorization: Bearer mago_sk_. Mint stays on the session cookie. HTTPS only.

Header

HeaderUse
X-API-Keymago_sk_…
AuthorizationBearer mago_sk_
Cookiemago-token (mint only)

Prefix

PrefixUse
mago_sk_Live hunt. Minted. Debits milliscale.
mago_sk_test_Integrator client-dev fixture. Public prefix. No owner, no wallet, no hunt.

Reference

Public hunt surface. Examples are milliscale for example.com with AI off. Quote is the live figure.

POST/api/v1/quote

200

Milliscale estimate. No debit. Quote before every hunt.

X-API-Key or Bearer mago_sk_

Request

FieldTypeNotes
targetstringDomain, mailbox, IP, handle, or phone. Max 255.
offer_idstring?Optional. Resolved from the target type when omitted.
passive_onlyboolDefault true. Skip active HTTP probes.
aiboolDefault false. Adds the token hold to estimated_credits.

Response

FieldTypeNotes
productstringAlways search on the public hunt.
estimated_creditsintMilliscale debit. SPELL_CREDITS sum plus tokens when ai is true.
charged_creditsintSame number the scan will reserve.
module_creditsintSpell sum without the token hold.
token_creditsintAI hold. Zero when ai is false.
offer_idstringResolved offer, e.g. domain.
spellsstring[]Modules that will run. Truncated in the example below.
curl -sS https://mago.team/api/v1/quote \
  -H "X-API-Key: mago_sk_…" \
  -H "Content-Type: application/json" \
  -d '{"target":"example.com"}'

POST/api/v1/scans

202

Start the hunt. Returns order_id. Sandbox keys return sandbox-example and never debit.

X-API-Key or Bearer mago_sk_

Request

FieldTypeNotes
targetstringSame selector as quote.
authorization_confirmedboolMust be true. 400 AuthorizationRequired otherwise.
passive_onlyboolDefault true.
aiboolDefault false. Reserved credits include the token hold.
offer_idstring?Optional. Pack SKUs are ignored; product is search.

Response

FieldTypeNotes
order_idstringPoll and stream secret. Foreign ids are 404.
credits_reservedintEquals charged_credits from quote for the same body.
statusstringqueued on live. sandbox on mago_sk_test_.
curl -sS https://mago.team/api/v1/scans \
  -H "X-API-Key: mago_sk_…" \
  -H "Content-Type: application/json" \
  -d '{"target":"example.com","authorization_confirmed": true,"passive_only":true,"ai":false}'

GET/api/v1/scans/{order_id}

200

Owner poll. Another account’s order_id is 404.

X-API-Key or Bearer mago_sk_

Response

FieldTypeNotes
order_idstringSame id you posted.
statusstringqueued, running, building, done, failed, cancelled.
targetstring?Selector.
productstring?search.
progressobject?done / total while running.
curl -sS https://mago.team/api/v1/scans/{order_id} \
  -H "X-API-Key: mago_sk_…"

GET/api/billing/order/{order_id}/stream

200

SSE until done, failed, or cancelled. One JSON object per event.

X-API-Key or Bearer mago_sk_

Response

FieldTypeNotes
doneintModules finished.
totalintModules in this hunt.
statusstringMirrors the order status.
order_idstringSame id.
curl -N https://mago.team/api/billing/order/{order_id}/stream \
  -H "X-API-Key: mago_sk_…"

GET/api/v1/reports/{order_id}

200

Public report JSON (project_public_dict). 409 while the report is still building.

X-API-Key or Bearer mago_sk_

curl -sS https://mago.team/api/v1/reports/{order_id} \
  -H "X-API-Key: mago_sk_…"

GET/api/v1/credits

200

Wallet. Monthly burns first, then permanent.

X-API-Key or Bearer mago_sk_

Response

FieldTypeNotes
monthlyintPlan allotment remaining.
permanentintPack balance.
totalintmonthly + permanent.
curl -sS https://mago.team/api/v1/credits \
  -H "X-API-Key: mago_sk_…"

POST/api/keys/generate

200

Plaintext mago_sk_ returned once. Store it. Live hunts use this key.

Cookie mago-token. Detective+ session. Customer keys cannot mint.

Request

FieldTypeNotes
namestringLabel. Default default.

Response

FieldTypeNotes
api_keystringShown once.
key_idstringRevoke handle.
namestringLabel.
created_atstringISO-8601.
curl -sS https://mago.team/api/keys/generate \
  -H "Cookie: mago-token=…" \
  -H "Content-Type: application/json" \
  -d '{"name":"desk"}'

Errors

JSON bodies. A hunt that exceeds the wallet is 402. Another account's order_id is 404.

StatusNameWhen
AuthorizationRequiredPOST /api/v1/scans without authorization_confirmed true.
Invalid API keyMissing, revoked, or malformed mago_sk_ header.
Insufficient creditsWallet total is below the milliscale debit for this target.
ApiAccessRequiredOperative or Scout key. Customer keys on admin, spells/run, or /api/keys.
400 AuthorizationRequired
{
  "detail": {
    "error": "AuthorizationRequired",
    "message": "You must confirm authorization to scan this target."
  }
}
{
  "detail": {
    "error": "AuthorizationRequired",
    "message": "You must confirm authorization to scan this target."
  }
}
{ "detail": "Invalid API key" }
{ "detail": "Insufficient credits: need 208, have 50" }
{
  "detail": {
    "error": "ApiAccessRequired",
    "required_plan": "pro",
    "current_plan": "solo",
    "upgrade_url": "/pricing"
  }
}
API — MAGO Intelligence Grid | mago.team