Developers · API v1.2.0

AssayDirect API

Let your pipeline or AI agent quote, order and receive structured lab results — the same services and prices as the website, as JSON. A person always pays.

1.Overview

The API covers the whole loop: read the catalog, validate candidates and get a price-locked quote, place the order, follow it through events or webhooks, download results when an AssayDirect scientist has released them, and reconcile invoices and payments. A person always pays — an agent can order, but never moves money.

  • Base URL: https://assaydirect.com/api/v1
  • JSON with snake_case fields; money in integer US cents; times in ISO 8601 UTC.
  • Prices come from the same engine as the website: an API quote and the web configurator always agree to the cent.
  • Option IDs (e.g. host.hek) are stable and identical to the website configurator.
  • Experiments run in reviewed partner laboratories in China; labs receive coded samples only. Your data is never resold or used to train models.

2.Quickstart

Step 1. Sign in to the client portal (or create an account and confirm your email), then open API Keys. Keys belong to your account: quotes and orders made with them are yours. Start with a test key and the read scope, and keep it in an environment variable:

shell
export ASSAYDIRECT_API_KEY="ad_test_…"

Step 2. List the services and their option IDs (no key needed):

shell
curl https://assaydirect.com/api/v1/services

Step 3. Check the input format for one service, pick a target ID from its catalog, then ask for a quote:

shell
curl https://assaydirect.com/api/v1/services/seq2bind/schema

curl "https://assaydirect.com/api/v1/targets?service_id=seq2bind"

curl https://assaydirect.com/api/v1/quotes \
  -H "Authorization: Bearer $ASSAYDIRECT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Round 3 – anti-PD-L1 VHH designs",
  "items": [
    {
      "service_id": "seq2bind",
      "options": {
        "host": "ecoli",
        "fmt": "vhh",
        "depth": "screen",
        "extra": []
      },
      "target": "tgt_pdl1_human",
      "candidates": [
        {
          "candidate_id": "R3-0001",
          "sequence": "QVQLVESGGGLVQAGGSLRLSCAASGRTFSSYAMGWFRQAPGKEREFVAAISWSGGSTYYADSVKGRFTISRDNAKNTVYLQMNSLKPEDTAVYYCAA",
          "predictions": [
            {
              "model": "my-binder-v4",
              "endpoint": "fit_kd",
              "value": 12.3,
              "unit": "nM"
            }
          ]
        }
      ]
    }
  ],
  "metadata": {
    "round": "3"
  }
}'

The response (201) prices each item, lists the result endpoints you will receive and anything to fix or know before ordering:

201 Created
{
  "object": "quote",
  "id": "quo_8c1f2e…",
  "livemode": false,
  "status": "open",
  "currency": "usd",
  "total_cents": 19900,
  "items": [
    {
      "item_no": 1,
      "service_id": "seq2bind",
      "service_name": "Sequence-to-Binding Screening",
      "quantity": 1,
      "options": {
        "host": "ecoli",
        "fmt": "vhh",
        "depth": "screen",
        "extra": []
      },
      "target": "tgt_pdl1_human",
      "candidate_count": 1,
      "special_price_applied": true,
      "setup_cents": 0,
      "per_candidate_cents": 19900,
      "candidates_cents": 19900,
      "percent_off": 0,
      "discount_cents": 0,
      "total_cents": 19900,
      "turnaround": "3–5 weeks",
      "input_type": "sequence",
      "endpoints": [
        "yield",
        "concentration",
        "sds_purity",
        "bli_response"
      ]
    }
  ],
  "warnings": [
    {
      "code": "biosafety_screening",
      "detail": "Every sequence is screened for biosafety before synthesis; declined sequences are refunded."
    }
  ],
  "valid_until": "…24 hours after creation…"
}

3.Authentication

Send the key in every request that needs one:

header
Authorization: Bearer ad_live_…
  • Test keys (ad_test_…) work like live keys but are marked livemode: false; they never charge or reach a lab. Live and test data are separate.
  • Scopes: read — everything you can read, plus quotes; order — place and cancel orders; webhook — manage webhook endpoints.
  • Expiry 7 days to 1 year; revoke at once in the portal. Only a hash is stored, so a lost key cannot be shown again.
  • Child keys for agents: POST /api_keys/self/restrict derives a narrower key — fewer scopes, only some services, a lower order limit or a shorter life. Nothing can be widened, and revoking the parent disables every child.
shell
curl https://assaydirect.com/api/v1/api_keys/self/restrict \
  -H "Authorization: Bearer $ASSAYDIRECT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "design-agent", "scopes": ["read"], "services": ["seq2bind"], "max_order_cents": 200000, "expires_in_days": 7}'

Never paste a key into a chat with an AI model; put it in the client or MCP configuration instead.

4.Endpoints

MethodPathScopeWhat it does
GET/servicesNoneOrderable services: prices in cents, option groups with IDs, volume discounts
GET/services/{id}NoneOne service
GET/services/{id}/schemaNoneJSON Schema of a quote item; result endpoints with units
POST/quotesreadValidate, price and store a request for 24 hours
GET/quotes/{id}readA stored quote: request, price snapshot, status
GET/targetsNoneAssay objects we sell, with the services each applies to and the fee it adds per order line
POST/targets/requestsreadAsk for a target or cell line we don't list yet
POST/ordersorderPlace an order from a quote or items (Idempotency-Key)
GET/orders · /orders/{id}readOrders: status, hold, payment status, items
POST/orders/{id}/cancelorderCancel before work starts
GET/orders/{id}/paymentreadPayment link or bank-transfer details
GET/orders/{id}/resultsreadReleased results: JSON or CSV (long / wide), any version
GET/orders/{id}/files · /files/{id}/downloadreadReports and data files with SHA-256; 5-minute signed links
GET/eventsreadEvent feed with long polling
POST · GET/webhook_endpointswebhookRegister or list webhook endpoints
DELETE/webhook_endpoints/{id}webhookRemove an endpoint
GET · POST/webhook_endpoints/{id}/deliveries · /resendwebhookDelivery log; send an event again
POST/webhook_endpoints/{id}/rotate_secretwebhookNew signing secret; old one signs too for 24 hours
GET/invoices · /invoices/{id} · /pdfreadOrder and fee invoices
GET/paymentsreadPayments and refunds (JSON or CSV)
GET/statements · /balancereadPeriod statement (JSON or CSV); amount due now
POST/api_keys/{id}/restrictanyDerive a narrower child key for an agent
GET/openapi.jsonNoneOpenAPI 3.1 description

Full request and response schemas: /api/v1/openapi.json.

5.Services & Options

Each service has a setup fee, a per-candidate price and option groups. A single-choice group (e.g. expression system) takes one option ID; the first one is the standard configuration and is used when you omit the group. An add-on group takes an array of option IDs. Option prices are per candidate.

Pricing in a service object: setup_cents, unit_cents, volume_discounts on the per-candidate part, and one_candidate_price_cents — a fixed price for a single candidate, to which selected add-ons are added.

Services available now: seq2bind, expressqc, peptide, peptidefn, binding, proteinqc, activity, adme, lcms, cell.

Targets and cell lines. GET /targets lists the assay objects we sell, once each, with the service_ids it applies to, its category, gene and identifier (UniProt accession or Cellosaurus RRID), a pricing_tier and a target_fee_cents that is the same for every one of those services: standard adds nothing and is already covered by the service price, surcharge adds its fee once per order line, never per candidate (the protein is bought once for the whole line), and quote_only has no list price. The same list is on each service as targets. When a service has one, target must be an ID from it; when it is empty, target stays free text that the team confirms before work starts.

All material costs — target protein, cell line, reagents and controls — are included in the price. Experimental materials are supplied by the lab and not accepted from clients (sample-based services still take your samples to be tested); a specified brand or catalogue number is quoted per order: ask with POST /targets/requests.

6.Quotes

A quote is a stored price check. POST /quotes validates every item against the live catalog, prices it and keeps it for 24 hours (valid_until). It creates no order and charges nothing.

  • Items: 1–20, each with service_id, options, an optional target (plain words, confirmed by our team) and either quantity or the candidates themselves.
  • Candidates: a candidate_id that you choose (kept unchanged in every result), the sequence fields the schema asks for — sequence, or heavy_chain and light_chain for IgG — and optionally your model's predictions. Predictions are returned next to measured results and are never sent to the lab.
  • Warnings tell you what to know before ordering, e.g. target_required, samples_required or over_key_limit.
  • Price lock: an order created from an open quote keeps the quoted price even if the catalog changes. A quote creates at most one order.
  • GET /quotes/{id} returns the stored quote with status: open, expired or used. Quotes are deleted after 30 days.

7.Orders & Payment

Place an order with the same body as a quote, or just the quote's ID to keep its price. Every request needs an Idempotency-Key header: retrying with the same key and the same body returns the same order instead of a second one. A key belongs to one API key and one mode (live or test); reusing it with a different body or from another API key is refused with 409 idempotency_mismatch or idempotency_key_in_use.

shell
curl https://assaydirect.com/api/v1/orders \
  -H "Authorization: Bearer $ASSAYDIRECT_API_KEY" \
  -H "Idempotency-Key: round3-order-1" \
  -H "Content-Type: application/json" \
  -d '{"quote_id": "quo_8c1f2e…", "payment": "payment_link", "po_number": "PO-8841"}'
  • Payment is a separate step: GET /orders/{id}/payment returns a card payment link for a person to open, or bank-transfer details for "payment": "invoice". Work starts once payment arrives.
  • Status: awaiting_payment → awaiting_inputs → screening → in_lab → in_review → delivered, or cancelled. Sequence orders that include every sequence skip awaiting_inputs. Problems (late sample, replacement needed) appear as hold without changing the status.
  • Cancel with POST /orders/{id}/cancel: unpaid orders are cancelled at once; paid orders not yet in the lab are cancelled by our team with a full refund; once in the lab, contact us.
  • Limits: a key's max_order_cents refuses larger orders (403 over_key_limit); each key places at most 50 orders and 5,000 candidates per 24 hours (429 daily_limit; ask us to raise it).
  • Samples: for sample services, GET /orders/{id} returns sample_shipping (address and the label to write on the parcel) once paid. Labs only ever see coded samples.

8.Events & Webhooks

Six event types: order.status_changed, order.hold, order.results_released, order.results_corrected, invoice.updated, payment.recorded. Events carry IDs and what changed, never result data — fetch the object afterwards. They are kept 30 days.

Polling (recommended for agents): GET /events?after=<cursor>&wait=30 holds the request until something happens; continue from next_cursor.

shell
curl "https://assaydirect.com/api/v1/events?after=0&wait=30" -H "Authorization: Bearer $ASSAYDIRECT_API_KEY"

Webhooks: POST /webhook_endpoints with a public https URL (and optionally events) returns a signing secret once. Each delivery is a POST of the event with headers Webhook-Id (the event ID — use it to de-duplicate), Webhook-Timestamp and Webhook-Signature. Answer 2xx; network errors and 5xx are retried with back-off for 24 hours, 4xx are not. POST /webhook_endpoints/{id}/rotate_secret issues a new secret; for 24 hours each delivery carries both signatures (space-separated) so you can switch without gaps. Delivery logs: in the portal under API Keys, or GET /webhook_endpoints/{id}/deliveries.

Node.js — verify a webhook
import crypto from "node:crypto";

function verify(secret, headers, rawBody) {
  const id = headers["webhook-id"], ts = Number(headers["webhook-timestamp"]);
  if (Math.abs(Date.now() / 1000 - ts) > 300) return false; // older than 5 minutes
  const expected = "v1," + crypto.createHmac("sha256", secret).update(`${id}.${ts}.${rawBody}`).digest("base64");
  return headers["webhook-signature"].split(" ").some((s) => s.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(s), Buffer.from(expected)));
}

9.Results

results_status is pending until something is released, complete only when every item is released and each delivers every expected candidate with a row for every expected endpoint (a not_tested or failed row counts as delivered), and partial otherwise. Each item's delivery shows the expected, delivered and complete candidate counts.

GET /orders/{id}/results returns released results only, one entry per candidate × endpoint × context (target, test concentration), with a fixed unit per endpoint and your own predictions alongside. ?format=csv gives the same rows as a long CSV; &layout=wide gives one row per candidate. Each order item has its own data_version: a correction is a new version with a note, and ?version=n still returns the earlier one. Status is kept in three separate fields so that a negative result is never confused with a failed experiment:

  • execution_status: done, failed, not_tested
  • qc_status: pass, flag, fail, na
  • qualifier: empty for an exact value, or <, >, nd, nf (nd = not detected, nf = not reliably fittable)
  • reason: not_expressed, insufficient_material, sample_rejected, assay_failed, qc_issue, other
EndpointUnitMeaning
yieldmg/LExpression yield per culture volume
concentrationmg/mLProtein concentration
sds_purity%SDS-PAGE main-band integration
bli_responsenmSingle-concentration BLI end-point response, reference-subtracted
fit_kdnMEquilibrium dissociation constant (apparent values are flagged in the report)
fit_kon1/(M·s)Association rate constant
fit_koff1/sDissociation rate constant
fit_r2—Goodness of fit
tm°CThermal unfolding midpoint
sec_monomer%SEC monomer fraction; empty when the main peak cannot be assigned as monomer
expected_massDaTheoretical neutral monoisotopic mass (average mass for large proteins, stated in the method)
observed_massDaObserved neutral mass on the same basis; never an ion m/z
mass_matchyes / noObserved and expected mass agree within the method tolerance
endotoxinEU/mgEndotoxin, converted with a same-batch protein concentration
hplc_purity%HPLC main-peak area fraction
nmr_consistentyes / no1H NMR consistent with the expected structure; empty when partial or inconclusive
activity%Single-concentration inhibition relative to negative (0%) and full-inhibition (100%) controls
fit_ic50µMRelative IC50: midpoint between the fitted top and bottom plateaus
fit_hill—Hill slope
viability%Cell viability relative to vehicle control
half_lifeminMicrosomal half-life
clintµL/min/mgApparent intrinsic clearance
solubilityµMAqueous solubility; kinetic or thermodynamic as defined by the method
ppb%Plasma protein binding

Which endpoints a service returns, and for which options, is in GET /services/{id}/schema and in each quote item's endpoints.

10.Invoices & Reconciliation

Every order has an order invoice (number = order number, fixed at order time). A fee added later, such as shipping, gets its own fee invoice (AD-2611-482-F1); an issued invoice is never edited — a correction voids it and issues a new number. Invoice status is open, paid or void.

  • GET /payments lists money that moved — payment and refund — each with invoice_number, order_code and external_ref (the Stripe or bank reference you see on your statement). Add format=csv for your accounting system.
  • GET /statements?from=&to=&format=csv is your accounts-payable statement: invoices debit; payments and voids credit; a refund debits and credits the same amount. Closing balance = opening + invoiced − voided − paid.
  • GET /balance shows what is due now, by invoice. Quote the invoice number as the payment reference for bank transfers. Orders can carry your po_number; it appears on invoices and statements.

11.Test Mode (Sandbox)

Everything works the same with an ad_test_… key, but nothing is charged and no lab is involved. A test order is marked paid automatically and moves through every status about a minute apart, ending with simulated results (simulated: true) that follow the real format — including not-detected and not-tested rows — plus events and webhooks along the way. Test and live data are kept apart: a test key only sees test orders, quotes, events and webhooks, and a test order can never be paid or reach a lab. Test orders have no client-portal page (portal_url is null) and their invoice PDF is marked as a test invoice.

12.Errors

Errors are RFC 9457 problem documents. Programs should branch on code; errors[] lists every invalid field with its path and, where useful, the allowed_values. Quote the request_id when you contact us.

422 Unprocessable Content
{
  "title": "Unprocessable content",
  "status": 422,
  "code": "invalid_option",
  "detail": "Option \"host\" has no value \"cho\".",
  "errors": [
    {
      "path": "items[0].options.host",
      "code": "invalid_option",
      "message": "Option \"host\" has no value \"cho\".",
      "allowed_values": [
        "ecoli",
        "hek"
      ]
    }
  ],
  "request_id": "req_x7Kp2…"
}
StatusTypical codes
400invalid_json, missing_idempotency_key, invalid_cursor
401missing_api_key, invalid_api_key
403insufficient_scope, over_key_limit, email_not_verified
404unknown_service, quote_not_found, order_not_found, invoice_not_found, unknown_endpoint
409quote_used, quote_expired, quote_mismatch, too_late_to_cancel
422invalid_option, unknown_service, service_not_allowed, invalid_sequence, missing_sequence, quantity_mismatch, duplicate_candidate_id, …
429rate_limited (see Retry-After)

13.Rate Limits

60 requests per minute per key, of which at most 20 may create something (quotes, orders, cancellations, target requests, child keys, webhook endpoints). Over the limit you get 429 with a Retry-After header in seconds. Up to 384 candidates per item and 20 items per request.

14.MCP for AI Agents

A remote Model Context Protocol server lets an agent such as Claude use AssayDirect directly. Tools: list_services, get_service_schema, quote_order, get_quote, create_order (needs the order scope), get_order and get_results (can wait for results). The agent can place an order when you ask it to, but it can never pay or approve anything: payment is always done by a person.

Claude Code
claude mcp add --transport http assaydirect https://assaydirect.com/api/mcp \
  --header "Authorization: Bearer $ASSAYDIRECT_API_KEY"
MCP client configuration (JSON)
{
  "mcpServers": {
    "assaydirect": {
      "type": "http",
      "url": "https://assaydirect.com/api/mcp",
      "headers": {
        "Authorization": "Bearer ${ASSAYDIRECT_API_KEY}"
      }
    }
  }
}

Give the agent a child key with only the scopes and services it needs and an order limit (max_order_cents). A typical loop: the agent designs candidates, calls get_service_schema, fixes its input from the errors of quote_order, orders once you agree, you pay the link, and it calls get_results — then designs the next round with the measured data next to its predictions.

15.Versioning

The version is in the path (/v1). Within v1 we only add: new endpoints, new optional fields, new enum values and error codes — write clients that ignore unknown fields. A breaking change gets a new path, and the old one stays available for at least 12 months. Every change is listed in the changelog.

16.Coming Next

  • The MCP tool search_targets over GET /v1/targets
  • Spending controls on keys (monthly caps, automatic approval below a limit) and agent payments — when customers ask for them

Questions or an integration in mind? Write to [email protected].

API for AI Agents & Developers — AssayDirect