Python SDK for the Bling ERP API with auth, pagination, and helpers.
Project description
Bling ERP API SDK
Português (BR) | English
Unofficial Python SDK for the Bling ERP API v3.
Provides typed, idiomatic access to 40+ Bling ERP resources with sync/async transports, OAuth2 authentication, rate limiting, and automatic retry.
Installation
pip install bling-erp-api
Or with uv:
uv add bling-erp-api
Python 3.12+ required.
Quick Start
Set the required environment variables (see Authentication):
export BLING_CLIENT_ID="your_client_id"
export BLING_CLIENT_SECRET="your_client_secret"
export BLING_REFRESH_TOKEN="your_refresh_token"
Then use the SDK:
from bling_erp_api import BlingClient
with BlingClient.from_env() as client:
# List products
products = client.produtos.listar(limit=10)
for product in products.get("data", []):
print(product.get("nome"))
# Get a contact
contact = client.contatos.obter(1)
print(contact)
Features
- 40+ resource modules covering the full Bling ERP API surface
- OAuth2 authentication via
bling-jwt-auth— automatic token refresh - Rate limiting (3 req/s default) with 429 retry and
Retry-Aftersupport - Typed models with Pydantic v2 — snake_case fields, automatic Bling name mapping
- Sync and async transports
- pt-BR canonical API with English compatibility aliases
- OpenAPI contract validation — generated and tested against the spec
- 500+ tests with mocked HTTP
Resources
| pt-BR Namespace | EN Alias | Description |
|---|---|---|
client.contatos |
client.contacts |
Contacts CRUD and status management |
client.produtos |
client.products |
Products CRUD and status |
client.produtos_estruturas |
client.product_structures |
Product structures (BOM) |
client.produtos_fornecedores |
client.product_suppliers |
Product suppliers |
client.produtos_lojas |
client.product_stores |
Product store mappings |
client.lotes |
client.product_batches |
Product batches |
client.lotes_lancamentos |
client.product_batch_entries |
Batch entries |
client.produtos_variacoes |
client.product_variations |
Product variations |
client.pedidos_vendas |
client.sales_orders |
Sales orders |
client.pedidos_compras |
client.purchase_orders |
Purchase orders |
client.notas_fiscais |
client.invoices |
NF-e (electronic invoices) |
client.notas_fiscais_consumidor |
client.consumer_invoices |
NFC-e (consumer invoices) |
client.notas_servicos |
client.service_invoices |
NFS-e (service invoices) |
client.anuncios |
client.ads |
Marketplace ads |
client.anuncios_categorias |
client.ad_categories |
Ad categories |
client.caixas_bancos |
client.cash_entries |
Cash and bank entries |
client.borderos |
client.payment_bundles |
Bordero management |
client.categorias_lojas |
client.store_categories |
Store categories |
client.categorias_produtos |
client.product_categories |
Product categories |
client.categorias_receitas_despesas |
client.income_expense_categories |
Income/expense categories |
client.contas_pagar |
client.accounts_payable |
Accounts payable |
client.contas_receber |
client.accounts_receivable |
Accounts receivable |
client.contas_contabeis |
client.financial_accounts |
Financial/chart of accounts |
client.depositos |
client.warehouses |
Warehouses |
client.empresas |
client.companies |
Company data |
client.estoques |
client.stock |
Stock balances |
client.formas_pagamentos |
client.payment_methods |
Payment methods |
client.grupos_produtos |
client.product_groups |
Product groups |
client.homologacao |
client.homologation |
Test/homologation |
client.logisticas |
client.logistics |
Logistics providers |
client.logisticas_servicos |
client.logistics_services |
Logistics services |
client.logisticas_objetos |
client.logistics_objects |
Logistics objects |
client.logisticas_etiquetas |
client.logistics_labels |
Shipping labels |
client.logisticas_remessas |
client.logistics_shipments |
Logistics shipments |
client.naturezas_operacoes |
client.natures_of_operations |
Tax natures |
client.notificacoes |
client.notifications |
Notifications |
client.ordens_producao |
client.production_orders |
Production orders |
client.propostas_comerciais |
client.commercial_proposals |
Commercial proposals |
client.situacoes |
client.situations |
Status/situations |
client.situacoes_modulos |
client.situation_modules |
Situation modules |
client.situacoes_transicoes |
client.situation_transitions |
Situation transitions |
client.vendedores |
client.sellers |
Sellers |
client.usuarios |
client.users |
User management |
Authentication
The SDK uses OAuth2 (authorization code flow) delegated to the
bling-jwt-auth package.
The simplest way to get started is with environment variables:
export BLING_CLIENT_ID="your_client_id"
export BLING_CLIENT_SECRET="your_client_secret"
export BLING_REFRESH_TOKEN="your_refresh_token"
export BLING_REDIRECT_URI="your_redirect_uri" # optional
Then create a client with BlingClient.from_env().
For custom authentication, pass a token_provider implementing
get_access_token() -> str or an httpx.Auth instance.
See the Authentication documentation for details.
Documentation
Full documentation is available at:
https://tempont.github.io/bling-erp-api-python/
Contributing
Contributions are welcome! See the full guide in CONTRIBUTING.md.
Quick start
git clone https://github.com/tempont/bling-erp-api-python.git
cd bling-erp-api-python
uv sync --all-groups
make check
Workflow
- Fork the repository
- Create a feature branch (
git checkout -b feat/my-feature) - Make your changes
- Verify with
make check(runs ruff, basedpyright, and pytest) - Commit with a clear message, push, and open a Pull Request
For detailed conventions on naming, docstrings, models, and resource implementation,
see the AGENTS.md file in the repository root.
Reporting Issues
Found a bug? Use the GitHub issue tracker.
When reporting, please include:
- Python version (
python --version) - SDK version (
bling-erp-api --version) - Minimal reproduction code
- Expected vs. actual behavior
For security issues, please report privately through GitHub's security channels.
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
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 bling_erp_api-0.2.0.tar.gz.
File metadata
- Download URL: bling_erp_api-0.2.0.tar.gz
- Upload date:
- Size: 438.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
755363cee86d9615b01185a43c34d218a164f200b542afe20fb34baf9b88d23a
|
|
| MD5 |
7ba6d9588f3e0d721d162e99dd2bcd7d
|
|
| BLAKE2b-256 |
a1a2be88afa31cc8002067c6d99e6e0bea3bcedc5848119d0435f3c1632a7711
|
Provenance
The following attestation bundles were made for bling_erp_api-0.2.0.tar.gz:
Publisher:
publish.yml on tempont/bling-erp-api-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bling_erp_api-0.2.0.tar.gz -
Subject digest:
755363cee86d9615b01185a43c34d218a164f200b542afe20fb34baf9b88d23a - Sigstore transparency entry: 1970675249
- Sigstore integration time:
-
Permalink:
tempont/bling-erp-api-python@1bbff1267de41407c7df96bba80ac9b28e27ce76 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/tempont
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1bbff1267de41407c7df96bba80ac9b28e27ce76 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bling_erp_api-0.2.0-py3-none-any.whl.
File metadata
- Download URL: bling_erp_api-0.2.0-py3-none-any.whl
- Upload date:
- Size: 350.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
341c8aa19e7997f230128359d4f006bb2e2e023b93da7138ea63f74fa0f2b655
|
|
| MD5 |
a518fad5f920ebfc7c0d2262cc789439
|
|
| BLAKE2b-256 |
af27091833596ffebaf7f3d5bf684cf67e1830c8584de8c1f6ea4ef710f0c29c
|
Provenance
The following attestation bundles were made for bling_erp_api-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on tempont/bling-erp-api-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bling_erp_api-0.2.0-py3-none-any.whl -
Subject digest:
341c8aa19e7997f230128359d4f006bb2e2e023b93da7138ea63f74fa0f2b655 - Sigstore transparency entry: 1970675264
- Sigstore integration time:
-
Permalink:
tempont/bling-erp-api-python@1bbff1267de41407c7df96bba80ac9b28e27ce76 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/tempont
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1bbff1267de41407c7df96bba80ac9b28e27ce76 -
Trigger Event:
push
-
Statement type: