Quickstart
Quickstart: create an invoice in Python
No official SDK — use requests (bring your own client)
There is no official Python SDK for Scell.io. Since the API is 100% REST + JSON, any HTTP client works: `requests` (sync), `httpx` (async/sync), `aiohttp` (async). Pattern: `X-API-Key` header, snake_case JSON body, manual retries recommended (urllib3 Retry adapter). Compatible with FastAPI, Django, Flask, CLI scripts, and Jupyter notebooks. For Pydantic, derive your models from `docs/api/openapi.json` (published on api.scell.io).
Key facts
- Requirements: Python 3.10+, `pip install requests`
- No official SDK: bring your own (requests, httpx, aiohttp)
- Env var: `os.environ['SCELL_API_KEY']`
- HTTP: `requests` recommended for simplicity
- Expected output: JSON dict with `id`, `status`, `pdf_url`
- Error codes: `response.raise_for_status()` + try/except `requests.HTTPError`
Code example
import os
import uuid
import requests
API = "https://api.scell.io/api/v1"
HEADERS = {
"X-API-Key": os.environ["SCELL_API_KEY"],
"Content-Type": "application/json",
}
def call(path, body):
h = {**HEADERS, "Idempotency-Key": str(uuid.uuid4())}
r = requests.post(f"{API}{path}", headers=h, json=body, timeout=30)
r.raise_for_status()
return r.json()
seller = {
"siret": "12345678901234", "name": "Ma SAS", "vat_number": "FR12345678901",
"address": {"street": "1 rue Test", "city": "Paris", "postal_code": "75001", "country": "FR"},
}
# 1. Facture B2B
b2b = call("/invoices", {
"format": "factur-x", "profile": "EN16931", "currency": "EUR", "seller": seller,
"buyer": {
"siret": "98765432109876", "name": "Client SARL",
"address": {"street": "2 avenue Demo", "city": "Lyon", "postal_code": "69001", "country": "FR"},
},
"lines": [{"description": "Prestation conseil", "quantity": 1, "unit_price": 1000.0, "vat_rate": 20.0}],
})
print(f"B2B: {b2b['id']} ({b2b['status']})")
# 2. Facture B2C (particulier)
b2c = call("/invoices", {
"format": "factur-x", "profile": "EN16931", "currency": "EUR", "seller": seller,
"buyer": {
"buyer_is_individual": True, "name": "Jean Dupont", "email": "jean@example.com",
"address": {"street": "3 bd Client", "city": "Marseille", "postal_code": "13001", "country": "FR"},
},
"lines": [{"description": "Abonnement", "quantity": 1, "unit_price": 49.90, "vat_rate": 20.0}],
})
print(f"B2C: {b2c['id']} ({b2c['status']})")
# 3. Signature simple eIDAS EU-SES
sig = call("/signatures", {
"document_url": "https://example.com/contrat.pdf",
"signers": [{"name": "Jean Dupont", "email": "jean@example.com", "phone": "+33612345678"}],
"signature_options": {"signature_mode": "drawn", "timezone": "Europe/Paris"},
})
print(f"Signature: {sig['id']} -> {sig['signing_url']}")