Python for Uploading Documents in Rossum API

This Python code shows how to upload a document automatically using Rossum API to a particular Rossum queue.

This Python example demonstrates how to upload a document using Rossum API to a particular Rossum queue. Set the options at the beginning of the script – they store your credentials, and also the identifier of the queue to upload in. You can find out the queue id by looking at your main screen URL, it is the number 12345 in https://example.rossum.app/annotations/12345.

See the reference API documentation for more details about how to use the upload API.

from rossum.lib.api_client import RossumClient

username = "[email protected]"
password = "your.password"
queue_id = 12345
path = "path/to/the/document.pdf"
api_url = "https://example.rossum.app/api/v1"

with RossumClient(
    context=None, user=username, password=password, url=api_url
) as client:
    response = client.upload_document(queue_id, path)


annotation_url = response["results"][0]["annotation"]
print("The file is reachable at the following URL:", annotation_url)