factordbrpc · fdbtest
Sign in
API
JSON-RPC 2.0 over HTTP — programmatic access to factordb

All calls are JSON-RPC 2.0 sent as an HTTP POST to /rpc. The body is a request object (or an array of them for a batch); the response mirrors it.

curl -s https://v3.factordb.com/rpc \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"get_number","params":{"target":{"expr":"2^131-1"},"detail":2}}'

Response: {"jsonrpc":"2.0","id":1,"result":{…}}, or {…,"error":{"code","message"}} on failure.

Command-line client

fdb wraps every method on this page as a subcommand — numbers and factors, proofs, certificates, sequences, statistics, downloads and your account — with human-readable output by default and the raw JSON result on request. It can also drive an aliquot sequence forward with local gmp-ecm, reporting the factors it finds (fdb seq advance).

fdb number 2^127-1 --full
fdb report 1427247692705959880439315947500961989719490561 2^61-1
fdb download C 60 --count 100 --random

Source: github.com/mtvb/factordb-cli (Rust, GPL-2.0; cargo install --path . builds the fdb binary).

Addressing (the target parameter)

Many calls take a target, which is either an id or an expression: {"id": 42}  or  {"expr": "10^80+7"}. Expressions accept + - * / ^ %, ! (factorial), #/## (primorial), I(n)/lucas(n), and parentheses.

Authentication

Anonymous access works for reads within the default limits. To act as your account — higher limits, certificate upload — send your API token:

X-Fdb-User-Token: <your token>

Get a token from login / register (or rotate it with regenerate_token).

Batching

POST an array of request objects to run several calls in one round-trip; the response is an array of results in the same order, each matched by id. Calls in a batch run sequentially.

Limits & accounting

Every response carries a X-Fdb-Resources: ids=…, time_ms=…, bytes=…, bg_ms=… header summing what the request consumed. Requests are rate-limited and quota-bounded per client (ids created, wall time, bandwidth, background-check time); exceeding a budget returns HTTP 429. See Limits and call quota_status for your current usage.

write calls modify the database; account calls manage your session. Everything else is read-only.

Numbers & factors

get_idwrite

Resolve an expression to a factordb id (optionally storing it).

expr string a number or expression, e.g. 2^131-1, 10^80+7, 150!
create bool if true, store it and its structure (a write); default false

{ id, status, digits, created, url }

get_number

Full record for a number: identity, status, size, and (with detail) factors, primality and sequence membership.

target id or expr see “Addressing” above
decimal bool include the full decimal value when small enough
detail int 0 = basic; ≥1 folds in factors/algebraic/sequence_of; ≥2 also folds in primality

{ id, status, digits, term, preview, decimal?, fully_factored, perfect_power, factors?, primality?, algebraic?, sequence_of? }

get_factors

The known factorization of a number.

target id or expr

{ id, status, fully_factored, factors: [ { base, exponent, status } ] }

primality

Primality state of a number and any certificate metadata.

target id or expr

{ status, digits, kind, base?, cert_size?, cert_digits?, cert_type?, cert_uploader? } (kind = direct / n-1 / n+1 / combined / certificate)

algebraic_factors

Algebraic factorization panel (e.g. difference/sum of powers, Aurifeuillian).

target id or expr

→ the algebraic decomposition of the expression, when one applies

get_family

Neighbouring numbers of the same family (e.g. x^n±1) around an expression.

expr string the family expression
start int first index (may be negative)
limit int how many to list

→ a list of family members with their ids/status

report_factorswrite

Submit one or more found factors of a number. Verified exactly (a wrong factor is rejected); promotes/creates rows as needed.

target id or expr
factors string[] decimal or expression factors, e.g. ["1009","2^32+1"]

{ id, status, created_ids }

Primality proofs (special-form)

provewrite

Run a deterministic special-form proof (Pocklington N−1 / Morrison N+1 / combined BLS75). Small numbers inline; large ones queue for the background prover.

target id or expr

{ proved, queued, method?, witness?, digits, promoted? } (method 1 = N−1, 2 = N+1, 3 = combined)

proof_progresswrite

Per-method completeness for a number and what each proof would cost/queue. May auto-create the N∓1 ids for a large PRP.

target id or expr

→ per-type completeness, thresholds, queued/est_ms and remaining background budget

proof_state

Poll a number’s proof state (after a large proof was queued).

target id or expr

{ status, digits, queued }

proof_list

List numbers proven prime by a special-form test.

type_id int 1 = N−1, 2 = N+1, 3 = combined; 0/other = all
min_digits int
descending bool largest first
skip int
limit int max 1000

{ proofs: [ { fid, digits, type, base, term } ] }

Probable-prime tests

prp_testwrite

Run a BPSW probable-prime test on an untested (U) number; settles it U→PRP or U→C. Large ones queue.

target id or expr

{ queued|tested, ... }

prp_test_info

Whether a number is PRP-testable and the cost a queued test would drain.

target id or expr

{ testable, est_ms, will_queue, check_remaining_ms }

Certificates

get_certificate

Download the stored primality certificate for a number (Primo / gmp-ECPP), if any.

target id or expr

→ the certificate text and its metadata

upload_certificatewrite

Upload a primality certificate for a number (PRP→P on verification).

data string the certificate text
session string your session/API token

{ ok, ... }

cert_list

List certificates (newest/largest first), optionally only those still pending verification.

min_digits int
pending bool only pending
descending bool
skip int
limit int

{ certs: [ ... ] }

cert_chain

The certificate dependency chain for a number (a cert that references smaller certified primes).

target id or expr

→ the ordered chain of certificates

cert_stats

Certificate totals.

No parameters.

{ total, verified, pending, processing }

Aliquot sequences

get_sequence

The terms of an aliquot sequence.

start int the sequence’s starting number
from int first iteration to return
kind int sequence type

→ the sequence terms from from onward

sequence_sizes

Digit size of each term (data for the growth graph).

start int
from int
kind int

→ digit-count per iteration

sequence_status

Status of a sequence (open / merged / cycle / terminated).

start int
kind int

→ the sequence’s current status and frontier

sequence_view

A window/segment of a sequence for display.

start int
kind int
part string all / last / range
fr int range start

→ a bounded view of the sequence

extend_sequencewrite

Compute and store more terms of a sequence.

start int
steps int how many iterations
kind int

→ the newly computed terms

list_sequences

Browse known sequences with sorting/filtering.

limit int
offset int
kind int
category int
end_kind string? open/merge/cycle/terminus
sort string?
dir string? asc/desc

→ a page of sequences

sequence_of

Which sequence a number belongs to.

target id or expr

→ the containing sequence’s start (if any)

Statistics & listings

status

The whole status page in one call: table counts, smallest unresolved numbers, comb-scan progress, and certificate / proof / ECM-factor stats.

No parameters.

→ a merged object; sub-sections may be null when their tables are absent

stats

Global counts per table (P / PRP / C / U / CF) and disk usage.

No parameters.

→ the count/size summary

smallest

The smallest unresolved number of each kind.

No parameters.

{ prp, c, u }

comb_progress

Progress of the small-factor (comb) scanner.

No parameters.

→ per-level scan progress

digit_distribution

Row counts per digit length across a range (data for the distribution chart).

start int first digit length
count int how many lengths

→ per-digit-length counts by table

factor_tables

Sizes of the storage tables (backs the Tables page).

No parameters.

→ row/byte sizes per table

list_by_type

List numbers of one table, smallest first.

table string P / PRP / C / U / CF
min_digits int
offset int
limit int

→ a page of numbers of that type

ecm_list

List factors found by ECM / P±1 (each validated by its curve group order).

type_id int 1 = ECM (Montgomery), 2 = P−1, 3 = P+1, 4 = ECM (Edwards); 0 = all
min_digits int
by_time bool order by discovery time
descending bool
skip int
limit int

{ factors: [ { fid, digits, b1, b2, sigma, type, ts, uid, submitter, term } ] }

Tools & downloads

ecm_group_order

Compute the elliptic-curve group order #E(F_p) for a GMP-ECM (param, sigma) over a prime, and factor it — showing the B1 at which ECM finds p. All four parametrizations.

number string a prime, ≤ 100 digits (expressions allowed)
param int 0 = Suyama, 1 = default, 2/3 = batch/GPU
sigma string the sigma value

{ ok, order, factors, cofactor?, largest_prime?, montgomery_a, weierstrass_a4 }

download

Pull a bounded batch of candidate numbers to work on (composites to factor, PRPs to certify, untested to test). Index-bounded and capped — light on the server.

table string C / PRP / U
digits int digit size (minimum, or exact with random)
count int max 50000
random bool random sample at exactly digits digits, else smallest first

{ count, numbers: [ string ] } (export format: term or decimal)

Account

loginaccount

Authenticate; returns a session/API token to use in X-Fdb-User-Token.

user string
pass string

{ ok, session?, error? }

registeraccount

Create an account.

user string login name
pass string
name string display name

{ ok, error? }

whoamiaccount

Identity for a session/API token.

session string

{ found, login, ... }

regenerate_tokenaccount

Issue a fresh API token (invalidates the old one).

session string

{ ok, session? }

logoutaccount

Invalidate a session/API token.

session string

{ ok }

quota_statusaccount

Your current resource usage against the limits (exempt from the quota block).

No parameters.

→ used vs cap for ids / wall-time / bandwidth / background-check-time

Utility

health

Liveness check.

No parameters.

{ ok: true }