Storage
Documentation for how to call the Storage APIs using the Aryn SDK
Please find the documentation for how to call the Storage APIs using the Aryn SDK below. All parameters are optional unless specified otherwise.
DocSet Functions
Functions for managing document sets (DocSets) which are collections of documents.
Create DocSet
Create a new DocSet to store documents.
from aryn_sdk.client.client import Client
docset = client.create_docset(name="My DocSet")
docset_id = docset.docset_id
A DocSetMetadata object containing:
Unique identifier for the DocSet
Name of the DocSet
Creation timestamp
Boolean indicating if DocSet is read-only
Dictionary of custom properties
Size of DocSet in bytes
Schema object defining document properties
Dictionary of prompts for the DocSet
Get DocSet
Retrieve metadata for a DocSet.
The unique identifier of the DocSet to retrieve
docset = client.get_docset(docset_id="your-docset-id")
A DocSetMetadata object containing:
Unique identifier for the DocSet
Name of the DocSet
Creation timestamp
Boolean indicating if DocSet is read-only
Dictionary of custom properties
Size of DocSet in bytes
Schema object defining document properties
Dictionary of prompts for the DocSet
HTTPError 403
: “No Aryn API Key provided”HTTPError 403
: “Invalid Aryn API key”HTTPError 403
: “Expired Aryn API key”HTTPError 404
: “DocSet not found”HTTPError 5xx
: Internal Server Error
List DocSets
List all DocSets in the account.
docsets = client.list_docsets().get_all()
for docset in docsets:
print(f"DocSet: {docset.name}")
A paginated list of DocSetMetadata objects, each containing:
Unique identifier for the DocSet
Name of the DocSet
Creation timestamp
Boolean indicating if DocSet is read-only
Dictionary of custom properties
Size of DocSet in bytes
Schema object defining document properties
Dictionary of prompts for the DocSet
HTTPError 403
: “No Aryn API Key provided”HTTPError 403
: “Invalid Aryn API key”HTTPError 403
: “Expired Aryn API key”HTTPError 5xx
: Internal Server Error
Delete DocSet
Delete a DocSet and all its documents.
The unique identifier of the DocSet to delete
client.delete_docset(docset_id="your-docset-id")
The metadata of the deleted DocSet
HTTPError 403
: “No Aryn API Key provided”HTTPError 403
: “Invalid Aryn API key”HTTPError 403
: “Expired Aryn API key”HTTPError 404
: “DocSet not found”HTTPError 5xx
: Internal Server Error
Document Functions
Functions for managing individual documents within DocSets.
List Documents
List all documents in a DocSet.
docs = client.list_docs(docset_id="your-docset-id")
for doc in docs:
print(f"Document: {doc.name}")
A paginated list of DocumentMetadata objects, each containing:
Account identifier
Document identifier
Document set identifier
Document name
Creation timestamp
Document size in bytes
MIME type of document
Custom document properties
HTTPError 403
: “No Aryn API Key provided”HTTPError 403
: “Invalid Aryn API key”HTTPError 403
: “Expired Aryn API key”HTTPError 404
: “DocSet not found”HTTPError 400
: “Invalid filter parameters”HTTPError 5xx
: Internal Server Error
Get Document
Get a document by ID.
doc = client.get_doc(docset_id="your-docset-id", doc_id="your-doc-id")
HTTPError 403
: “No Aryn API Key provided”HTTPError 403
: “Invalid Aryn API key”HTTPError 403
: “Expired Aryn API key”HTTPError 404
: “Document not found”HTTPError 5xx
: Internal Server Error
Delete Document
Delete a document by ID.
client.delete_doc(docset_id="your-docset-id", doc_id="your-doc-id")
The metadata of the deleted document
HTTPError 403
: “No Aryn API Key provided”HTTPError 403
: “Invalid Aryn API key”HTTPError 403
: “Expired Aryn API key”HTTPError 404
: “Document not found”HTTPError 5xx
: Internal Server Error
Get Document Binary
Get the binary content of a document.
output = "output.pdf"
client.get_doc_binary(docset_id="your-docset-id", doc_id="your-doc-id", file=output)
The binary content of the document
HTTPError 403
: “No Aryn API Key provided”HTTPError 403
: “Invalid Aryn API key”HTTPError 403
: “Expired Aryn API key”HTTPError 404
: “Document not found”HTTPError 5xx
: Internal Server Error
Properties Functions
Functions for managing document properties.
Update Document Properties
Update properties of a document.
from aryn_sdk.types import ReplaceOperation
updates = [
ReplaceOperation(
path="/properties/status",
value="reviewed"
)
]
client.update_doc_properties(
docset_id="your-docset-id",
doc_id="your-doc-id",
operations=updates
)
HTTPError 403
: “No Aryn API Key provided”HTTPError 403
: “Invalid Aryn API key”HTTPError 403
: “Expired Aryn API key”HTTPError 404
: “Document not found”HTTPError 5xx
: Internal Server Error
Extract Properties
Extract properties from a document.
from aryn_sdk.types.schema import Schema, SchemaField
schema = Schema(fields=[
SchemaField(name="category", field_type="string")
])
client.extract_properties(docset_id="your-docset-id", schema=schema)
A job status object containing:
exit_status
: The exit status of the job
HTTPError 403
: “No Aryn API Key provided”HTTPError 403
: “Invalid Aryn API key”HTTPError 403
: “Expired Aryn API key”HTTPError 404
: “DocSet not found”HTTPError 5xx
: Internal Server Error
Delete Properties
Delete properties from a document.
client.delete_properties(docset_id="your-docset-id", schema=schema)
A job status object
HTTPError 403
: “No Aryn API Key provided”HTTPError 403
: “Invalid Aryn API key”HTTPError 403
: “Expired Aryn API key”HTTPError 404
: “DocSet not found”HTTPError 5xx
: Internal Server Error