JavaScript API
Quick Start
import PlaidClient from 'plaid-client';
const client = await PlaidClient.login('http://localhost:8085', 'user@example.com', 'password');
// Create a project
const project = await client.projects.create('My Project');
// Create a document
const doc = await client.documents.create(project.id, 'Document 1');
// List a project's documents (paginated; the client returns the full list)
const docs = await client.projects.listDocuments(project.id);
// Batch multiple operations atomically
client.beginBatch();
client.tokens.create(tokenLayerId, textId, 0, 5);
client.tokens.create(tokenLayerId, textId, 6, 11);
const results = await client.submitBatch();
Client
constructor(baseUrl, token, [options], [options])Create a new PlaidClient instance
| Parameter | Type | Description |
|---|---|---|
baseUrl |
string |
The base URL for the API |
token |
string |
The authentication token |
options optional |
object |
Client options |
options optional |
number |
.timeout=30000] - Per-request timeout in ms (0 or null disables it) |
login(baseUrl, userId, password, [options]) staticAuthenticate and return a new client instance with token. This is the
| Parameter | Type | Description |
|---|---|---|
baseUrl |
string |
The base URL for the API |
userId |
string |
User ID for authentication |
password |
string |
Password for authentication |
options optional |
object |
Client options forwarded to the constructor (e.g. { timeout }) |
enterStrictMode(documentId)Enter strict mode for a specific document, requiring document version
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The ID of the document to track versions for |
exitStrictMode()Exit strict mode and stop tracking document versions for writes.
beginBatch()Begin a batch of operations. Subsequent API calls will be queued.
submitBatch()Submit all queued batch operations as a single batch request, executed
abortBatch()Abort the current batch without executing any operations.
isBatchMode()Check if currently in batch mode.
Api Tokens
apiTokens.list(userId)List a user's named API tokens. Never includes the signed token
| Parameter | Type | Description |
|---|---|---|
userId |
string |
The user ID who owns the tokens |
apiTokens.listPage(userId, [opts], [opts])Fetch a single page of a user's named API tokens.
| Parameter | Type | Description |
|---|---|---|
userId |
string |
The user ID who owns the tokens |
opts optional |
object |
* @param {number} [opts.limit] - Page size (1..1000; server default 100) |
opts optional |
string |
.cursor] - Opaque cursor from a previous page |
apiTokens.iterPages(userId, [opts])Async-iterate a user's named API tokens page by page; yields each
| Parameter | Type | Description |
|---|---|---|
userId |
string |
The user ID who owns the tokens |
opts optional |
object |
* @param {number} [opts.pageSize] - Per-request page size |
apiTokens.create(userId, name)Mint a named API token for a user. The returned `token` is the signed
| Parameter | Type | Description |
|---|---|---|
userId |
string |
The user ID who will own the token |
name |
string |
A human label, e.g. "Stanza Parser" |
apiTokens.revoke(userId, tokenId)Revoke a named API token (soft-revoke; idempotent).
| Parameter | Type | Description |
|---|---|---|
userId |
string |
The user ID who owns the token |
tokenId |
string |
The token ID to revoke |
Batch
batch.submit(body)Execute multiple API operations atomically. If any operation fails, all
| Parameter | Type | Description |
|---|---|---|
body |
Array |
The request body |
Documents
documents.checkLock(documentId, [asOf])Check the lock status of a document.
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
asOf optional |
string |
Temporal query timestamp |
documents.acquireLock(documentId)Acquire or refresh a document lock
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
documents.releaseLock(documentId)Release a document lock
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
documents.getMedia(documentId, [asOf])Get media file for a document
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
asOf optional |
string |
Temporal query timestamp |
documents.uploadMedia(documentId, file)Upload a media file for a document. Uses Apache Tika for content validation.
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
file |
File |
The file to upload |
documents.deleteMedia(documentId)Delete media file for a document
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
documents.setMetadata(documentId, body)Replace all metadata for a document.
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
body |
any |
The request body |
documents.deleteMetadata(documentId)Remove all metadata from a document.
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
documents.patchMetadata(documentId, body)Patch (shallow-merge) metadata for a document. Keys present in the body are set or overwritten; keys not present are left untouched; a key whose value is null is deleted. Merging is top-level only (nested objects are replaced wholesale, not deep-merged), so a literal null cannot be stored as a value. An empty body changes no metadata.
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
body |
any |
The metadata patch |
documents.audit(documentId, [startTime], [endTime], [asOf])Get audit log for a document. Transparently follows pagination cursors
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
startTime optional |
string |
Start of time range |
endTime optional |
string |
End of time range |
asOf optional |
string |
Temporal query timestamp |
documents.get(documentId, [includeBody], [asOf])Get a document. Set `includeBody` to true to include all data.
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
includeBody optional |
boolean |
Include document body data |
asOf optional |
string |
Temporal query timestamp |
documents.delete(documentId)Delete a document and all data contained.
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
documents.update(documentId, name)Update a document's name.
| Parameter | Type | Description |
|---|---|---|
documentId |
string |
The document ID |
name |
string |
The name |
documents.create(projectId, name, [metadata])Create a new document in a project.
| Parameter | Type | Description |
|---|---|---|
projectId |
string |
The project ID |
name |
string |
The name |
metadata optional |
any |
Metadata map. Omit to leave unset; pass null to send JSON null. |
Messages
messages.listen(projectId, onEvent, [path])Open a Server-Sent Events stream for a project.
| Parameter | Type | Description |
|---|---|---|
projectId |
string |
The UUID of the project to listen to |
onEvent |
function |
Callback function that receives (eventType, data). If it returns true, listening will stop. |
path optional |
string |
Stream path under baseUrl (defaults to the project /listen bus; service channels pass their own). |
messages.sendMessage(projectId, data)Send a message to project listeners
| Parameter | Type | Description |
|---|---|---|
projectId |
string |
The UUID of the project to send to |
data |
any |
The message data to send |
messages.discoverServices(projectId)Discover the services seen on a project (synchronous GET). Currently
| Parameter | Type | Description |
|---|---|---|
projectId |
string |
The UUID of the project to query |
messages.discardService(projectId, serviceId)Forget a previously-seen (offline) service. Maintainer-only; 409 if
| Parameter | Type | Description |
|---|---|---|
projectId |
string |
The UUID of the project |
serviceId |
string |
The ID of the service to forget |
messages.serve(projectId, serviceInfo, onServiceRequest, [extras])Register as a service and handle incoming work requests.
| Parameter | Type | Description |
|---|---|---|
projectId |
string |
The UUID of the project to serve |
serviceInfo |
Object |
Service information {serviceId, serviceName, description} |
onServiceRequest |
function |
Callback (data, responseHelper) |
extras optional |
Object |
Optional additional service metadata |
messages.requestService(projectId, serviceId, data, [timeout], [onProgress])Request a service to perform work and await its result.
| Parameter | Type | Description |
|---|---|---|
projectId |
string |
The UUID of the project |
serviceId |
string |
The ID of the service to request |
data |
any |
The request data |
timeout optional |
number |
Timeout in milliseconds (default: 10000) |
onProgress optional |
function |
Called with each progress payload {percent, message} |
Projects
projects.addWriter(id, userId)Set a user's access level to read and write for this project.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
userId |
string |
The user ID |
projects.removeWriter(id, userId)Remove a user's writer privileges for this project.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
userId |
string |
The user ID |
projects.addReader(id, userId)Set a user's access level to read-only for this project.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
userId |
string |
The user ID |
projects.removeReader(id, userId)Remove a user's reader privileges for this project.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
userId |
string |
The user ID |
projects.setConfig(id, namespace, configKey, configValue)Set a configuration value for a project in an editor namespace.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
configValue |
any |
Configuration value to set |
projects.deleteConfig(id, namespace, configKey)Remove a configuration value for a project.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
projects.addMaintainer(id, userId)Assign a user as a maintainer for this project.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
userId |
string |
The user ID |
projects.removeMaintainer(id, userId)Remove a user's maintainer privileges for this project.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
userId |
string |
The user ID |
projects.audit(projectId, [startTime], [endTime], [asOf])Get audit log for a project. Transparently follows pagination cursors
| Parameter | Type | Description |
|---|---|---|
projectId |
string |
The project ID |
startTime optional |
string |
Start of time range |
endTime optional |
string |
End of time range |
asOf optional |
string |
Temporal query timestamp |
projects.linkVocab(id, vocabId)Link a vocabulary to a project.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
vocabId |
string |
The vocab layer ID |
projects.unlinkVocab(id, vocabId)Unlink a vocabulary from a project.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
vocabId |
string |
The vocab layer ID |
projects.get(id, [asOf])Get a project by ID. To fetch the project's documents, use
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
asOf optional |
string |
Temporal query timestamp |
projects.listDocuments(id)List all documents in a project. Transparently follows pagination
| Parameter | Type | Description |
|---|---|---|
id |
string |
The project ID |
projects.listDocumentsPage(id, [opts], [opts])Fetch a single page of a project's documents.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The project ID |
opts optional |
object |
* @param {number} [opts.limit] - Page size (1..1000; server default 100) |
opts optional |
string |
.cursor] - Opaque cursor from a previous page |
projects.iterDocuments(id, [opts])Async-iterate a project's documents page by page; yields each page's
| Parameter | Type | Description |
|---|---|---|
id |
string |
The project ID |
opts optional |
object |
* @param {number} [opts.pageSize] - Per-request page size |
projects.delete(id, [auditMessage], [options])Delete a project and everything in it. This is irrecoverable.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
auditMessage optional |
string |
Custom audit-log message |
options optional |
object |
* @param {number} [options.timeout=0] - Per-request timeout in ms (0/null disables) |
projects.update(id, name)Update a project's name.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
name |
string |
The name |
projects.list([asOf])List all projects accessible to user. Transparently follows pagination
| Parameter | Type | Description |
|---|---|---|
asOf optional |
string |
Temporal query timestamp |
projects.listPage([opts], [opts], [opts])Fetch a single page of projects.
| Parameter | Type | Description |
|---|---|---|
opts optional |
object |
* @param {number} [opts.limit] - Page size (1..1000; server default 100) |
opts optional |
string |
.cursor] - Opaque cursor from a previous page |
opts optional |
string |
.asOf] - Temporal query timestamp |
projects.iterPages([opts], [opts])Async-iterate projects page by page; yields each page's entries array.
| Parameter | Type | Description |
|---|---|---|
opts optional |
object |
* @param {number} [opts.pageSize] - Per-request page size |
opts optional |
string |
.asOf] - Temporal query timestamp |
projects.create(name)Create a new project. Note: this also registers the user as a maintainer.
| Parameter | Type | Description |
|---|---|---|
name |
string |
The name |
Relation Layers
relationLayers.shift(relationLayerId, direction)Shift a relation layer's display order.
| Parameter | Type | Description |
|---|---|---|
relationLayerId |
string |
The relation layer ID |
direction |
string |
The direction ("up" or "down") |
relationLayers.create(spanLayerId, name)Create a new relation layer.
| Parameter | Type | Description |
|---|---|---|
spanLayerId |
string |
The span layer ID |
name |
string |
The name |
relationLayers.setConfig(relationLayerId, namespace, configKey, configValue)Set a configuration value for a layer in an editor namespace.
| Parameter | Type | Description |
|---|---|---|
relationLayerId |
string |
The relation layer ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
configValue |
any |
Configuration value to set |
relationLayers.deleteConfig(relationLayerId, namespace, configKey)Remove a configuration value for a layer.
| Parameter | Type | Description |
|---|---|---|
relationLayerId |
string |
The relation layer ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
relationLayers.get(relationLayerId, [asOf])Get a relation layer by ID.
| Parameter | Type | Description |
|---|---|---|
relationLayerId |
string |
The relation layer ID |
asOf optional |
string |
Temporal query timestamp |
relationLayers.delete(relationLayerId)Delete a relation layer.
| Parameter | Type | Description |
|---|---|---|
relationLayerId |
string |
The relation layer ID |
relationLayers.update(relationLayerId, name)Update a relation layer's name.
| Parameter | Type | Description |
|---|---|---|
relationLayerId |
string |
The relation layer ID |
name |
string |
The name |
Relations
relations.setMetadata(relationId, body)Replace all metadata for a relation.
| Parameter | Type | Description |
|---|---|---|
relationId |
string |
The relation ID |
body |
any |
The request body |
relations.deleteMetadata(relationId)Remove all metadata from a relation.
| Parameter | Type | Description |
|---|---|---|
relationId |
string |
The relation ID |
relations.patchMetadata(relationId, body)Patch (shallow-merge) metadata for a relation. Keys present in the body are set or overwritten; keys not present are left untouched; a key whose value is null is deleted. Merging is top-level only (nested objects are replaced wholesale, not deep-merged), so a literal null cannot be stored as a value. An empty body changes no metadata.
| Parameter | Type | Description |
|---|---|---|
relationId |
string |
The relation ID |
body |
any |
The metadata patch |
relations.setTarget(relationId, spanId)Update the target span of a relation.
| Parameter | Type | Description |
|---|---|---|
relationId |
string |
The relation ID |
spanId |
string |
The span ID |
relations.get(relationId, [asOf])Get a relation by ID.
| Parameter | Type | Description |
|---|---|---|
relationId |
string |
The relation ID |
asOf optional |
string |
Temporal query timestamp |
relations.delete(relationId)Delete a relation.
| Parameter | Type | Description |
|---|---|---|
relationId |
string |
The relation ID |
relations.update(relationId, value)Update a relation's value.
| Parameter | Type | Description |
|---|---|---|
relationId |
string |
The relation ID |
value |
any |
The value |
relations.setSource(relationId, spanId)Update the source span of a relation.
| Parameter | Type | Description |
|---|---|---|
relationId |
string |
The relation ID |
spanId |
string |
The span ID |
relations.create(layerId, sourceId, targetId, value, [metadata])Create a new relation. A relation is a directed edge between two spans
| Parameter | Type | Description |
|---|---|---|
layerId |
string |
The relation layer ID |
sourceId |
string |
The source span ID |
targetId |
string |
The target span ID |
value |
any |
The value |
metadata optional |
any |
Metadata map. Omit to leave unset; pass null to send JSON null. |
relations.bulkCreate(body)Create multiple relations in a single operation.
| Parameter | Type | Description |
|---|---|---|
body |
Array |
The request body |
relations.bulkDelete(body)Delete multiple relations in a single operation. Provide an array of IDs.
| Parameter | Type | Description |
|---|---|---|
body |
Array |
The request body |
Span Layers
spanLayers.setConfig(spanLayerId, namespace, configKey, configValue)Set a configuration value for a layer in an editor namespace.
| Parameter | Type | Description |
|---|---|---|
spanLayerId |
string |
The span layer ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
configValue |
any |
Configuration value to set |
spanLayers.deleteConfig(spanLayerId, namespace, configKey)Remove a configuration value for a layer.
| Parameter | Type | Description |
|---|---|---|
spanLayerId |
string |
The span layer ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
spanLayers.get(spanLayerId, [asOf])Get a span layer by ID.
| Parameter | Type | Description |
|---|---|---|
spanLayerId |
string |
The span layer ID |
asOf optional |
string |
Temporal query timestamp |
spanLayers.delete(spanLayerId)Delete a span layer.
| Parameter | Type | Description |
|---|---|---|
spanLayerId |
string |
The span layer ID |
spanLayers.update(spanLayerId, name)Update a span layer's name.
| Parameter | Type | Description |
|---|---|---|
spanLayerId |
string |
The span layer ID |
name |
string |
The name |
spanLayers.create(tokenLayerId, name)Create a new span layer.
| Parameter | Type | Description |
|---|---|---|
tokenLayerId |
string |
The token layer ID |
name |
string |
The name |
spanLayers.shift(spanLayerId, direction)Shift a span layer's display order.
| Parameter | Type | Description |
|---|---|---|
spanLayerId |
string |
The span layer ID |
direction |
string |
The direction ("up" or "down") |
Spans
spans.setTokens(spanId, tokens)Replace tokens for a span.
| Parameter | Type | Description |
|---|---|---|
spanId |
string |
The span ID |
tokens |
Array |
The tokens |
spans.create(spanLayerId, tokens, value, [metadata])Create a new span. A span holds a primary atomic value and optional
| Parameter | Type | Description |
|---|---|---|
spanLayerId |
string |
The span layer ID |
tokens |
Array |
The tokens |
value |
any |
The value |
metadata optional |
any |
Metadata map. Omit to leave unset; pass null to send JSON null. |
spans.get(spanId, [asOf])Get a span by ID.
| Parameter | Type | Description |
|---|---|---|
spanId |
string |
The span ID |
asOf optional |
string |
Temporal query timestamp |
spans.delete(spanId)Delete a span.
| Parameter | Type | Description |
|---|---|---|
spanId |
string |
The span ID |
spans.update(spanId, value)Update a span's value.
| Parameter | Type | Description |
|---|---|---|
spanId |
string |
The span ID |
value |
any |
The value |
spans.bulkCreate(body)Create multiple spans in a single operation.
| Parameter | Type | Description |
|---|---|---|
body |
Array |
The request body |
spans.bulkDelete(body)Delete multiple spans in a single operation. Provide an array of IDs.
| Parameter | Type | Description |
|---|---|---|
body |
Array |
The request body |
spans.setMetadata(spanId, body)Replace all metadata for a span.
| Parameter | Type | Description |
|---|---|---|
spanId |
string |
The span ID |
body |
any |
The request body |
spans.deleteMetadata(spanId)Remove all metadata from a span.
| Parameter | Type | Description |
|---|---|---|
spanId |
string |
The span ID |
spans.patchMetadata(spanId, body)Patch (shallow-merge) metadata for a span. Keys present in the body are set or overwritten; keys not present are left untouched; a key whose value is null is deleted. Merging is top-level only (nested objects are replaced wholesale, not deep-merged), so a literal null cannot be stored as a value. An empty body changes no metadata.
| Parameter | Type | Description |
|---|---|---|
spanId |
string |
The span ID |
body |
any |
The metadata patch |
Text Layers
textLayers.setConfig(textLayerId, namespace, configKey, configValue)Set a configuration value for a layer in an editor namespace.
| Parameter | Type | Description |
|---|---|---|
textLayerId |
string |
The text layer ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
configValue |
any |
Configuration value to set |
textLayers.deleteConfig(textLayerId, namespace, configKey)Remove a configuration value for a layer.
| Parameter | Type | Description |
|---|---|---|
textLayerId |
string |
The text layer ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
textLayers.get(textLayerId, [asOf])Get a text layer by ID.
| Parameter | Type | Description |
|---|---|---|
textLayerId |
string |
The text layer ID |
asOf optional |
string |
Temporal query timestamp |
textLayers.delete(textLayerId)Delete a text layer.
| Parameter | Type | Description |
|---|---|---|
textLayerId |
string |
The text layer ID |
textLayers.update(textLayerId, name)Update a text layer's name.
| Parameter | Type | Description |
|---|---|---|
textLayerId |
string |
The text layer ID |
name |
string |
The name |
textLayers.shift(textLayerId, direction)Shift a text layer's display order within the project.
| Parameter | Type | Description |
|---|---|---|
textLayerId |
string |
The text layer ID |
direction |
string |
The direction ("up" or "down") |
textLayers.create(projectId, name)Create a new text layer for a project.
| Parameter | Type | Description |
|---|---|---|
projectId |
string |
The project ID |
name |
string |
The name |
Texts
texts.setMetadata(textId, body)Replace all metadata for a text.
| Parameter | Type | Description |
|---|---|---|
textId |
string |
The text ID |
body |
any |
The request body |
texts.deleteMetadata(textId)Remove all metadata from a text.
| Parameter | Type | Description |
|---|---|---|
textId |
string |
The text ID |
texts.patchMetadata(textId, body)Patch (shallow-merge) metadata for a text. Keys present in the body are set or overwritten; keys not present are left untouched; a key whose value is null is deleted. Merging is top-level only (nested objects are replaced wholesale, not deep-merged), so a literal null cannot be stored as a value. An empty body changes no metadata.
| Parameter | Type | Description |
|---|---|---|
textId |
string |
The text ID |
body |
any |
The metadata patch |
texts.create(textLayerId, documentId, body, [metadata])Create a new text in a document's text layer. A text is a container for
| Parameter | Type | Description |
|---|---|---|
textLayerId |
string |
The text layer ID |
documentId |
string |
The document ID |
body |
string |
The request body |
metadata optional |
any |
Metadata map. Omit to leave unset; pass null to send JSON null. |
texts.get(textId, [asOf])Get a text.
| Parameter | Type | Description |
|---|---|---|
textId |
string |
The text ID |
asOf optional |
string |
Temporal query timestamp |
texts.delete(textId)Delete a text and all dependent data.
| Parameter | Type | Description |
|---|---|---|
textId |
string |
The text ID |
texts.update(textId, body)Update a text's body. A diff is computed and token indices are updated
| Parameter | Type | Description |
|---|---|---|
textId |
string |
The text ID |
body |
any |
The request body |
Token Layers
tokenLayers.shift(tokenLayerId, direction)Shift a token layer's display order.
| Parameter | Type | Description |
|---|---|---|
tokenLayerId |
string |
The token layer ID |
direction |
string |
The direction ("up" or "down") |
tokenLayers.create(textLayerId, name, [overlapMode], [parentTokenLayerId])Create a new token layer.
| Parameter | Type | Description |
|---|---|---|
textLayerId |
string |
The text layer ID |
name |
string |
The name |
overlapMode optional |
string |
Per-layer, immutable token invariant: "any" (default), "non-overlapping", or "partitioning". On partitioning layers, single token create/update/delete are rejected; use bulkCreate plus split/merge/shift. |
parentTokenLayerId optional |
string |
Optional immutable parent token layer. Tokens in this layer must nest within a parent-layer token; the parent layer must be in the same text layer and be "non-overlapping" or "partitioning" (an "any" parent is rejected). A nested layer may be "any" or "non-overlapping" but not "partitioning" (partitioning is only for root layers), e.g. words (non-overlapping, parent=sentences) within sentences (partitioning). |
tokenLayers.setConfig(tokenLayerId, namespace, configKey, configValue)Set a configuration value for a layer in an editor namespace.
| Parameter | Type | Description |
|---|---|---|
tokenLayerId |
string |
The token layer ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
configValue |
any |
Configuration value to set |
tokenLayers.deleteConfig(tokenLayerId, namespace, configKey)Remove a configuration value for a layer.
| Parameter | Type | Description |
|---|---|---|
tokenLayerId |
string |
The token layer ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
tokenLayers.get(tokenLayerId, [asOf])Get a token layer by ID.
| Parameter | Type | Description |
|---|---|---|
tokenLayerId |
string |
The token layer ID |
asOf optional |
string |
Temporal query timestamp |
tokenLayers.delete(tokenLayerId)Delete a token layer.
| Parameter | Type | Description |
|---|---|---|
tokenLayerId |
string |
The token layer ID |
tokenLayers.update(tokenLayerId, name)Update a token layer's name.
| Parameter | Type | Description |
|---|---|---|
tokenLayerId |
string |
The token layer ID |
name |
string |
The name |
Tokens
tokens.create(tokenLayerId, text, begin, end, [precedence], [metadata])Create a new token in a token layer. Tokens define text substrings
| Parameter | Type | Description |
|---|---|---|
tokenLayerId |
string |
The token layer ID |
text |
string |
The text ID |
begin |
number |
Start offset, inclusive (Unicode code points) |
end |
number |
End offset, exclusive (Unicode code points) |
precedence optional |
number |
Ordering precedence |
metadata optional |
any |
Metadata map. Omit to leave unset; pass null to send JSON null. |
tokens.get(tokenId, [asOf])Get a token.
| Parameter | Type | Description |
|---|---|---|
tokenId |
string |
The token ID |
asOf optional |
string |
Temporal query timestamp |
tokens.delete(tokenId)Delete a token and remove it from any spans. If this causes a span to
| Parameter | Type | Description |
|---|---|---|
tokenId |
string |
The token ID |
tokens.update(tokenId, [begin], [end], [precedence])Update a token.
| Parameter | Type | Description |
|---|---|---|
tokenId |
string |
The token ID |
begin optional |
number |
New start offset, inclusive (Unicode code points) |
end optional |
number |
New end offset, exclusive (Unicode code points) |
precedence optional |
?number |
Ordering precedence. Omit (undefined) |
tokens.bulkCreate(body)Create multiple tokens in a single operation.
| Parameter | Type | Description |
|---|---|---|
body |
Array |
The request body |
tokens.bulkDelete(body)Delete multiple tokens in a single operation. Provide an array of IDs.
| Parameter | Type | Description |
|---|---|---|
body |
Array |
The request body |
tokens.split(tokenId, position)Split a token at a Unicode code-point offset. The original token becomes the
| Parameter | Type | Description |
|---|---|---|
tokenId |
string |
The token ID |
position |
number |
Code-point offset to split at (strictly between begin and end) |
tokens.merge(tokenId, otherTokenId)Merge two tokens. The left token (smaller begin) survives with the combined
| Parameter | Type | Description |
|---|---|---|
tokenId |
string |
The anchor token ID |
otherTokenId |
string |
The other token to merge in |
tokens.shift(tokenId, [begin], [end])Shift a token's boundary. On partitioning layers the adjacent token is
| Parameter | Type | Description |
|---|---|---|
tokenId |
string |
The token ID |
begin optional |
number |
New start offset, inclusive (Unicode code points) |
end optional |
number |
New end offset, exclusive (Unicode code points) |
tokens.setMetadata(tokenId, body)Replace all metadata for a token.
| Parameter | Type | Description |
|---|---|---|
tokenId |
string |
The token ID |
body |
any |
The request body |
tokens.deleteMetadata(tokenId)Remove all metadata from a token.
| Parameter | Type | Description |
|---|---|---|
tokenId |
string |
The token ID |
tokens.patchMetadata(tokenId, body)Patch (shallow-merge) metadata for a token. Keys present in the body are set or overwritten; keys not present are left untouched; a key whose value is null is deleted. Merging is top-level only (nested objects are replaced wholesale, not deep-merged), so a literal null cannot be stored as a value. An empty body changes no metadata.
| Parameter | Type | Description |
|---|---|---|
tokenId |
string |
The token ID |
body |
any |
The metadata patch |
Users
users.list([opts], [opts])List (or search) users. Transparently follows pagination cursors and
| Parameter | Type | Description |
|---|---|---|
opts optional |
object |
* @param {string} [opts.q] - Filter to usernames containing this text (case-insensitive) |
opts optional |
string |
.asOf] - Temporal query timestamp |
users.listPage([opts], [opts], [opts], [opts])Fetch a single page of users (optionally filtered by `q`).
| Parameter | Type | Description |
|---|---|---|
opts optional |
object |
* @param {string} [opts.q] - Filter to usernames containing this text (case-insensitive) |
opts optional |
number |
.limit] - Page size (1..1000; server default 100) |
opts optional |
string |
.cursor] - Opaque cursor from a previous page |
opts optional |
string |
.asOf] - Temporal query timestamp |
users.iterPages([opts], [opts], [opts])Async-iterate users page by page; yields each page's entries array.
| Parameter | Type | Description |
|---|---|---|
opts optional |
object |
* @param {string} [opts.q] - Filter to usernames containing this text (case-insensitive) |
opts optional |
number |
.pageSize] - Per-request page size |
opts optional |
string |
.asOf] - Temporal query timestamp |
users.create(username, password, isAdmin)Create a new user
| Parameter | Type | Description |
|---|---|---|
username |
string |
The username |
password |
string |
The password |
isAdmin |
boolean |
Whether the user is an admin |
users.audit(userId, [startTime], [endTime], [asOf])Get audit log for a user's actions. Transparently follows pagination
| Parameter | Type | Description |
|---|---|---|
userId |
string |
The user ID |
startTime optional |
string |
Start of time range |
endTime optional |
string |
End of time range |
asOf optional |
string |
Temporal query timestamp |
users.get(id, [asOf])Get a user by ID
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
asOf optional |
string |
Temporal query timestamp |
users.delete(id)Deactivate a user. Users are never hard-deleted: deactivation
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
users.activate(id)Reactivate a deactivated user, restoring their ability to log in.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
users.update(id, [password], [username], [isAdmin])Modify a user. Admins may change the username, password, and admin
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
password optional |
string |
New password |
username optional |
string |
New username |
isAdmin optional |
boolean |
New admin status |
Vocab Items
vocabItems.setMetadata(id, body)Replace all metadata for a vocab item.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
body |
any |
The request body |
vocabItems.deleteMetadata(id)Remove all metadata from a vocab item.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
vocabItems.patchMetadata(id, body)Patch (shallow-merge) metadata for a vocab item. Keys present in the body are set or overwritten; keys not present are left untouched; a key whose value is null is deleted. Merging is top-level only (nested objects are replaced wholesale, not deep-merged), so a literal null cannot be stored as a value. An empty body changes no metadata.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
body |
any |
The metadata patch |
vocabItems.create(vocabLayerId, form, [metadata])Create a new vocab item
| Parameter | Type | Description |
|---|---|---|
vocabLayerId |
string |
The vocab layer ID |
form |
string |
The vocab item form |
metadata optional |
any |
Metadata map. Omit to leave unset; pass null to send JSON null. |
vocabItems.bulkCreate()Create multiple vocab items in a single operation. Entries may target
vocabItems.bulkDelete(body)Delete multiple vocab items in a single operation. Each item's
| Parameter | Type | Description |
|---|---|---|
body |
string[] |
The vocab item IDs to delete |
vocabItems.get(id, [asOf])Get a vocab item by ID
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
asOf optional |
string |
Temporal query timestamp |
vocabItems.delete(id)Delete a vocab item
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
vocabItems.update(id, form)Update a vocab item's form
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
form |
string |
The vocab item form |
Vocab Layers
vocabLayers.get(id, [includeItems], [asOf])Get a vocab layer by ID
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
includeItems optional |
boolean |
Include vocab items |
asOf optional |
string |
Temporal query timestamp |
vocabLayers.delete(id)Delete a vocab layer.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
vocabLayers.update(id, name)Update a vocab layer's name.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
name |
string |
The name |
vocabLayers.setConfig(id, namespace, configKey, configValue)Set a configuration value for a layer in an editor namespace.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
configValue |
any |
Configuration value to set |
vocabLayers.deleteConfig(id, namespace, configKey)Remove a configuration value for a layer.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
namespace |
string |
The config namespace |
configKey |
string |
The config key |
vocabLayers.list([asOf])List all vocab layers accessible to user. Transparently follows
| Parameter | Type | Description |
|---|---|---|
asOf optional |
string |
Temporal query timestamp |
vocabLayers.listPage([opts], [opts], [opts])Fetch a single page of vocab layers.
| Parameter | Type | Description |
|---|---|---|
opts optional |
object |
* @param {number} [opts.limit] - Page size (1..1000; server default 100) |
opts optional |
string |
.cursor] - Opaque cursor from a previous page |
opts optional |
string |
.asOf] - Temporal query timestamp |
vocabLayers.iterPages([opts], [opts])Async-iterate vocab layers page by page; yields each page's entries array.
| Parameter | Type | Description |
|---|---|---|
opts optional |
object |
* @param {number} [opts.pageSize] - Per-request page size |
opts optional |
string |
.asOf] - Temporal query timestamp |
vocabLayers.create(name)Create a new vocab layer. Note: this also registers the user as a maintainer.
| Parameter | Type | Description |
|---|---|---|
name |
string |
The name |
vocabLayers.addMaintainer(id, userId)Assign a user as a maintainer for this vocab layer.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
userId |
string |
The user ID |
vocabLayers.removeMaintainer(id, userId)Remove a user's maintainer privileges for this vocab layer.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
userId |
string |
The user ID |
Vocab Links
vocabLinks.create(vocabItem, tokens, [metadata])Create a new vocab link between tokens and a vocab item.
| Parameter | Type | Description |
|---|---|---|
vocabItem |
string |
The vocab item to link |
tokens |
Array |
The tokens to link |
metadata optional |
any |
Metadata for the link. Omit to leave unset; pass null to send JSON null. |
vocabLinks.bulkCreate()Create multiple vocab links in a single operation. Entries may
vocabLinks.bulkDelete(body)Delete multiple vocab links in a single operation. Provide an array of IDs.
| Parameter | Type | Description |
|---|---|---|
body |
string[] |
The vocab link IDs to delete |
vocabLinks.setMetadata(id, body)Replace all metadata for a vocab link. The entire metadata map is replaced - existing metadata keys not included in the request will be removed.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
body |
any |
The request body |
vocabLinks.deleteMetadata(id)Remove all metadata from a vocab link.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
vocabLinks.patchMetadata(id, body)Patch (shallow-merge) metadata for a vocab link. Keys present in the body are set or overwritten; keys not present are left untouched; a key whose value is null is deleted. Merging is top-level only (nested objects are replaced wholesale, not deep-merged), so a literal null cannot be stored as a value. An empty body changes no metadata.
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
body |
any |
The metadata patch |
vocabLinks.get(id, [asOf])Get a vocab link by ID
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |
asOf optional |
string |
Temporal query timestamp |
vocabLinks.delete(id)Delete a vocab link
| Parameter | Type | Description |
|---|---|---|
id |
string |
The resource ID |