Kamy PDF generation API — Python SDK
Project description
Kamy — Python SDK
Official Python SDK for the Kamy PDF generation API.
pip install kamy-sdk
Distribution name on PyPI is
kamy-sdk(thekamyname was unavailable). The import path is stillfrom kamy import Kamy— the directory undersite-packages/is namedkamy/, so module imports look the way you'd expect.
Quick start
from kamy import Kamy
kamy = Kamy(api_key="kamy_pk_...") # or set KAMY_API_KEY in the env
pdf = kamy.render(
template="invoice",
data={
"invoiceNumber": "INV-001",
"from": {"name": "Acme Inc."},
"to": {"name": "Globex Corp."},
"lineItems": [
{"description": "Consulting", "quantity": 10, "unitPrice": 150, "amount": 1500},
],
"subtotal": 1500,
"total": 1500,
"currency": "USD",
},
)
print(pdf.url) # signed URL valid for 1 hour
Async (FastAPI / asyncio)
from kamy import AsyncKamy
async with AsyncKamy(api_key="kamy_pk_...") as kamy:
pdf = await kamy.render(template="invoice", data={...})
Other modes
# Inline HTML
kamy.render(html="<h1>Hello {{name}}</h1>", data={"name": "world"})
# URL mode (paid plans only — fetches the URL server-side)
kamy.render(url="https://example.com/invoice/123")
# Word (.docx) output instead of PDF
kamy.render_docx(template="invoice", data={...})
# Batch — up to 100 items, partial failures don't abort
results = kamy.render_batch([
{"template": "receipt", "data": order1},
{"template": "receipt", "data": order2},
])
Render options
from kamy import Kamy, RenderOptions, FormFieldSpec
kamy = Kamy()
pdf = kamy.render(
template="invoice",
data={...},
options=RenderOptions(
format="a4",
orientation="portrait",
page_numbers=True,
pdf_a="2b", # archival output
form_fields=[ # fillable AcroForm widgets
FormFieldSpec(
name="signature",
type="signature",
page=1,
x=100, y=100,
width=200, height=40,
),
],
),
)
Error handling
from kamy import Kamy
from kamy import RateLimitError, QuotaExceededError, ValidationError
kamy = Kamy()
try:
pdf = kamy.render(template="invoice", data={...})
except ValidationError as e:
print("Bad payload:", e.details) # {"field.name": ["reason"]}
except RateLimitError as e:
print(f"Rate limited, retry after {e.retry_after_seconds}s")
except QuotaExceededError:
print("Monthly quota hit. Upgrade or wait until next billing cycle.")
Documentation
- API reference: https://docs.kamy.dev
- OpenAPI spec: https://kamy.dev/openapi.json
- TypeScript SDK: https://www.npmjs.com/package/@kamydev/sdk
- MCP server: https://kamy.dev/docs/mcp
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kamy_sdk-0.1.0.tar.gz.
File metadata
- Download URL: kamy_sdk-0.1.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71d9ce9afb00dbab30cdd19c94d66634ff443790cc8cc9ce1e6928db0157a14f
|
|
| MD5 |
7949fcbc7e2ac192b4b3ca5a0d26bfec
|
|
| BLAKE2b-256 |
a785d9947b6325bd48ea0f30358824937acda64e17f9aeb9a313a15b07f6b02b
|
File details
Details for the file kamy_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kamy_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fba96aeea00937d28c9db2b667c52e0a4e539f3a859eeb58e9e43cf2ec65a5c0
|
|
| MD5 |
56950d1959fa1cbd11f890ecd89c1ff5
|
|
| BLAKE2b-256 |
d2e8f28b1d9ef12267b283d38eb0338cac2aea69b24da23f79df653df91781de
|