For the complete documentation index, see llms.txt. This page is also available as Markdown.

πŸ”ŒAPI Reference

Public API of vcon-js 0.4.0 β€” every exported class, method, and constant.

Complete API reference for vcon-js 0.4.0, targeting draft-ietf-vcon-vcon-core-02 (syntax "0.4.0").

See the Quickstart for a code-walkthrough; this page is a reference.

Top-level exports

import {
  Vcon, Party, Dialog, Attachment, PartyHistory,
  // Types:
  VconData, Analysis, Encoding, CivicAddress, Group, Redacted, Amended,
  // Constants:
  VCON_VERSION,  // '0.4.0'
} from 'vcon-js';

Vcon

Main container class.

Static methods

Method
Returns
Description

Vcon.buildNew()

Vcon

Create an empty vCon. Sets uuid, created_at, and vcon: "0.4.0".

Vcon.buildFromJson(json: string)

Vcon

Parse a vCon from JSON.

Instance properties

uuid, vcon, created_at, updated_at, subject, parties, dialog, attachments, analysis, tags, extensions, critical, group, redacted, amended, meta.

Note: amended is the spec-correct name (was appended pre-spec-02). A deprecated appended getter is retained for backward compatibility.

Adding content

Method
Description

addParty(party: Party)

Append a party. The returned index is parties.length - 1.

addDialog(dialog: Dialog)

Append a dialog entry.

addAttachment(attachment)

Append an attachment. See the Extensions section for shapes.

addAnalysis(analysis)

Append an analysis entry. vendor is REQUIRED.

addTag(key: string, value: string)

Add a tag (surfaces in conserver / MCP search).

addGroup(group: Group)

Add a group reference (multi-vCon aggregation).

Extensions

Method
Description

addExtension(name: string)

Add to extensions[]. Consumers MAY understand it.

addCriticalExtension(name: string)

Add to both extensions[] and critical[] / must_understand[]. Consumers MUST understand it or refuse the vCon.

hasExtension(name: string): boolean

Check whether an extension is declared.

isCriticalExtension(name: string): boolean

Check whether an extension is in critical[].

Search helpers

Method
Description

findPartyByIdentifier(...)

Locate a party by tel / mailto / sip / etc.

findDialogByType(type)

All dialogs of a given type.

findAttachmentByPurpose(purpose)

Attachments with a given purpose.

findAnalysisByType(type)

Analyses of a given type.

findAnalysisByVendor(vendor)

Analyses produced by a vendor.

Serialization

Method
Returns
Description

toJson()

string

JSON string ready to sign, store, or transmit.

toDict()

object

Plain JS object.

Party

Methods: toDict(), hasIdentifier(), getPrimaryIdentifier(), validate().

Dialog

Methods: toDict(), addInlineData(body, encoding, mediatype?), addExternalData(url, contentHash, mediatype?), isText(), isRecording(), isTransfer(), isIncomplete(), validate().

Attachment

Methods: toDict(), addInlineData(), addExternalData(), isExternalData(), isInlineData(), validate().

The core spec uses purpose, not type, on attachments. The Lawful Basis extension is the documented exception β€” see Lawful Basis.

Analysis (type)

PartyHistory

Methods: toDict(), PartyHistory.fromDict(obj), validate().

Types

  • SessionId β€” { local: string; remote: string } per RFC 7989.

  • CivicAddress β€” GEOPRIV-style address (country, a1–a6, sts, hno, lmk, pc, …).

  • Group β€” { uuid: string; body?: string; encoding?: Encoding; url?: string; content_hash?: string | string[] }.

  • Redacted / Amended β€” top-level reference objects to a related vCon UUID.

  • Encoding β€” 'base64url' | 'json' | 'none'.

See also

  • Quickstart β€” walking through the API in context

  • LLM Guide β€” same material formatted for model context

  • Extensions section β€” the JSON shape you'll be passing into addAttachment / addAnalysis for each extension

Last updated

Was this helpful?