HTTP API¶
The server speaks HTTP, on a Unix socket by default, or on TCP with --tcp. All responses are JSON.
This page documents the wire format that sylphd clients and the web app use. There is no
authentication; see the security notes.
| Endpoint | Method | Purpose |
|---|---|---|
/ |
GET | service name, version and the endpoints this server offers |
/health |
GET | liveness: status, version, uptime, jobs running and queued |
/info |
GET | database, metadata, limits and endpoints |
/messages |
GET | the operator's messages (--messages), an empty list without the option |
/query |
POST | ANI hits of uploaded sketches |
/profile |
POST | taxonomic profile of uploaded sketches |
/assembly |
POST | closest genomes of one assembly, sent as a sketch (always) or as raw sequence (only with --allow-sequences) |
/contigs |
POST | one classified result per contig of a fragmented assembly (contig-relative ANI, hits, consensus) |
/usage |
GET | aggregated usage statistics, only on a server started with --usage-db (otherwise 404) |
/health, /info and /messages are always served. The abuse limits (--rate-limit, --max-queue) apply to
the four POST endpoints and to GET /usage. With curl over a Unix socket:
Access tokens¶
A request may carry Authorization: Bearer <token>. A token from the server's
--privileged-token-file skips the rate limits; anything else is treated as no token.
- Every response to a request that carried a bearer token has
X-Token-Valid: trueorfalse, whatever its status (also4xxand429); a request without a token gets no such header. The header is exposed to browsers (CORS), andGET /inforepeats the verdict asaccess.token_valid. A wrong token is therefore reported, not refused. - With
--require-tokenevery path exceptGET /,/healthand/infoanswers401({"error": "this server requires an access token: ..."},WWW-Authenticate: Bearer) unless the token is valid./infosaysaccess.token_requiredso a client can tell in advance. - CORS preflights allow the
Authorizationheader.
Request id and compression¶
Every response carries an X-Request-Id header, error responses included: 12 hex characters,
unique per request. The same string is written to the server's access log with the request's
outcome (see sylphd serve), so a user can quote the id of a
failed request when reporting it. With --cors-origin it is exposed to JavaScript.
JSON responses of 1 KB or more are gzip-compressed when the request sends
Accept-Encoding: gzip. Smaller bodies, and clients that do not ask for it, get the plain body
with no Content-Encoding. A response is compressed once: a reverse proxy in front (the example
Caddyfile in deploy/ runs encode zstd gzip) only compresses what sylphd sent uncompressed.
GET /health¶
{"status": "ok", "service": "sylphd", "version": "0.10.0", "uptime_seconds": 12.345,
"jobs_running": 1, "jobs_queued": 0}
jobs_running is the number of jobs holding a --max-jobs slot right now, jobs_queued the
admitted jobs still waiting for one; both are 0 on an idle server. A /contigs request is one
job, however many contigs it carries.
GET /info¶
Reports:
service,version,api_version(integer, currently1: bumped on any change to the response shape of the result documents and of the/infofields clients read; thetaxonomysection below is informational and not covered; distinct from the server softwareversionand frommetadata.format_version),pysylph_version,python_version;database:name,size,sha256(nullunless--hash),genomes,c,k,screen_c(nullfor a plain.syldb) andtwo_stage. No filesystem paths are exposed:/infois public and names files, never directories (the full paths are in the server log). A plain.syldbreports the smallestcof its genomes (genomes may differ inc; a sample must be sparser than all of them). Genomes that differ inkare refused at startup. This is the pooled view of a multi-database server:nameis the database names (the--db NAME=PATHalias, else the file name) joined with", ",sizeandgenomesthe sums,cthe smallestc(sketch samples with it),kthe commonk,sha256nullfor more than one database, andscreen_c/two_stageonly when every database agrees (null/falseotherwise). A single-database server reports exactly what it always did;databases: one object per database, always present (a single entry on a single-database server):name(alias or file name),file(the file name, sincenamemay be an alias),kind(two-stagefor a.syl2db,plainfor a.syldb),size,sha256,genomes,c,k,screen_c,two_stageandgtdb(truewhen any of a sample of up to 100 genome names, spread evenly over the database, is a GTDB accession of the metadata file. It istruefor a GTDB database and also for GlobDB, whoseGCA_/GCF_names are GTDB accessions with or without the assembly version: it means "the genome names are GTDB accessions", not "this is GTDB's database". A fungi or UHGV server that has GTDB metadata only for taxonomy lookups reportsfalse). Results carry no per-database field: a hit belongs to the database whose taxonomy it has. Each entry also haslicence:{"name": "CC BY-SA 4.0", "url": "https://creativecommons.org/licenses/by-sa/4.0/"}ornull. It comes from the catalogue ofsylphd download, matched on the file name (not the--dbalias), and is known for the GTDB and GlobDB files (both CC BY-SA 4.0). It isnullfor every other file (UHGV, RefSeq fungi, your own databases):nullmeans "not known", not "unrestricted";metadata:file(the base name of the SQLite file),size,columns,rows,release,built,format_version,reps_onlyandsources, ornullwithout--meta. It also carriestaxonomy_sources— one object per source withname,kind(metadatafor the virtual GTDB source, elsesylphtax),origin(the catalogue URL it was downloaded from, or the base name of a local file — never a local path),md5,keys,has_host, and thencbicounts of a--taxonomy-dbbuild and itsncbi_nearestcounts (keyswithout an NCBI record,assignednearest taxa,informalof those that are an informally named species,ranksper raw rank) —taxonomy_overlaps— the pairs of sources that share keys, each pair once, in setup order:{"sources": [a, b], "keys": n, "examples": [...]}, wherebis the later-imported source and wins for those keys — andsylphtax_rules(the sylph-tax version whose rules apply).examplesholds up to five shared keys.taxonomieslists every taxonomy/profiletaxprofaccepts with this file:gtdb/ncbiwhen their column exists, thentaxand onetax:<source>per taxonomy source (seetaxprof). Itscolumnsalso list the fourtax_*columns, whichfieldscan then select, and on a file built with--taxonomy-dbthe eightncbi_nearest_*columns: the nearest NCBI taxon and, where it is only informally named, the nearest ancestor NCBI names formally;nameandabout, only when the operator set them (the keys are absent otherwise):nameis the string of--name(at most 80 characters, one line);aboutis{"format": "markdown", "text": "..."}with the contents of the--aboutfile (UTF-8, at most 16 KiB, surrounding whitespace removed). The server re-reads the file when it changes.formatnames howtextis to be rendered and leaves room for other formats; today it is alwaysmarkdown. The web page renders a safe subset (marked + DOMPurify, never HTML), see Describing your instance. Clients must treattextas untrusted;limits:max_jobs,max_upload_mb,max_sketches,max_contigs(the largest/contigsbatch,--max-contigs, 4096 by default; a whole/contigsrequest is one job),max_params_bytes(the largest non-file form field, i.e. how large the JSONparamsof one request may grow),allow_sequences,max_sequence_mb(nullunless sequences are allowed),rate_limit({"count", "window_seconds"}ornull) andmax_queue(nullmeans unlimited);usage:{"enabled": false}, or with--usage-db{"enabled": true, "policy": 1, "window_minutes": 10}.policyis an integer that is raised whenever what the statistics track changes; the web page asks its visitor to agree again when it rises. SeeGET /usage;taxonomy:{"enabled": false}, or with--taxonomy-db{"enabled": true, "mount": "/taxonomy", "api_version", "taxonomies", "rate_limit"}:api_versionis omnitax's, andtaxonomieslists what the file holds, one object per taxonomy withlabel(ncbi:2026-11-26,gtdb:232),kind,version,nodes,links,built(when it was added to the file) andfuzzy; see/taxonomy. This section is informational: sylphd'sapi_versiondoes not cover it (omnitax's own covers/taxonomy). The list ofendpointshas/taxonomy/...then;access:{"token_required": bool}(--require-token), plus"token_valid": boolwhen the request carriedAuthorization: Bearer ...; see Access tokens;endpoints: the endpoint paths this server serves (/usageonly when it is on;/messagesis listed by servers that have it);params: the keys each POST endpoint accepts, so a client does not have to probe with 400s:{"/profile": [...], "/query": [...], "/contigs": [...], "/assembly": [...]}. The lists are derived from the validators:/queryand/profilelist theProfileParamsfields plusnames,fields,modeandtax_sources, and/profileaddstaxprof;/contigslists itsparamskeys (includingcontigs);/assemblylists its query-string parameters.
GET /messages¶
The operator's messages, for clients to show. The answer is {"messages": [...]}, an empty list
when the server was started without --messages. Each message has four fields:
| Field | Meaning |
|---|---|
level |
info, warning or danger |
title |
one line of text, at most 120 characters |
message |
Markdown, at most 2000 characters; treat it as untrusted like about (the web page renders it with the same sanitising) |
plain |
single-line plain text derived from message (Markdown links expanded as text (url), emphasis stripped, whitespace collapsed), for terminals and other non-Markdown clients |
There are no ids or dates: a client recognises a message by its content (the web page remembers
a dismissed info or warning message by a hash of level, title and message, so changed text
shows again). The server re-reads the file when it changes. /messages is open and not
rate-limited like /info, and also answered when --require-token is on. A server older than this
endpoint answers 404; clients must treat that as "no messages". The web page reads it when it
connects to a server, and sylphd profile, query and assembly print the warning and
danger messages on stderr, see Operator messages.
GET /usage¶
Aggregated usage statistics; 404 unless the server runs with
--usage-db, in which case /info says so
(usage.enabled). Public, like /info, covered by --rate-limit, served with CORS like the
other endpoints, cached in memory for about a minute and not counted itself. The numbers come from
the database the server flushes about once a minute, so they trail reality by that much.
What is counted: each successful (2xx) request to /assembly, /contigs, /profile or
/query. Failed or rejected requests, /health, /info and /usage are not. A row is keyed by
the start of its ten-minute window (UTC), the endpoint, the client kind and the client
version:
| client | when | version |
|---|---|---|
web |
the request has an Origin header (a browser) |
empty |
cli |
the User-Agent is sylphd/<version> (what sylphd sends) |
the version if it is a plain x.y.z, else empty |
other |
anything else | empty |
Each row adds up requests, contigs (contigs classified), samples (sketches profiled; an
/assembly upload is one), bases (as reported by the client: the length of a sketch upload,
the sum of the contig lengths of /contigs, the parsed length of a raw upload; 0 for
/profile and /query, which carry no length) and sketch_bytes (the sketches received), and
keeps the maximum peak_queue_depth (jobs beyond --max-jobs when a job asked for its slot).
Each job's time in its slot and its wait for the slot also go into a fixed-bucket histogram per
row (bucket_bounds_seconds, plus one bucket above the last bound). A /profile or /query request has one job per
sample, /assembly and /contigs one per request. Windows with no activity have no row. Windows
older than 92 days are merged into monthly rows once a day; sums, maxima and histograms merge
exactly. Never stored or served: IP addresses or hashes of them, unique-visitor counts, sample,
file or contig names, results, taxa, no-hit shares, parameters, anything per user.
{
"policy": 1, "window_minutes": 10,
"generated_at": "2026-10-30T18:04:18Z", "since": "2026-07-01T00:00Z",
"bucket_bounds_seconds": [0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1.0, 2.5, 5.0, 10.0, 30.0, 60.0, 300.0, 3600.0],
"totals": {"requests": 1788, "contigs": 13519, "samples": 1788, "bases": 6123000000,
"sketch_bytes": 963412488, "peak_queue_depth": 3,
"job_seconds": {"count": 1788, "median": 1.0, "p95": 30.0},
"queue_wait_seconds": {"count": 1788, "median": 0.025, "p95": 5.0}},
"by_endpoint": {"/assembly": {"requests": 726, "...": "..."}},
"by_client": {"cli": {"requests": 900, "...": "..."}},
"windows": {"columns": ["start", "endpoint", "client", "version", "requests", "contigs",
"samples", "bases", "sketch_bytes", "peak_queue_depth"],
"rows": [["2026-10-30T17:50Z", "/assembly", "cli", "0.3.1", 2, 0, 2, 1160152, 68200, 0]]},
"months": [{"month": "2026-07", "endpoint": "/query", "client": "cli", "version": "0.3.0",
"requests": 31, "contigs": 0, "samples": 31, "bases": 0, "sketch_bytes": 912004,
"peak_queue_depth": 1, "job_histogram": [0, 0, 3, 18, "..."],
"queue_wait_histogram": [30, 1, "..."]}]
}
totals, and each member ofby_endpointandby_client, have the same shape;job_secondsandqueue_wait_secondsgive the number of jobs and the median and 95th percentile, read from the histograms as the upper bound of the bucket that holds them (so they are upper bounds, andnullwithout jobs).windowsholds the retained ten-minute rows in a compact columnar form (histograms are only in the totals and inmonths, to keep the response small);monthsthe monthly rows, kept for good, with their histograms.sinceis the start of the oldest row,nullwhen nothing was recorded yet.
POST /query and POST /profile¶
The body is multipart/form-data:
- one
sketchfile part per sample, holding the raw bytes of apysylph.SampleSketch(the contents of a.sylspfile); - an optional
paramsfield with a JSON object.
At most 4096 sketches fit in one request. Non-file form fields such as params may be at most
1 MiB, and at most 16 of them are accepted.
params key |
Meaning |
|---|---|
minimum_ani |
minimum adjusted ANI, 0-100; null or omitted uses sylph's default |
seq_id |
read sequence identity in percent, 0-100 |
estimate_unknown |
boolean; Sequence_abundance is then a share of all reads, so 100 minus its sum is the estimated share in no database. A sketch without read statistics (made from contigs) gets null for Eff_cov and both abundances (sylph's inf/NaN) |
estimate_read_counts |
boolean, profile only; Sequence_abundance then holds estimated read counts (sylph's experimental option) and implies estimate_unknown |
min_number_kmers |
integer >= 0 (default 10) |
min_contain |
integer >= 0 (default 7) |
screen_ani |
0-100 (default 85) |
no_adjust |
boolean, report the naive ANI |
names |
list with one name per sketch (defaults to the part file names, else sample-N) |
fields |
list of metadata columns; omitted means all, [] means none; needs a metadata database. Any requested field whose name collides with a fixed column of the response table (accession, genome_id, Sample_file, Lambda_status, ...) is a 400 |
tax_sources |
list of taxonomy source names: resolve hits against these sources only (default: all of them; an empty list is the same). Unknown names, or a server without sylph-tax sources, are a 400 |
taxprof |
profile only: taxonomies to aggregate on the server, from gtdb, ncbi, tax and tax:<source> (listed in /info metadata.taxonomies). Validated against the metadata file's columns and sylph-tax sources (a 400 names what is missing). The response document then carries taxprof[sample_name][taxonomy] (see below) |
mode |
optional, must match the endpoint (query or profile) |
samples |
optional list with one object per sketch, in request order: {"name": "...", "reads": 1000, "bases": 150000}. reads (a read pair counts once) and bases are what the client counted while sketching; each is a non-negative integer or null/omitted when unknown (a pre-made .sylsp has no read counts). They only come back in the response samples; a bad value, another key or a wrong length is a 400 |
Unknown keys are rejected with a 400. The client sketches with database.c and database.k from
GET /info. A sketch must match k exactly and must not be sparser than the database
(c <= db.c); otherwise the request fails with a 400. A larger c means a sparser sketch, so a
sketch with c=250 is refused by a database with c=200; a sketch with c=100 is accepted (it is
denser, and sylph samples down while profiling). On a server with several databases, k must
match all of them and c must not exceed the smallest c; the 400 names the database(s) that
cause the refusal, for example sketch c=250 is sparser than the c=200 of uhgv. The same 400
covers a sketch that pysylph itself refuses to profile against the database, for example one
sparser than a genome of a database whose genomes have different c: the response carries
pysylph's message, not a generic 500. POST /query and POST /profile run against the whole pool, i.e.
sylph query db1 db2 ... / sylph profile db1 db2 ....
The response is a single JSON document covering all samples in request order:
{"api_version": 1,
"params": {"minimum_ani": null, "seq_id": null, "estimate_unknown": false,
"estimate_read_counts": false, "min_number_kmers": 10,
"min_contain": 7, "screen_ani": 85.0, "no_adjust": false},
"samples": [{"name": "sample-a", "kmers": 25621, "mean_read_length": 150.0, "paired": false,
"reads": 1000, "bases": 150000},
{"name": "sample-b", "kmers": 31002, "mean_read_length": 148.7, "paired": true,
"reads": null, "bases": null}],
"table": {
"columns": ["Sample_file", "Genome_file", "Taxonomic_abundance", "Sequence_abundance",
"Adjusted_ANI", "Eff_cov", "ANI_5-95_percentile", "Eff_lambda",
"Lambda_5-95_percentile", "Median_cov", "Mean_cov_geq1", "Containment_ind",
"Naive_ANI", "kmers_reassigned", "Contig_name", "Lambda_status",
"accession", "genome_id", "gtdb_taxonomy"],
"data": [
["sample-a", "GCA_000005845.2_genomic.fna.gz", 100.0, 100.0,
99.79, 1.187, [99.64, 99.95], 0.36,
[0.34, 0.38], 1.0, 1.187, [6208, 21899],
96.02, 0, "NC_000913.3", "OK",
"GCA_000005845.2", "GCA_000005845.2", "d__Bacteria;..."]
]
},
"caveats": []}
api_versionis the integer wire-protocol version (same as inGET /info).paramsechoes the effective profiling parameters, defaults included, as provenance.sampleshas one entry per sample sent, in request order, so a sample without hits is distinguishable from one that was never sent:name;kmers(distinct k-mers of the uploaded sketch),mean_read_lengthandpaired(from the sketch header); andreadsandbases, the values the client sent inparams.samples(nullwhen it did not). An entry with no hits and few k-mers explains an empty result, e.g. one mate of a pair alone.tableholds every hit of every sample in one standard table ({"columns": [...], "data": [[...], ...]}, pandas'orient="split"layout without an index;pd.DataFrame(**doc["table"])loads it directly). Every row carries itsSample_file.columnsis the final ordered header:Taxonomic_abundance,Sequence_abundanceandkmers_reassignedappear only for/profile; withestimate_unknownorestimate_read_counts, the actual column name isTrue_cov(notEff_cov); withestimate_read_counts,Sequence_abundanceholds the estimated number of reads per genome (a rounded float) instead of a relative abundance.Lambda_statusappears as a separate column immediately beforeaccession, whichgenome_idfollows (the stable identifier of the database genome: the accession of a GTDB hit, the taxon key of a hit a non-GTDB source resolved, else the first word ofContig_name, elseGenome_file), keepingEff_lambdanumeric (ornullwhen not estimable): this is the only column difference between the JSON table and the TSV header. Selected metadata columns followgenome_idin request or metadata order.caveatsis a list of distinct species-threshold warning strings for non-GTDB taxonomy sources present among the hits (empty for GTDB-only hits or without metadata).- Missing or non-finite values are JSON
null(Eff_lambdawhenLambda_statusisHIGHorLOW, missing confidence intervals, andTrue_cov/abundances of a sketch without read statistics underestimate_unknown). Interval columns (ANI_5-95_percentile,Lambda_5-95_percentile,Containment_ind) stay two-element arrays. TSV renderers formatnullas sylph does (HIGH/LOWfromLambda_status,NA-NA,inf,NaN) and capAdjusted_ANIat 100 while JSON keeps the unrounded/uncapped value. Withno_adjust,Adjusted_ANIis the naive containment ANI whileANI_5-95_percentileis still sylph's interval of the adjusted estimate (as in stock sylph's--no-adjust), so it can lie away fromAdjusted_ANI; it isnullonly when sylph computes no interval.
With sylph-tax taxonomy sources (see the metadata reference), every row has four more columns, and
they are listed in metadata.columns so fields can select them:
| Column | Meaning |
|---|---|
tax_source |
name of the taxonomy source whose lineage was used (the largest ord that has the hit's key), or null |
tax_key |
the key sylph-tax matched (verbatim: an accession, a file name, a contig id, ...), or null |
tax_lineage |
the source's lineage string, opaque (vFAM-…;vOTU-…, d__…;s__…), or null for a hit without any taxonomy |
tax_host |
the virus host of that key, from the largest ord whose source has one, or null |
The server resolves them with sylph-tax's own probe rules over the hit's Genome_file and
Contig_name (see the metadata reference), so query and
profile rows carry them too. /assembly hits carry the same four fields.
Server-side taxonomic profiles (taxprof)¶
With "taxprof": ["gtdb", "ncbi", "tax"] the server aggregates each sample's hits once and adds a
top-level taxprof object keyed by sample name and taxonomy. It returns the structured clades
and the rendered .sylphmpa text, so clients neither aggregate nor format:
"taxprof": {
"sample-a": {
"gtdb": {
"columns": ["clade_name", "relative_abundance", "sequence_abundance",
"ANI (if strain-level)", "Coverage (if strain-level)"],
"taxonomies_used": ["gtdb"],
"clades": [
{"clade_name": "d__Bacteria", "relative_abundance": 100.0,
"sequence_abundance": 100.0, "ani": null, "coverage": null},
{"clade_name": "d__Bacteria|...|t__GCA_000005845.2", "relative_abundance": 100.0,
"sequence_abundance": 100.0, "ani": 99.79, "coverage": 1.234}
],
"sylphmpa": "#SampleID\tsample-a\tTaxonomies_used:['gtdb']\nclade_name\t..."
}
}
}
clades is the cumulative lineage table (clade_name joins the levels with |; only strain rows
carry ani/coverage), ordered as sylph-tax taxprof orders the file. The tax profile is equivalent to sylph-tax v1.9.2's on the same sylph run: the same clades, values equal within the TSV's rounding (sylphd works at full precision, sylph-tax sums sylph's rounded TSV), and clades with equal values may be ordered differently. Check with sylphd diff. sylphmpa is
that file, newline-terminated. For tax, taxonomies_used lists the source names
the profile was resolved against (tax_sources, in ord order). gtdb/ncbi come from the
metadata columns of the same name; tax needs a metadata file with sylph-tax sources. The
server fetches the taxonomy columns needed for aggregation internally even when fields hides
them from table. taxprof is /profile only (/query rejects it), and one requested taxonomy the metadata
file cannot provide is a 400.
In ncbi, a hit with no NCBI lineage of its own that the metadata file gave a nearest NCBI taxon
(ncbi_nearest_lineage) is placed at that raw node, its strain directly below it, and the strain's
clade object carries "nearest": {"taxid": …, "rank": …, "name": …, "clade": "g__Thiobacillus"}.
The ncbi_nearest_formal_* columns say which ancestor NCBI names formally when the raw node is an
informally named species; the profile places the hit at the raw node either way.
A metadata file without nearest taxa profiles exactly as before.
tax:<source> (for example tax:UHGV_default) is one taxonomy source alone, following
sylph-tax taxprof -t <source>: the hits are resolved against that source only, so the hits of
other sources are NO_TAXONOMY, and a key that a later source overrides in tax keeps this
source's lineage. taxonomies_used is [source]. Its payload adds the source's ranks, read
from the lineage tokens (s__Name is rank s, vOTU-052719 is rank vOTU) and ordered from the
root as the lineages order them, and every clade a rank (that of its last token; null for
strains, NO_TAXONOMY and UNKNOWN). Lineages may skip ranks (a vOTU without a vGENUS), so a
client picks a rank's clades by rank, not by depth:
"tax:UHGV_default": {
"taxonomies_used": ["UHGV_default"],
"ranks": ["vFAM", "vSUBFAM", "vGENUS", "vSUBGEN", "vOTU"],
"clades": [{"clade_name": "vFAM-00009|vSUBFAM-00023|vOTU-166116", "rank": "vOTU", ...}, ...],
...
}
POST /assembly¶
Finds the closest database genomes of one assembly. The body is either
-
a sketch of the assembly: the raw bytes of a
pysylph.SampleSketch(a.sylspfile), withThis is always available, with or without
--allow-sequences: the server never sees a sequence. The web app (in the browser) andsylphd assembly(on the command line) send this. The sketch is made with the database'scandk(/inforeports them), as one single-end sample whose "reads" are the assembly's records. It is validated like the sketches of/profile(header check before decoding,kmust equal the database's,cmust not exceed the database's), and bounded by the general--max-upload-mb, not by--max-sequence-mb; or -
raw FASTA or FASTQ, plain or gzip, which the server sketches itself. Only with
--allow-sequences, otherwise a404whose message says so. The gzip magic bytes (\x1f\x8b) select decompression (concatenated gzip members are read in turn; a truncated stream is a400); theContent-Typeheader is otherwise informational, but must be one of:(a missing
Content-Typeis accepted). All records of the body form one sample. Only the basesA C G T Nare allowed.
Any other Content-Type is a 415. limits.allow_sequences in GET /info says whether raw
sequences are accepted.
| Query parameter | Meaning |
|---|---|
top |
number of hits, 1-50 (default 10) |
min_ani |
minimum ANI in percent, 70-100 (default 80) |
name |
query name (default assembly, at most 1024 characters) |
records, length, gc |
sketch uploads only, optional: number of records (integer), total length in bases (integer) and GC percent (0-100) of the assembly, as counted by the client. Purely informational: they are validated and echoed in query, never used for the search. Ignored for raw sequences, which the server counts itself |
Both bodies get exactly the same treatment from then on: the server profiles the sketch with
no_adjust=True and keeps the top hits sorted by ANI. The same assembly gives the same hits,
assignment and closest hit whichever way it is sent. /assembly queries the whole pool, so a hit
list may mix databases. A hit resolved by a sylph-tax taxonomy source of a format 3 metadata file
carries tax_lineage/tax_source and is classified from that lineage: taxonomy and
taxonomy_source are added to the hit and to assignment/closest (GTDB's
d__..;s__, fungal k__Eukaryota;.., ICTV root;.., UHGV vFAM-..;vOTU-.., see
hit relations). A hit without any lineage stays unknown lineage.
{"api_version": 1,
"query": {"name": "assembly", "records": 1, "length": 6013491,
"gc": 50.76, "sketch_kmers": 200, "input": "sequence"},
"database": {"name": "gtdb-r232-c200-dbv2.syl2db", "genomes": 199937,
"c": 200, "k": 31},
"params": {"top": 10, "min_ani": 80.0},
"thresholds": {"species": 95.0, "imprecise_below": 85.0},
"assignment": {"rank": "species", "taxon": "Escherichia coli",
"gtdb_taxonomy": "d__Bacteria;...;s__Escherichia coli",
"accession": "GCF_000005845.2", "ani": 98.65,
"taxonomy": {"domain": "Bacteria", "...": "...", "species": "Escherichia coli"},
"taxonomy_source": "GTDB_r232"},
"closest": {"rank": "species", "taxon": "Escherichia coli",
"gtdb_taxonomy": "d__Bacteria;...;s__Escherichia coli",
"accession": "GCF_000005845.2", "ani": 98.65, "taxonomy": {"...": "..."},
"taxonomy_source": "GTDB_r232"},
"elapsed_ms": 412.7,
"table": {
"columns": ["rank", "ani", "relation", "shared_rank", "accession", "genome_id",
"taxon", "gtdb_species", "taxonomy_source", "ncbi_organism_name", "ncbi_taxid",
"containment", "containment_fraction", "ani_species_level", "genome_file",
"taxonomy", "gtdb_taxonomy", "..."],
"data": [
[1, 98.65, "same species", "species", "GCF_000005845.2", "GCF_000005845.2",
"Escherichia coli", "Escherichia coli", "GTDB_r232", "Escherichia coli K-12", 511145,
[7096, 10826], 0.655, true, "/db/GCA_000005845.2_genomic.fna.gz",
{"domain": "Bacteria", "...": "...", "species": "Escherichia coli"},
"d__Bacteria;...;s__Escherichia coli", "..."]
]
}}
api_versionis the integer wire-protocol version (same as inGET /info).tableholds the hits in the standardorient="split"format ({"columns": [...], "data": [[...], ...]}). The leading 11 columns match the CLI's hits TSV (rank,ani,relation,shared_rank,accession,genome_id,taxon,gtdb_species,taxonomy_source,ncbi_organism_name,ncbi_taxid), where the server computestaxon(the last named rank of the hit's lineage, ornull) andgtdb_species(the GTDBs__name, ornull). Next comecontainment,containment_fraction,ani_species_level,genome_file,taxonomy, and every remaining metadata column of the server's metadata database (withnullfor missing values; a server without--metakeeps the full standard metadata column list withnullcells so the shape is stable).databaseis the pooled view (seeGET /info); the response has nodatabaseskey, addGET /infowhen a client needs the per-database list.query.inputis"sequence"or"sketch", how the assembly arrived. For a sketch,query.records,lengthandgcare the values of the optional query parameters, ornullwhen the client did not send them (the server cannot know them);sketch_kmersis read from the sketch.aniis the naive containment ANI (no_adjust=True). There is no confidence interval: the coverage-adjusted ANI is meaningless for assemblies, see Identifying an assembly.containmentis[contained k-mers, genome k-mers]: how many of the hit genome's sketched k-mers occur in the assembly, and how many k-mers that genome's sketch holds (sylph'sContainment_ind).containment_fractionis their ratio.assignmentis the species assignment:{"rank": "species", "taxon", "gtdb_taxonomy", "accession", "ani", "taxonomy", "taxonomy_source"}when the best hit reachesthresholds.species(95 %), otherwisenull.taxonandgtdb_taxonomyarenullwithout metadata;taxonis the last named rank of the hit's lineage (GTDB's species, a UHGV vOTU, a fungal species).taxonomyis the lineage as{rank: taxon}, shallowest first —{"domain": "Bacteria", ..., "species": "Escherichia coli"}or{"level 1": "vFAM-00013", ..., "level 5": "vOTU-052719"}— andtaxonomy_sourcethe source that named it (GTDB_r232,UHGV_default, ...). Onassignment/closestboth keys are absent when the hit has no lineage; intabletheir cells arenull.note(onassignment, or onclosestwhen there is no assignment) explains what 95 % ANI means for a best hit that is not from GTDB: the vOTU convention for viruses (whose aligned fraction sylph's ANI ignores), a heuristic for fungi, a generic text for other sources. It is absent for GTDB and for a hit without a lineage.closesthas the same shape for the best hit, ornullwithout hits.genome_idis the identifier to show for a hit: theaccessionfor a GTDB hit (or any hit that carries one), thetax_keyfor a hit a non-GTDB taxonomy source resolved, else the first token ofContig_name, elsegenome_file. It exists because a genome file is not always an identifier: UHGV stores every genome invotus_full.fna.gz.thresholds.imprecise_below(85) is only a hint that k-mer ANI below it is imprecise. It never changes an assignment.- Uploads are never logged.
Raw sequence with curl¶
Any language can call the endpoint without pysylph or WebAssembly: post the FASTA (or FASTQ) file as
the request body and put the parameters in the query string. Use --data-binary, which sends the
file unchanged; plain -d would strip newlines.
curl --data-binary @assembly.fasta -H 'Content-Type: text/plain' \
'https://sylphd.abrinca.com/assembly?top=5&min_ani=85&name=my-assembly'
# a gzip file is sent as it is
curl --data-binary @assembly.fasta.gz -H 'Content-Type: application/gzip' \
'https://sylphd.abrinca.com/assembly?top=5'
The response is the JSON document above. This needs a server started with --allow-sequences; the
public instance (https://sylphd.abrinca.com, the one the web page uses) has it, and limits in
GET /info tells you for any other server. The sequence then reaches the server, which sketches it
in memory; if that is not acceptable, sketch locally instead. The public
instance limits each client to 10 POST requests per minute and the body to --max-sequence-mb (20 MB by
default, before decompression); over the rate limit you get a 429 with Retry-After (see
Errors). See the terms for what counts as light use.
Hit relations¶
relation is the human label and shared_rank its machine form. They come from the hit's
lineage, not from the ANI. Lineages are parsed generically: rank prefixes d domain,
r realm, k kingdom, p phylum, c class, o order, f family, g genus, s species,
t strain; a prefix-less lineage (UHGV's vFAM-..;vOTU-.., ICTV's root;Monodnaviria;..) is
read as level 1 ... level N, with a leading root dropped. shared_rank is the deepest rank a
hit shares with the reference lineage (species ... domain, realm, kingdom, strain,
level N, or null); a rank only counts when all shallower ranks agree. The reference is the best
hit's lineage.
Relations are computed within one taxonomy source only. A hit from another source has no
comparable ranks, so it gets different source (or different source from closest relative) and
shared_rank: null. GTDB hits always compare with each other, whatever tax_source resolved them;
a hit whose lineage shares nothing with a non-GTDB reference is different lineage.
| Situation | relation of the hit |
|---|---|
| assigned, shares rank R with the assigned species | same species, same genus, same family, same order, same class, same phylum, same domain, same level 4, ... |
| assigned, shares nothing | different domain (GTDB) or different lineage |
| a hit of another taxonomy source | different source |
| not assigned, the best hit | closest relative (shared_rank is null) |
| not assigned, other hits, sharing rank R with the best hit | same genus as closest relative, ... |
| not assigned, sharing nothing with the best hit | different domain from closest relative or different lineage from closest relative |
| not assigned, a hit of another source | different source from closest relative |
| a hit without lineage next to classified hits | unknown lineage |
| no metadata at all (ANI only) | same species for ani >= 95, else related |
A hit in the same species as the assignment is same species whatever its ANI.
ani_species_level is ani >= 95 for every hit: a hit that has it but a different species name (a
species boundary case) gets the lineage relation, for example same genus, plus
ani_species_level: true. The 95 % threshold is a prokaryote convention and applies to every
source for now; the note above says so where it is a heuristic, and --per-contig and the tax
profile print the same caveat once on stderr.
POST /contigs¶
Classifies the contigs of one fragmented assembly: one result per contig with the
contig-relative ANI of its hits, the species assignment, and the taxonomic consensus. This is what
sylphd assembly FILE --per-contig uses; the ANI, the ranking, the classification and the consensus
are computed on the server, so every client gets the same answer.
The body is multipart/form-data:
- one
sketchfile part per contig: the contig sketched as a single-end sample with the database'scandk(exactly the bytesPOST /querytakes, a.sylspfile's contents); - a
paramsfield with a JSON object:
{"contigs": [{"name": "contig1", "contig_kmers": 84, "length": 20000, "gc": 51.2}],
"top": 1, "min_ani": 80.0, "consensus_ratio": 1.5, "consensus_z": 2.0,
"fields": [], "tax_sources": null}
params key |
Meaning |
|---|---|
contigs |
required, one object per sketch part in the same order: name (a valid sample name, unique in the request), contig_kmers, length, gc |
contig_kmers |
the record's genome-style k-mer count, a positive integer no larger than length - k + 1. It is the denominator of the contig-relative ANI: sketch the record with pysylph.Sketcher(c, k).sketch_genome(...) and count its k-mers. It is not the sketch's k-mer count (a sample sketch keeps duplicates and skips the minimum-spacing filter) |
length, gc |
the record's length in bases (1 to 1e13) and GC percent (0-100); informational, echoed in the result and used for the per-request summary |
top |
hits per contig, 1-50 (default 1) |
min_ani |
minimum contig-relative ANI in percent, 70-100 (default 80); a contig whose best hit is below it is no_hit |
consensus_ratio |
the close-band ratio R of the consensus rule, >= 1 (default 1.5) |
consensus_z |
the noise allowance Z of the consensus rule, >= 0 (default 2) |
fields |
metadata columns appended to table; omitted means all, [] means none; needs a metadata database. Any requested field whose name collides with a fixed column of the table (gc, taxon, accession, ...) is a 400 |
tax_sources |
like /query: resolve hits against these taxonomy sources only |
Unknown keys are a 400. A whole request is one job, whatever its number of contigs: its
contigs are queried one after the other inside that single job slot, so --max-jobs and
--max-queue bound concurrent requests (a second request beyond the capacity is refused whole
with 503), and --rate-limit sees one request. The per-request bound is
limits.max_contigs (--max-contigs, 4096 by default; a public server should set 100, because a
contig on a server with plain databases costs ~0.5-0.6 s and the whole request is one job). Each
sketch is validated like a /query
sketch (k must match, c must not be sparser than the database's), and the whole request is
refused with a 400 if any entry is invalid (a count that does not match the sketch parts, a
contig_kmers no sequence of that length can have, a duplicate name, ...).
The response is a JSON document holding a flat per-hit table, per-contig metadata and summaries
keyed by contig name in contigs (in request order), and a per-request summary:
{"api_version": 1,
"params": {"top": 1, "min_ani": 80.0, "consensus_ratio": 1.5, "consensus_z": 2.0, "fields": []},
"table": {
"columns": ["contig", "contig_length", "gc", "status", "rank", "ani",
"shared_kmers", "contig_kmers", "explained_fraction", "reference_ani",
"relation", "shared_rank", "ani_species_level", "accession", "genome_id",
"gtdb_species", "taxon", "n_close", "consensus_rank", "consensus_taxon"],
"data": [
["contig1", 20000, 51.2, "ok", 1, 99.12,
78, 84, 0.9286, 96.16,
"same species", "species", true, "GCA_...", "GCA_...",
"Escherichia coli", "Escherichia coli", 2, "family", "Enterobacteriaceae"],
["contig2", 15000, 48.0, "no_hit", null, null,
null, null, null, null,
null, null, null, null, null,
null, null, null, null, null]
]
},
"contigs": {
"contig1": {"length": 20000, "gc": 51.2, "sketch_kmers": 95, "contig_kmers": 84,
"status": "ok",
"assignment": {"rank": "species", "taxon": "...", "accession": "...", "ani": 99.12},
"closest": {"...": "..."},
"consensus": {"rank": "family", "taxon": "Enterobacteriaceae",
"n_close": 2, "species": ["...", "..."]}},
"contig2": {"length": 15000, "gc": 48.0, "sketch_kmers": 80, "contig_kmers": 72,
"status": "no_hit",
"assignment": null, "closest": null, "consensus": null}
},
"summary": {"contigs": 2, "bp": 35000, "queried_contigs": 2, "queried_bp": 35000,
"too_few_kmers_contigs": 0, "too_few_kmers_bp": 0, "no_hit_contigs": 1,
"consensus_bp": [{"rank": "family", "taxon": "Enterobacteriaceae",
"bp": 20000, "fraction": 0.5714},
{"rank": null, "taxon": "unassigned",
"bp": 15000, "fraction": 0.4286}]},
"caveats": [], "database": {"name": "...", "genomes": 199937, "c": 200, "k": 31},
"thresholds": {"species": 95.0, "imprecise_below": 85.0},
"elapsed_ms": 12.5}
api_versionis the integer wire-protocol version (same as inGET /info).tableholds the flat per-hit table inorient="split"format: the 20 fixed columns above plus any requestedfields, one row per hit. A contig without hits (no_hitortoo_few_kmers) appears as one row withnullin every hit, consensus, and metadata column.contigsmaps each contig name (in request order) to its measurements,status, optionalreason(fortoo_few_kmers),assignment,closest, andconsensus.statusisok(hits),no_hit(queried, nothing abovemin_ani) ortoo_few_kmers(the sketch holds fewer k-mers than sylph's floor of 10; such a contig is not queried, andreasonsays so).aniis the contig-relative ANI,100 * (shared / contig_kmers) ** (1/k), not sylph'sNaive_ANI.shared_kmersisContainment_ind[0](reference k-mers found in the contig),explained_fractionisshared / contig_kmers(clamped at 1), andreference_aniis sylph's genome-denominatorNaive_ANIin percent. An exact fragment scores exactly 100 %.- Ranking. Hits are ordered by the contig-relative ANI (equivalently by
shared, the likelihood order). Hits within the consensus close band of the best hit (the same rule the consensus uses:100 - ani <= R * (100 - ani_best) + Z * sqrt(sd_best^2 + sd^2)) and withexplained_fraction >= 0.95are statistically indistinguishable on the contig side and near-completely contained, so among them the reference with the fewest k-mers comes first — that is the highestreference_ani, the most parsimonious explanation of the contig. A public assembly that carries a contaminant contig (a lambda prophage in a bacterial genome, say) contains every k-mer of the contig, exactly like the much smaller true source; only the genome size separates them. The saturation condition keeps the rule to containment: atk=31,explained_fraction = 0.95is already ~99.83 % ANI, so a >= 95 % assignment can never be moved below the species threshold. Everything else keeps the evidence order. consensusis the lowest common rank of the species whose divergence is inside that band (the best hit included), ornullwithout hits.rank/taxonarenullwhen a close lineage is missing or when the close set spans two taxonomy sources; the latter also setsmixed_sources: true. Hits that merely contain the contig in a far larger genome are not dropped from the consensus, so a phage contig whose close set spans UHGV and GTDB genomes staysmixed_sources. The full rule, withn_closeand the species list, is insylphd assembly;consensususes every hit of the contig, whatevertopandmin_aniare.assignment/closesthave the shape ofPOST /assembly's, computed from the ranked hits.summarycovers the contigs of this request only:contigs/bpof everything sent,queried_contigs/queried_bpof those actually queried, thetoo_few_kmers_*counters, andconsensus_bp: every consensus taxon with its bases and its share of the queried bases (not truncated, so a client can merge the summaries of several requests and cut afterwards).caveatslists the distinct species-threshold notes of the request (viruses, fungi, other sources; seePOST /assembly).summary,caveatsanddatabaseare per request, so a client that splits a large assembly into several requests adds the counters and mergesconsensus_bpby(rank, taxon).
/taxonomy¶
Only on a server started with --taxonomy-db (/info says taxonomy.enabled).
The whole API of omnitax is mounted under /taxonomy: sylphd
adds nothing and takes nothing away, so any omnitax client works with the URL https://HOST/taxonomy
(omnitax --url, omnitax.connect(url=...); see NCBI taxonomy) and omnitax's
HTTP API reference describes the endpoints, with these
paths:
| Path | |
|---|---|
GET /taxonomy/taxonomies |
the taxonomies of the file (the same objects as /info, with names, aliases, genome sources and provenance), the api_version and max_batch |
POST /taxonomy/{taxonomy}/nodes, ancestors, children, names, search, by_name, links, links_under |
batched lookups; {taxonomy} is ncbi, gtdb:232, ... |
GET /taxonomy/{taxonomy}/meta, rank/{rank}, subtree, rows/{part} |
the taxonomy's tables, and its nodes, names, aliases and links streamed |
The calls are index lookups: they never wait for a job slot and are covered by --taxonomy-rate-limit
(every request under /taxonomy, GET and POST), not by --rate-limit. A token (privileged access)
skips the limit, and --require-token also covers /taxonomy. Errors are {"error": "..."} as everywhere:
400 for bad input, 404 for an unknown taxonomy or path, 413 over 1 MiB, 429 with Retry-After. An omnitax
client sends the token as a header (--header "Authorization: Bearer ...", headers=). Omnitax's own
api_version is the one in /info taxonomy.api_version and /taxonomy/taxonomies; its client refuses another.
Errors¶
Errors are JSON objects {"error": "..."} with a 4xx or 5xx status.
| Status | When |
|---|---|
400 |
bad parameters, invalid params JSON, unknown metadata columns, requested fields that collide with a fixed column of the response table (gc, taxon, accession, ...), a sketch with the wrong c or k, a malformed sketch, more than 4096 sketches in one request (or more than the server's max_contigs for /contigs); for /assembly an empty body, a malformed sketch (or one with the wrong c or k), invalid records/length/gc, malformed or non-ACGTN raw sequence, or a Content-Length that is not an integer; for /contigs a contigs list that does not match the sketch parts, a duplicate or unusable contig name, a contig_kmers that is not a positive integer or that no sequence of that length can have, or an out-of-range option |
401 |
--require-token and no valid token (WWW-Authenticate: Bearer) |
404 |
POST /assembly with raw sequences without --allow-sequences (sketches are always accepted); GET /usage without --usage-db |
413 |
the body exceeds --max-upload-mb, or for raw /assembly sequence the body exceeds --max-sequence-mb or its decompressed size exceeds five times that |
415 |
/query, /profile and /contigs without a multipart/form-data body, or /assembly with an unsupported Content-Type |
429 |
rate limited (--rate-limit, also for GET /usage; --taxonomy-rate-limit for /taxonomy); with Retry-After in seconds; a valid token skips it |
503 |
the job queue is full (--max-queue), or the request has more samples than fit in it; nothing was run; with Retry-After: 1 |
500 |
profiling failed inside the server |
Browser access¶
CORS is off unless --cors-origin is given; see
Running a public server. When enabled, GET and POST and the
Content-Type request header are allowed, and Retry-After and X-Request-Id are exposed to
JavaScript.