Python API

Quick Start

from plaid_client import PlaidClient

client = PlaidClient.login("http://localhost:8085", "user@example.com", "password")

# Create a project
project = client.projects.create("My Project")

# Create a document
doc = client.documents.create(project["id"], "Document 1")

# Get a project with its documents
full = client.projects.get(project["id"], include_documents=True)

# Batch multiple operations atomically
client.begin_batch()
client.tokens.create(token_layer_id, text_id, 0, 5)
client.tokens.create(token_layer_id, text_id, 6, 11)
results = client.submit_batch()

Client

__init__()

Create a new PlaidClient instance.

enter_strict_mode()

Enable strict mode for a document, requiring document version headers.

exit_strict_mode()

Disable strict mode.

set_agent_name()

Set the agent name sent in request headers.

begin_batch()

Start collecting operations for a batch submission.

submit_batch()

Submit all collected batch operations atomically.

abort_batch()

Discard all collected batch operations without submitting.

is_batch_mode()

Return whether the client is currently collecting batch operations.

close()

login() @classmethod

Authenticate and return a new PlaidClient instance.

Batch

batch.submit()

Execute multiple API operations atomically.

Documents

documents.check_lock()

Check the lock status of a document.

documents.acquire_lock()

Acquire or refresh a document lock.

documents.release_lock()

Release a document lock.

documents.get_media()

Get media file for a document.

documents.upload_media()

Upload a media file for a document.

documents.delete_media()

Delete media file for a document.

documents.delete()

Delete a document and all data contained.

documents.update()

Update a document's name.

documents.create()

Create a new document in a project.

documents.set_metadata()

Replace all metadata for a document.

documents.delete_metadata()

Remove all metadata from a document.

Messages

messages.listen()

Listen to project events via Server-Sent Events.

messages.send_message()

Send a message to all clients listening to a project.

messages.discover_services()

Discover available services in a project.

Projects

projects.create()

Create a new project.

projects.list()

List all projects accessible to the current user.

projects.delete()

Delete a project.

projects.update()

Update a project's name.

projects.add_writer()

Grant write access to a user for this project.

projects.remove_writer()

Remove a user's write access for this project.

projects.add_reader()

Grant read-only access to a user for this project.

projects.remove_reader()

Remove a user's read access for this project.

projects.add_maintainer()

Assign a user as a maintainer for this project.

projects.remove_maintainer()

Remove a user's maintainer privileges for this project.

projects.set_config()

Set a configuration value for a project in an editor namespace.

projects.delete_config()

Remove a configuration value for a project.

Relation Layers

relation_layers.get()

Get a relation layer by ID.

relation_layers.delete()

Delete a relation layer.

relation_layers.update()

Update a relation layer's name.

relation_layers.set_config()

Set a configuration value for a relation layer in an editor namespace.

relation_layers.delete_config()

Remove a configuration value for a relation layer.

relation_layers.shift()

Shift a relation layer's display order.

relation_layers.create()

Create a new relation layer.

Relations

relations.set_metadata()

Replace all metadata for a relation.

relations.delete_metadata()

Remove all metadata from a relation.

relations.set_target()

Update the target span of a relation.

relations.set_source()

Update the source span of a relation.

relations.get()

Get a relation by ID.

relations.delete()

Delete a relation.

relations.update()

Update a relation's value.

relations.bulk_create()

Create multiple relations in a single operation.

relations.bulk_delete()

Delete multiple relations in a single operation.

Span Layers

span_layers.get()

Get a span layer by ID.

span_layers.delete()

Delete a span layer.

span_layers.update()

Update a span layer's name.

span_layers.set_config()

Set a configuration value for a span layer in an editor namespace.

span_layers.delete_config()

Remove a configuration value for a span layer.

span_layers.shift()

Shift a span layer's display order.

span_layers.create()

Create a new span layer.

Spans

spans.set_metadata()

Replace all metadata for a span.

spans.delete_metadata()

Remove all metadata from a span.

spans.set_tokens()

Replace the tokens associated with a span.

spans.get()

Get a span by ID.

spans.delete()

Delete a span.

spans.update()

Update a span's value.

spans.create()

Create a new span.

spans.bulk_create()

Create multiple spans in a single operation.

spans.bulk_delete()

Delete multiple spans in a single operation.

Text Layers

text_layers.get()

Get a text layer by ID.

text_layers.delete()

Delete a text layer.

text_layers.update()

Update a text layer's name.

text_layers.set_config()

Set a configuration value for a text layer in an editor namespace.

text_layers.delete_config()

Remove a configuration value for a text layer.

text_layers.shift()

Shift a text layer's display order.

text_layers.create()

Create a new text layer for a project.

Texts

texts.get()

Get a text.

texts.delete()

Delete a text and all dependent data.

texts.update()

Update a text's ``body``.

texts.set_metadata()

Replace all metadata for a text.

texts.delete_metadata()

Remove all metadata from a text.

Token Layers

token_layers.get()

Get a token layer by ID.

token_layers.delete()

Delete a token layer.

token_layers.update()

Update a token layer's name.

token_layers.set_config()

Set a configuration value for a token layer in an editor namespace.

token_layers.delete_config()

Remove a configuration value for a token layer.

token_layers.shift()

Shift a token layer's display order.

token_layers.create()

Create a new token layer.

Tokens

tokens.set_metadata()

Replace all metadata for a token.

tokens.delete_metadata()

Remove all metadata from a token.

tokens.get()

Get a token.

tokens.delete()

Delete a token and remove it from any spans.

tokens.bulk_create()

Create multiple tokens in a single operation.

tokens.bulk_delete()

Delete multiple tokens in a single operation.

Users

users.list()

List all users.

users.create()

Create a new user.

users.get()

Get a user by ID.

users.delete()

Delete a user.

Vocab Items

vocab_items.create()

Create a new vocab item.

vocab_items.get()

Get a vocab item by ID.

vocab_items.delete()

Delete a vocab item.

vocab_items.update()

Update a vocab item's form.

vocab_items.set_metadata()

Replace all metadata for a vocab item.

vocab_items.delete_metadata()

Remove all metadata from a vocab item.

Vocab Layers

vocab_layers.get()

Get a vocab layer by ID.

vocab_layers.delete()

Delete a vocab layer.

vocab_layers.update()

Update a vocab layer's name.

vocab_layers.set_config()

Set a configuration value for a vocab layer in an editor namespace.

vocab_layers.delete_config()

Remove a configuration value for a vocab layer.

vocab_layers.list()

List all vocab layers accessible to the current user.

vocab_layers.create()

Create a new vocab layer.

vocab_layers.add_maintainer()

Assign a user as a maintainer for this vocab layer.

vocab_layers.remove_maintainer()

Remove a user's maintainer privileges for this vocab layer.