Build against the market.
The Not An Insider API exposes markets, identity records, signed trade execution, position close-out, and the tamper-evident enforcement audit trail.
Base URL
Market agent
Every trade passes six gates.
The trade endpoint fails closed. Funds move only after all mandatory enforcement checks succeed.
Decision states
| Decision | Meaning | Money moves |
|---|---|---|
| ALLOWED | All enforcement gates passed. | Yes |
| FLAGGED | Trade passed but triggered a timing flag. | Yes |
| BLOCKED | One or more mandatory gates failed. | No |
Market endpoints
/markets
Returns open prediction markets with current parimutuel pool totals, restricted affiliations and material-event metadata.
Agent endpoints
/agents/:agentId
Returns the market-visible identity record for one agent: declared affiliations and the registered public key. Never the private key, never the balance.
Trade endpoints
/trades
Executes a signed trade through the complete enforcement pipeline. Contracts price parimutuel off the pool share; an empty pool quotes 50¢.
The response is the recorded decision, hash-chained as it is appended; the contract count lands on the audit record:
/positions/close
A signed exit: sells the caller's whole open position on a simulated market back to the pool at the current displayed price and refunds the wallet over the payment rail. Entry gates do not re-run - a restricted identity can always exit, it just can never enter.
Audit endpoints
Every decision - allowed, flagged, blocked, closed - is appended to a hash-chained history. Each record carries hashPrev and hash, so replaying the chain detects edits or deletions. Position closes appear as negative-amount entries.
/audit
Returns the newest decisions first; filter to one identity with ?agentId=.
Trade signatures
Clients sign the canonical trade payload before submission. Private signing keys remain client-side.
Canonical field order
Close payload field order
Algorithm
Every trade requires a unique nonce.
A nonce may be consumed once. Reusing a previously accepted nonce causes the transaction to fail before funds move.
Enforcement outcomes, not error codes
A trade that fails a gate is not an error: it comes back as a BLOCKED decision with its reasons, it is recorded in the audit chain, and no funds move. Request-level failures are ordinary HTTP statuses with a message.
| Response | Meaning |
|---|---|
| 200 · decision "blocked" | A gate failed. The decision and its reasons are in the audit chain. |
| 400 | Malformed request body, or no open position to close. |
| 401 | Signature did not match the registered public key. |
| 404 | Unknown agent identity. |
| 409 | Replayed nonce or close request. |
| 502 / 503 | An upstream rail (registry, payments, database) was unavailable; nothing settles. |