Accounts: the long-lived record of one end user (or business) that
inquiries, verifications and reports attach to. Look an account up by
your own reference-id, read its consolidated fields, and merge
duplicates.
Functions
add-tag
fn (account-id: Str, tag-name: Str): Map
fn (account-id: Str, tag-name: Str, options: Map): Map
POST /accounts/{id}/add-tag - Add a tag by name.
Example
::persona::accounts/add-tag("act_123", "vip")
consolidate-accounts
fn (account-id: Str, source-account-ids: Vec<Str>): Map
fn (account-id: Str, source-account-ids: Vec<Str>, options: Map): Map
POST /accounts/{id}/consolidate - Merge source-account-ids into the
account account-id. Their inquiries, verifications and reports move
to the target (attributes don't), and each source is archived. A
source can be consolidated only once.
Example
::persona::accounts/consolidate-accounts("act_123", ["act_456", "act_789"])
create-account
fn (attributes: Map): Map
fn (attributes: Map, opts: Map): Map
fn (attributes: Map, opts: Map, options: Map): Map
POST /accounts - Create an account. attributes (all optional):
reference-id (your user id; a duplicate returns 409),
account-type-id (acttp_...), account-status, tags, fields
(template field keys and plain values; PII). opts.meta passes
request meta, e.g. {upsert-by: "reference-id"}.
Example
::persona::accounts/create-account({reference-id: "user-42", tags: ["beta"]})
find-by-reference-id
fn (reference-id: Str): Map?
fn (reference-id: Str, options: Map): Map?
The account (a resource, not a document) with this reference-id, or
null when there is none.
Example
account ::persona::accounts/find-by-reference-id("user-42")
if(is-null(account), "no account yet", account.id)
get-account
fn (account-id: Str): Map
fn (account-id: Str, opts: Map): Map
fn (account-id: Str, opts: Map, options: Map): Map
GET /accounts/{id} - Retrieve an account. opts takes include and
fields as in ::persona::inquiries/get-inquiry.
Example
account ::persona::accounts/get-account("act_123")
::persona::api/attr(account, "reference-id")
// Only the attributes you need
::persona::accounts/get-account("act_123", {fields: {account: ["reference-id", "tags"]}})
list-accounts
fn (filters: Map): Map
fn (filters: Map, opts: Map): Map
fn (filters: Map, opts: Map, options: Map): Map
GET /accounts - One page of accounts. The only filter is reference-id;
opts takes page-size, after, before.
Example
page ::persona::accounts/list-accounts({reference-id: "user-42"}, {page-size: 10})
map(page.data, %.id)
redact-account
fn (account-id: Str): Map
fn (account-id: Str, options: Map): Map
DELETE /accounts/{id} - Permanently remove the account's PII. Cannot be undone.
Example
::persona::accounts/redact-account("act_123")
update-account
fn (account-id: Str, attributes: Map): Map
fn (account-id: Str, attributes: Map, options: Map): Map
PATCH /accounts/{id} - Update reference-id, account-status, tags
or fields.
Example
::persona::accounts/update-account("act_123", {tags: ["vip"], fields: {name-first: "Jane"}})