Developers / API reference

The API reference.

Every endpoint, field and error in the job API. Send accounts, lots and constraints, or use the demo data; get back optimized weights and a run record with an input fingerprint and engine version, so every result can be reproduced exactly.

01 / Overview

Base URL & how it fits together.

All requests go to one versioned base path. The surface is deliberately small: submit a job, poll it, fetch the result.

Base URL
https://asymmetrycomputing.com/api/prism
  1. Upload your own data with PUT /v1/datasets/{name}. Skip this step to run on demo data.
  2. Submit the job with POST /v1/jobs and keep the returned job_id.
  3. Poll GET /v1/jobs/{id} until status is completed.
  4. Fetch GET /v1/jobs/{id}/result and, if you need them, the weights from GET /v1/jobs/{id}/weights.
02 / Authentication

An API key on every request.

Pass your key in the X-API-Key header. Every route needs it except /v1/access-requests.

Header
X-API-Key: YOUR_API_KEY

No key yet? Request a free trial key on the API page. Keys are approved by hand and emailed. Keep the key on your server; the integration guide explains why.

03 / Endpoint reference

Every endpoint.

GET/v1/capabilities

Returns the supported task types and the current limits for your key. Call it before you submit a job to see what your key can do.

Shell
curl https://asymmetrycomputing.com/api/prism/v1/capabilities \
  -H "X-API-Key: $KEY"

POST/v1/access-requests

Request a trial key. No API key required. The endpoint files the request and returns a tracking ID; keys are approved by hand and emailed.

JSON request body
{
  "name": "Jane Doe",
  "email": "jane@fund.example",
  "company": "Example Capital",
  "use_case": "Testing book_rebalance on a 10k-account taxable book"
}
JSON response
{
  "request_id": "req_8f2a1c90",
  "status": "pending_review"
}

PUT/v1/datasets/{name}

Upload a dataset as the raw request body: a .npz archive that matches the schema of the task you will run (see book_rebalance or portfolio). Trial keys are capped at 200 MB per dataset.

Shell
curl -X PUT https://asymmetrycomputing.com/api/prism/v1/datasets/my_book \
  -H "X-API-Key: $KEY" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @my_book.npz

GET/v1/datasets

List the datasets uploaded under your key.

Shell
curl https://asymmetrycomputing.com/api/prism/v1/datasets \
  -H "X-API-Key: $KEY"

GET/v1/jobs/{id}

Poll the job status: queued, running, completed or failed.

JSON response
{ "job_id": "job_a91fe0", "status": "running" }

GET/v1/jobs/{id}/result

Fetch the full result once the job is completed: a summary of the book (turnover, positions, per-segment breakdown), an optional independent-validation block, and the run record, whose fields are listed in the reference issued with your key. The values below are illustrative and abridged.

JSON response, abridged
{
  "job_id": "job_a91fe0",
  "status": "completed",
  "summary": {
    "n_accounts": 10000,
    "n_names": 1000,
    "turnover": 0.083,
    "positions": 9639,
    "segments": [
      { "profile": "taxable", "accounts": 6400, "turnover": 0.091 },
      { "profile": "tax_deferred", "accounts": 3600, "turnover": 0.068 }
    ]
  },
  "validation": {
    "reference": "independent open-source reference, 1e-9 tolerance",
    "sample_size": 50,
    "max_weight_error_pct": 0.00025,
    "gate_pct": 0.05,
    "passed": true
  },
  "record": { "…": "…" }
}

GET/v1/jobs/{id}/weights

Download the optimized weights as a .npz archive: one row per account and one column per name, in the order of the input dataset.

Shell
curl https://asymmetrycomputing.com/api/prism/v1/jobs/job_a91fe0/weights \
  -H "X-API-Key: $KEY" -o weights.npz
04 / Submitting jobs

POST /v1/jobs

Every job is asynchronous: submit it, get a job_id back at once, then poll. There are two task types: book_rebalance for books of accounts and portfolio for a single portfolio.

JSON response
{ "job_id": "job_a91fe0", "status": "queued" }
A black box by design. You send inputs and receive weights and a run record. The engine’s internals are not exposed through the API.
05 / Task: book_rebalance

Rebalance a whole book of accounts.

The book-scale task. Use it to rebalance thousands of accounts against a target model in one call.

JSON request
{
  "task": "book_rebalance",
  "source": "demo | stress_demo | dataset",
  "n_accounts": 25000,
  "n_names": 1000,
  "dataset_id": "my_book",
  "precision": "<profile>",
  "validate_sample": 50,
  "position_max": 0.08
}
FieldTypeNotes
sourcestringdemo, stress_demo or dataset; see below
n_accountsintRequired for demo and stress_demo
n_namesint≤ 1,000
dataset_idstringRequired when source is dataset
precisionstringQuality profile for the run
validate_sampleintAccounts to validate independently in the job, against an independent reference
position_maxfloatPer-name position cap, as a weight fraction

Source: demo

Real price history, with synthesized accounts and holdings layered on top. The quickest way to smoke-test the endpoint and see the shape of a result.

Source: stress_demo

A full-difficulty, realistic book: multi-lot HIFO cost basis built from real price history, sparse model holdings, concentrated legacy positions, a mix of taxable and tax-deferred accounts, wash-sale blocks, and different position caps per account. This is the most demanding test mode.

Source: dataset, .npz schema

Upload your own book with PUT /v1/datasets/{name}, then reference it by dataset_id.

KeyRequiredNotes
pricesYesPrice history
W_curNoCurrent weights per account
gain_fracNoUnrealized gain as a fraction of position value
is_short_termNoShort-term or long-term lot flag
wash_blockedNoPositions currently blocked by a wash sale
profileNoAccount profile: taxable, deferred or mixed
w_indexNoTarget model or index weights
06 / Task: portfolio

Optimize a single portfolio.

For one portfolio rather than a book: a standard allocation problem over an asset universe.

JSON request
{
  "task": "portfolio",
  "source": "demo | dataset",
  "n_assets": 5000,
  "dataset_id": "my_universe"
}
KeyShapeRequiredNotes
risk_model—YesYour risk inputs. Accepted forms and shapes are documented in the authenticated reference issued with your key.
mu(n,)NoExpected returns
w_current(n,)NoCurrent portfolio weights
07 / Limits & errors

Trial-tier limits.

LimitValue
Accounts per job25,000
Assets per job20,000
Jobs per day10
Total jobs (trial key lifetime)40
Dataset upload size200 MB

Need more? A production key removes these caps. Talk to us about pricing.

Error semantics

StatusMeaning
401Invalid or missing API key
403The request exceeds your key’s limits (accounts, assets or dataset size)
429Quota reached (jobs per day or the lifetime job cap)
500Generic failure.
Reproducible by design. Every completed job returns a run record with an input fingerprint and engine version, so the result can be reproduced exactly for debugging or review.

Get a free trial key.

Approved by hand and rate-limited, with room for a real book-scale test: up to 25,000 accounts per job and 10 jobs a day.