Skip to main content

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

Project description

smartbill-rest-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-rest-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.2.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.2-py3-none-any.whl (21.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smartbill_rest_sdk-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 530e9e77c5ed11dbe3c40b1f5268369deb88ca5e4ccb65d8e94533288a4cdc5f
MD5 77f5bfcba0c6ba489bf89501c2ce45c8
BLAKE2b-256 52bd6ee75031e49cbb373da69867f541f7c0d4d73a5bd9ef994b4babd1598706

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smartbill_rest_sdk-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 13ca36da687bdf326acac703a62636024929f85442fc3f4781ed28c5dca3c21e
MD5 818934c44db4251714442698acb92ed1
BLAKE2b-256 4885188c6df2cdc535325407883c8711c34f28a21238eb9afef385ce1065f08d

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