Skip to main content

Python SDK for the SymageDocs synthetic data API

Project description

SymageDocs Python SDK

Generate synthetic documents, identities, and tabular datasets for testing, ML training, and compliance.

Installation

pip install symagedocs

For progress bars during long jobs:

pip install symagedocs[progress]

Quick Start

from symagedocs import Client

client = Client(api_key="sk_live_...")

# List available forms
forms = client.forms.list()
for f in forms:
    print(f"{f.id}: {f.name} ({f.credit_cost} credits)")

# Generate 100 W-2 documents
job = client.generate.create(
    "irs_w2_2024",
    quantity=100,
    output_formats=["pdf_typed", "json"],
)
result = client.generate.wait(job.job_id)  # polls until complete
client.generate.download(job.job_id, "pdf_typed", "./w2_documents.zip")

# Generate tabular data from a description
schema = client.tabular.parse("name, age, SSN, city, state, annual income")
tab_job = client.tabular.generate(columns=schema.columns, quantity=5000)
client.tabular.wait(tab_job.job_id)
client.tabular.download(tab_job.job_id, "csv", "./dataset.csv")

# Check credit balance
balance = client.account.balance()
print(f"Credits used: {balance.credits_used}")

Authentication

Get your API key at symagedocs.ai/account?tab=api.

# Pass directly
client = Client(api_key="sk_live_...")

# Or set environment variable
# export SYMAGEDOCS_API_KEY=sk_live_...
client = Client()  # reads from env

Async Support

from symagedocs import AsyncClient

async with AsyncClient(api_key="sk_live_...") as client:
    forms = await client.forms.list()
    job = await client.generate.create("irs_w2_2024", quantity=10)
    result = await client.generate.wait(job.job_id)

Configuration

client = Client(
    api_key="sk_live_...",
    base_url="https://symagedocs.ai",  # custom server
    timeout=60.0,                       # request timeout (seconds)
    max_retries=3,                      # retry on 429/5xx
)

Error Handling

from symagedocs import Client, AuthenticationError, RateLimitError, NotFoundError

try:
    forms = client.forms.list()
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Too many requests — SDK retries automatically")
except NotFoundError:
    print("Resource not found")

Documentation

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

symagedocs-1.0.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

symagedocs-1.0.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file symagedocs-1.0.0.tar.gz.

File metadata

  • Download URL: symagedocs-1.0.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for symagedocs-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f8fb3953d69af1f293cf29e3def18dc6c196b21817d963c9dbccb2c589c48056
MD5 057fddab661ace182eca4c016aa2f302
BLAKE2b-256 29ccf8cca05d80bd9e74c21dbd28fc97cf06ebd76c63d62c2265a069d1c98720

See more details on using hashes here.

File details

Details for the file symagedocs-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: symagedocs-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for symagedocs-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce5834dd93112e67cef49de74a97f73a4423b73e2926123d929340f91573969d
MD5 fe877a5e64a4043906023be843fcedc9
BLAKE2b-256 c46a8e23a624ae5b1695b1c833098a9fe6c93c69f9191a13448ec116baa4dd70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page