Skip to main content

Python SDK (sync + async) for the SmartBill Cloud REST API.

Project description

smartbill-sdk

A Python SDK for the SmartBill Cloud REST API, offering both synchronous and asynchronous interfaces and typed request/response models generated from the official openapi.json spec.

Features

  • Sync (SmartBillClient) and async (AsyncSmartBillClient) clients.
  • Typed pydantic v2 models for invoices, proformas, payments, emails, taxes, series and stocks.
  • Covers every endpoint from the SmartBill OpenAPI definition.
  • Helper exceptions with the API errorText surfaced.

Installation

pip install smartbill-sdk

From source (development):

uv sync --extra dev

Authentication

SmartBill uses HTTP Basic Auth with username:token:

  • username — the e-mail you log in with in SmartBill Cloud.
  • token — found in SmartBill Cloud > Contul Meu > Integrari > API.
from smartbill_sdk import SmartBillClient

client = SmartBillClient(username="you@example.com", token="abc123...")

Quick start (sync)

from smartbill_sdk import SmartBillClient
from smartbill_sdk.models import Invoice, Client, Product

client = SmartBillClient(username="you@example.com", token="...")

invoice = Invoice(
    company_vat_code="RO12345678",
    client=Client(name="Intelligent IT", vat_code="RO12345678", city="Sibiu", country="Romania"),
    series_name="FCT",
    is_draft=False,
    products=[
        Product(name="Produs 1", measuring_unit_name="buc", currency="RON",
                quantity=2, price=10, is_tax_included=True,
                tax_name="Redusa", tax_percentage=9),
    ],
)

resp = client.invoices.create(invoice)
print(resp.series, resp.number)

Quick start (async)

import asyncio
from smartbill_sdk import AsyncSmartBillClient

async def main():
    client = AsyncSmartBillClient(username="you@example.com", token="...")
    taxes = await client.taxes.ataxes("RO12345678")
    print(taxes)
    await client.aclose()

asyncio.run(main())

Endpoints covered

Invoices, Proformas, Payments (incl. chitanta & bon fiscal), E-mail, Taxes, Series, Stocks. See smartbill_sdk/services/ for the full list.

Agent skills

This repo ships ready-to-import pi skills under skills/ that teach coding agents how to use the SDK. Each SKILL.md is a self-contained, copy-pasteable guide for one area of the API:

Skill Covers
smartbill-invoices Invoices & proformas/estimates: create, storno, cancel, restore, PDF, payment status
smartbill-payments Payments & fiscal receipts (bon fiscal): POST /payment, payment types, mixed cash/card, fiscal-printer text, delete
smartbill-email Emailing a document (POST /document/send): base64 subject/body, invoice/proforma

See skills/README.md for how to import them into a pi agent. The runnable scripts in examples/ accompany these skills.

Notes

  • The SDK talks JSON by default (format="json"); XML is not yet supported.
  • Rate limit: the SmartBill API allows 30 calls / 10 seconds. A client-side limiter can be enabled with enforce_rate_limit=True.
  • Date fields use YYYY-MM-DD strings, matching the API.

See CHANGELOG.md for release history.

Disclaimer

This SDK was written by an AI agent (pi) which, to its credit. The code was generated from the official openapi.json spec, verified with a suite of 63 mocked tests, and refined until everything passed.

That said, please have a human review it before issuing real invoices — accountants work hard enough as it is, and the last thing they need is an enthusiastic model quietly deciding that the 9% reduced rate applies to shampoo.

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

smartbill_rest_sdk-1.0.0.tar.gz (119.1 kB view details)

Uploaded Source

Built Distribution

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

smartbill_rest_sdk-1.0.0-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartbill_rest_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 119.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for smartbill_rest_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 59f1cc8a25328e0bc5a805a8a0d6011b6e75200922134fdbb1a2b57fb2bba624
MD5 4876b750e0df8cac8d876d646a1f6ecd
BLAKE2b-256 0531d370ad1de70a574ee86300f649c112f697b1d36dee0618c6126a1c7f3e6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smartbill_rest_sdk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for smartbill_rest_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 609161e6f73ccfdb348ceccaec1e40b186126be926857df941c7ad31355c18e6
MD5 01873bd15752d47dd0fbbd8c2e7a809e
BLAKE2b-256 811ed1d43791692efc2ea4550daa39bb9f6c07c8ffbf77b3be1d11721eb76d27

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