not an insider
Developer API

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.

API principle
Authorization is evaluated for every trade. A valid account session does not by itself authorize a market transaction.

Base URL

/api

Market agent

ans://v1.0.0.not-an-insider-just-lucky.biz
Execution

Every trade passes six gates.

The trade endpoint fails closed. Funds move only after all mandatory enforcement checks succeed.

01 · Signature Verify the signed canonical trade payload.
02 · Nonce Reject replayed transaction nonces.
03 · ANS Validate live agent status and identity.
04 · Affiliation Compare affiliations against market restrictions; minors are barred outright.
05 · Solvency Confirm sufficient available funds.
06 · Timing Flag trades near declared material events.
Enforcement

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
Markets

Market endpoints

GET /markets

Returns open prediction markets with current parimutuel pool totals, restricted affiliations and material-event metadata.

[{ "marketId": "541c331a-ec62-4982-942a-f8b7300b5689", "subject": "Simulated 5-minute index: up or down at window close?", "restrictedAffiliations": [], "pool": { "outcomeA": 43.72, "outcomeB": 0 }, "status": "open", "materialEventAt": null }]
Identity

Agent endpoints

GET /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.

{ "agentId": "939b792e-9c8f-445c-920c-618179a76c93", "fullName": "Dario Amodei", "role": "Employee", "affiliations": ["anthropic-staff"], "publicKey": "-----BEGIN PUBLIC KEY----- ...", "registeredAt": "2026-09-19T..." }
Transactions

Trade endpoints

POST /trades

Executes a signed trade through the complete enforcement pipeline. Contracts price parimutuel off the pool share; an empty pool quotes 50¢.

{ "tradeId": "3f2a9c...", "agentId": "939b792e-9c8f-445c-920c-618179a76c93", "marketId": "541c331a-ec62-4982-942a-f8b7300b5689", "outcome": "A", "amount": 11.50, "nonce": "7c1d...", "timestamp": "2026-09-20T05:44:00.000Z", "signature": "..." }

The response is the recorded decision, hash-chained as it is appended; the contract count lands on the audit record:

{ "tradeId": "3f2a9c...", "decision": "allowed", "reasons": ["All six checks passed; transfer cleared and market pool updated via the nessie rail."], "timestamp": "2026-09-20T05:44:01.000Z", "hashPrev": "a91c...", "hash": "4dd0..." }
POST /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.

{ "closeId": "9be4...", "agentId": "939b792e-9c8f-445c-920c-618179a76c93", "marketId": "541c331a-ec62-4982-942a-f8b7300b5689", "outcome": "A", "contracts": 23, "timestamp": "2026-09-20T05:46:00.000Z", "signature": "..." }
{ "closed": true, "contracts": 23, "unitPrice": 0.47, "proceeds": 10.81 }
Accountability

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.

GET /audit

Returns the newest decisions first; filter to one identity with ?agentId=.

[{ "tradeId": "9be4...", "decision": "allowed", "reasons": ["Position closed: sold 23 A contract(s) at 47c for $10.81 via the nessie rail."], "agentId": "939b792e-9c8f-445c-920c-618179a76c93", "marketSubject": "Simulated 5-minute index: up or down at window close?", "amount": -10.81, "outcome": "A", "contracts": 23, "hashPrev": "4dd0...", "hash": "c27e..." }]
Cryptography

Trade signatures

Clients sign the canonical trade payload before submission. Private signing keys remain client-side.

Canonical field order

tradeId agentId marketId outcome amount nonce timestamp

Close payload field order

closeId agentId marketId outcome contracts timestamp

Algorithm

RSA-SHA256
Replay protection

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.

{ "tradeId": "3f2a9c...", "decision": "blocked", "reasons": ["Replay protection rejected a nonce that was already used."] }
Responses

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.