Developer Reference

Official SDKs & API Reference

The definitive reference for integrating Scell.io. Type-safe SDKs for TypeScript and PHP, plus an MCP agent for AI-powered workflows. Every resource, every method, fully documented.

TypeScript

TypeScript SDK

TypeScript / JavaScript

v1.10.0

Installation

npm install @scell/sdk

Features

  • Full TypeScript typings
  • Promise-based async/await API
  • 3 client classes (Bearer, API Key, Tenant)
  • Invoices, Signatures, Fiscal, Webhooks
  • Multi-tenant support built-in
  • Sandbox mode with sk_test_ / tk_test_ prefixes
PHP

PHP SDK

PHP 8.2+

latest

Installation

composer require scell/sdk

Features

  • PHP 8.2+ with strict types
  • PSR-4 autoloading
  • Laravel auto-discovery (config/scell.php)
  • 3 client classes (Bearer, API Key, Tenant)
  • Invoices, Signatures, Fiscal, Webhooks
  • Sandbox mode built-in
🤖

MCP Agent

Claude Desktop / Cursor / VS Code

v1.6.0

Installation

npx @scell/mcp-client claude <your-api-key>

Features

  • MCP Protocol compatible
  • Claude Desktop, Cursor, VS Code
  • 33 tools for invoices, signatures, fiscal
  • Zero runtime dependencies
  • Sandbox mode support

Installation

Install the official Scell.io SDK for your platform. All three options connect to the same API.

TypeScript / PHP

terminal
typescript
npm install @scell/sdk
# or with yarn
yarn add @scell/sdk
# or with pnpm
pnpm add @scell/sdk

MCP Agent

terminal
bash
# Claude Desktop
npx @scell/mcp-client claude YOUR_API_KEY

# Cursor
npx @scell/mcp-client cursor YOUR_API_KEY

# VS Code
npx @scell/mcp-client vscode YOUR_API_KEY

Authentication

Scell.io supports three authentication modes, each with a dedicated client class.

ModeClient ClassKey PrefixUse Case
Bearer TokenScellClientSanctum tokenDashboard sessions, user-facing operations
API KeyScellApiClientsk_live_* / sk_test_*Server-to-server, backend integrations
Tenant KeyScellTenantClienttk_live_* / tk_test_*Multi-tenant partner platforms

Bearer Token (Dashboard)

Use ScellClient with a Sanctum bearer token for dashboard user operations. Resources: auth, companies, apiKeys, balance, webhooks, invoices (read), signatures (read).

auth-bearer.ts
typescript
import { ScellClient } from '@scell/sdk';
// Authenticate with a Sanctum bearer token (dashboard sessions)
const client = new ScellClient('your_bearer_token');
// Resources available on ScellClient:
// client.auth — login, register, logout, me
// client.companies — CRUD on companies + KYC
// client.apiKeys — manage API keys
// client.balance — check balance, reload, transactions
// client.webhooks — manage webhooks
// client.invoices — read-only invoice access
// client.signatures — read-only signature access
const me = await client.auth.me();
console.log(me.email);

API Key (Server-to-Server)

Use ScellApiClient with a secret key (sk_live_* or sk_test_*) for full server-to-server operations. Resources: invoices, signatures, creditNotes, subTenants, fiscal, stats, billing, tenantInvoices, tenantCreditNotes, incomingInvoices.

auth-api-key.ts
typescript
import { ScellApiClient } from '@scell/sdk';
// Production
const client = new ScellApiClient('sk_live_your_api_key');
// Sandbox mode (sk_test_ prefix)
const sandbox = new ScellApiClient('sk_test_your_api_key');
// Resources available on ScellApiClient:
// client.invoices — full invoice CRUD + submit + download
// client.signatures — full signature CRUD + cancel + remind
// client.creditNotes — credit note management
// client.subTenants — manage sub-tenants
// client.fiscal — fiscal compliance (NF525/ISCA)
// client.stats — overview + monthly statistics
// client.billing — billing, usage, top-up
// client.tenantInvoices — tenant direct invoices
// client.tenantCreditNotes — tenant credit notes
// client.incomingInvoices — incoming invoice management

Tenant Key (Multi-Tenant Partner)

Use ScellTenantClient with a tenant key (tk_live_* or tk_test_*) for multi-tenant partner operations. Also exposes direct methods: me(), updateProfile(), balance(), quickStats(), regenerateKey().

auth-tenant.ts
typescript
import { ScellTenantClient } from '@scell/sdk';
// Production
const client = new ScellTenantClient('tk_live_your_tenant_key');
// Sandbox mode
const sandbox = new ScellTenantClient('tk_test_your_tenant_key');
// Resources:
// client.directInvoices — create invoices for sub-tenants
// client.directCreditNotes — create credit notes
// client.incomingInvoices — manage incoming invoices
// client.subTenantCreditNotes — sub-tenant credit notes
// client.fiscal — fiscal compliance
// client.billing — billing & usage
// client.stats — statistics
// client.subTenants — manage sub-tenants
// Direct methods on ScellTenantClient:
// client.me() — tenant profile
// client.updateProfile() — update profile
// client.balance() — check balance
// client.quickStats() — summary stats
// client.regenerateKey() — regenerate tenant key

API Reference

Complete method reference for every SDK resource. Code examples in TypeScript and PHP for each resource.

Invoices

7 methods

Create, validate, submit, and download electronic invoices in Factur-X, UBL, and CII formats. Available on ScellApiClient (full CRUD) and ScellClient (read-only).

MethodDescription
list(options?)List invoices with optional pagination and filters
get(id)Get a single invoice by its UUID
create(data)Create a new invoice (Factur-X, UBL, or CII format)
submit(id)Submit a validated invoice to the PDP network
download(id, type)Download as PDF or XML. type: "pdf" | "xml" | "facturx"
auditTrail(id)Get the full audit trail (creation, validation, submission, etc.)
convert(data)Convert between invoice formats (Factur-X, UBL, CII)
invoices.ts
typescript
import { ScellApiClient } from '@scell/sdk';
const scell = new ScellApiClient('sk_live_your_api_key');
// Create a Factur-X invoice
const invoice = await scell.invoices.create({
format: 'facturx',
issue_date: '2026-03-30',
due_date: '2026-04-30',
currency: 'EUR',
seller: {
name: 'ACME Corp',
siren: '123456789',
vat_number: 'FR12345678901',
address: {
street: '10 Rue de la Paix',
city: 'Paris',
postal_code: '75002',
country: 'FR',
},
},
buyer: {
name: 'Client SA',
siren: '987654321',
vat_number: 'FR98765432100',
address: {
street: '5 Avenue des Champs',
city: 'Lyon',
postal_code: '69001',
country: 'FR',
},
},
lines: [
{
description: 'Consulting services',
quantity: 10,
unit_price: 150.00,
vat_rate: 20.0,
},
],
});
console.log(invoice.id); // UUID
console.log(invoice.status); // 'draft' | 'validated' | ...
console.log(invoice.total_amount);
// Submit invoice to PDP
await scell.invoices.submit(invoice.id);
// Download PDF
const pdf = await scell.invoices.download(invoice.id, 'pdf');
// Get audit trail
const trail = await scell.invoices.auditTrail(invoice.id);

Signatures

6 methods

Create eIDAS EU-SES simple electronic signature requests with SMS OTP authentication. Supports multiple signers, ordered signing, and redirect URLs. Available on ScellApiClient.

MethodDescription
list(options?)List signature requests with optional filters
get(id)Get a signature request by ID
create(data)Create a new eIDAS EU-SES signature request
cancel(id)Cancel a pending signature request
remind(id)Send a reminder to pending signers
download(id, type)Download the signed document or proof file
signatures.ts
typescript
import { ScellApiClient } from '@scell/sdk';
const scell = new ScellApiClient('sk_live_your_api_key');
const signature = await scell.signatures.create({
name: 'Service Agreement Q2 2026',
document: {
content: 'base64_encoded_pdf_content_here',
filename: 'agreement.pdf',
},
signers: [
{
first_name: 'Jean',
last_name: 'Dupont',
email: 'jean.dupont@example.com',
phone: '+33612345678',
},
{
first_name: 'Marie',
last_name: 'Martin',
email: 'marie.martin@example.com',
phone: '+33698765432',
},
],
message: 'Please review and sign this agreement.',
ordered: true,
redirect_url: 'https://yourapp.com/signature/complete',
});
console.log(signature.id);
console.log(signature.status); // 'pending' | 'completed' | ...
console.log(signature.signing_url);
// Cancel a signature request
await scell.signatures.cancel(signature.id);
// Send a reminder
await scell.signatures.remind(signature.id);
// Download the signed document
const signed = await scell.signatures.download(signature.id, 'signed');

Credit Notes

6 methods

Create credit notes linked to existing invoices. Supports partial and full refunds. Available on ScellApiClient.

MethodDescription
list()List all credit notes
get(id)Get a credit note by ID
create(data)Create a credit note linked to an invoice
delete(id)Delete a draft credit note
download(id)Download credit note as PDF
send(id)Send the credit note to the recipient
credit-notes.ts
typescript
import { ScellApiClient } from '@scell/sdk';
const scell = new ScellApiClient('sk_live_your_api_key');
// Create a credit note linked to an invoice
const creditNote = await scell.creditNotes.create({
invoice_id: 'inv_uuid_here',
reason: 'Partial refund for returned goods',
lines: [
{
description: 'Returned item refund',
quantity: 2,
unit_price: 75.00,
vat_rate: 20.0,
},
],
});
console.log(creditNote.id);
console.log(creditNote.status);
// List all credit notes
const list = await scell.creditNotes.list();
// Download as PDF
const pdf = await scell.creditNotes.download(creditNote.id);
// Send to recipient
await scell.creditNotes.send(creditNote.id);

Companies

7 methods

Manage company entities with legal information (SIREN, VAT number, address). Includes KYC/KYB verification flow. Available on ScellClient (Bearer token).

MethodDescription
list()List all companies for the authenticated user
get(id)Get a company by ID
create(data)Register a new company with legal details
update(id, data)Update company information
delete(id)Delete a company
initiateKyc(id)Start KYC/KYB identity verification process
kycStatus(id)Check the current KYC verification status
companies.ts
typescript
import { ScellClient } from '@scell/sdk';
const client = new ScellClient('your_bearer_token');
// Create a company
const company = await client.companies.create({
name: 'ACME Corp',
siren: '123456789',
vat_number: 'FR12345678901',
address: {
street: '10 Rue de la Paix',
city: 'Paris',
postal_code: '75002',
country: 'FR',
},
});
// List all companies
const companies = await client.companies.list();
// Update a company
await client.companies.update(company.id, { name: 'ACME Corp Updated' });
// Initiate KYC/KYB verification
await client.companies.initiateKyc(company.id);
// Check KYC status
const kyc = await client.companies.kycStatus(company.id);
console.log(kyc.status); // 'pending' | 'approved' | 'rejected'

API Keys

4 methods

Create and manage API keys for server-to-server authentication. Keys can be live (sk_live_*) or sandbox (sk_test_*). The secret key value is only shown once at creation time. Available on ScellClient (Bearer token).

MethodDescription
list()List all API keys for the account
get(id)Get an API key by ID (key value is masked)
create(data)Create a new API key (live or test environment)
delete(id)Revoke and delete an API key
api-keys.ts
typescript
import { ScellClient } from '@scell/sdk';
const client = new ScellClient('your_bearer_token');
// Create a new API key
const key = await client.apiKeys.create({
name: 'Production Key',
environment: 'live', // 'live' | 'test'
});
console.log(key.id);
console.log(key.key); // sk_live_... (shown only once)
// List all API keys
const keys = await client.apiKeys.list();
// Delete an API key
await client.apiKeys.delete(key.id);

Balance

4 methods

Check credit balance, reload credits, configure low-balance alerts, and view transaction history. Available on ScellClient (Bearer token).

MethodDescription
get()Get current credit balance and currency
reload(data)Reload credits with a payment method
updateSettings(data)Update low balance threshold and auto-reload settings
transactions()List all credit transactions (purchases, consumption, top-ups)
balance.ts
typescript
import { ScellClient } from '@scell/sdk';
const client = new ScellClient('your_bearer_token');
// Get current balance
const balance = await client.balance.get();
console.log(balance.credits);
console.log(balance.currency);
// Reload credits
await client.balance.reload({
amount: 500,
payment_method: 'card',
});
// Update alert settings
await client.balance.updateSettings({
low_balance_threshold: 50,
auto_reload: true,
auto_reload_amount: 200,
});
// List credit transactions
const transactions = await client.balance.transactions();

Webhooks

8 methods

Manage webhook endpoints to receive real-time notifications. Each webhook has a signing secret (wh_sec_*) for HMAC-SHA256 payload verification. Supports event filtering, testing, and delivery logs. Available on ScellClient (Bearer token).

MethodDescription
list()List all webhook endpoints
get(id)Get webhook details by ID
create(data)Create a new webhook endpoint with event subscriptions
update(id, data)Update webhook URL, events, or active status
delete(id)Delete a webhook endpoint
test(id)Send a test event payload to the webhook URL
regenerateSecret(id)Regenerate the webhook signing secret (wh_sec_...)
logs(id)View delivery logs and response codes for a webhook
webhooks.ts
typescript
import { ScellClient } from '@scell/sdk';
const client = new ScellClient('your_bearer_token');
// Create a webhook endpoint
const webhook = await client.webhooks.create({
url: 'https://yourapp.com/webhooks/scell',
events: [
'invoice.created',
'invoice.validated',
'signature.completed',
'balance.low',
],
active: true,
});
console.log(webhook.id);
console.log(webhook.secret); // wh_sec_... (for signature verification)
// List all webhooks
const list = await client.webhooks.list();
// Update a webhook
await client.webhooks.update(webhook.id, {
events: ['invoice.created', 'signature.completed'],
});
// Test a webhook (sends a test payload)
await client.webhooks.test(webhook.id);
// Regenerate the signing secret
const newSecret = await client.webhooks.regenerateSecret(webhook.id);
// View delivery logs
const logs = await client.webhooks.logs(webhook.id);
// Delete a webhook
await client.webhooks.delete(webhook.id);

Fiscal Compliance

22 methods

Full NF525/ISCA fiscal compliance suite. Immutable ledger with SHA-256 hash chain, daily/monthly closings, RFC 3161 TSA anchoring, FEC export, kill switch for emergency shutdown, and a rules engine for automation. Available on ScellApiClient and ScellTenantClient.

MethodDescription
compliance()Get overall fiscal compliance status (NF525)
entries()List immutable SHA-256 hash chain ledger entries
closings()List daily and monthly fiscal closings
dailyClosing()Trigger an immediate daily closing
integrity()Run a full hash chain integrity check
integrityHistory()Get history of all integrity verifications
integrityForDate(date)Verify integrity for a specific date
rules()List all fiscal automation rules
createRule(data)Create a new fiscal rule (key, value, description)
updateRule(id, data)Update an existing fiscal rule
ruleDetail(key)Get details of a fiscal rule by key
ruleHistory(key)Get change history for a fiscal rule
exportRules()Export all fiscal rules as a downloadable file
replayRules()Replay all fiscal rules (recompute derived data)
anchors()List RFC 3161 TSA timestamp anchors
killSwitchStatus()Get kill switch status (emergency shutdown)
activateKillSwitch()Activate kill switch (halts all fiscal operations)
deactivateKillSwitch()Deactivate kill switch (resume operations)
fecExport()Generate FEC export for French tax authorities
forensicExport()Generate forensic export with complete audit data
attestation(year)Get NF525 compliance attestation for a given year
attestationDownload(year)Download the attestation PDF for a given year
fiscal.ts
typescript
import { ScellApiClient } from '@scell/sdk';
const scell = new ScellApiClient('sk_live_your_api_key');
// ─── Compliance overview ───────────────────────────────
const status = await scell.fiscal.compliance();
console.log(status.is_compliant); // true | false
console.log(status.nf525_status);
// ─── Immutable ledger entries ──────────────────────────
const entries = await scell.fiscal.entries();
// ─── Closings ──────────────────────────────────────────
const closings = await scell.fiscal.closings();
await scell.fiscal.dailyClosing(); // Trigger a daily closing
// ─── Integrity verification ───────────────────────────
const integrity = await scell.fiscal.integrity();
const history = await scell.fiscal.integrityHistory();
const forDate = await scell.fiscal.integrityForDate('2026-03-30');
// ─── Fiscal rules engine ──────────────────────────────
const rules = await scell.fiscal.rules();
const newRule = await scell.fiscal.createRule({
key: 'auto_daily_closing',
value: true,
description: 'Automatically trigger daily closings at midnight',
});
await scell.fiscal.updateRule(newRule.id, { value: false });
const detail = await scell.fiscal.ruleDetail('auto_daily_closing');
const ruleHist = await scell.fiscal.ruleHistory('auto_daily_closing');
await scell.fiscal.exportRules();
await scell.fiscal.replayRules();
// ─── TSA Anchors ──────────────────────────────────────
const anchors = await scell.fiscal.anchors();
// ─── Kill switch ──────────────────────────────────────
const ksStatus = await scell.fiscal.killSwitchStatus();
await scell.fiscal.activateKillSwitch();
await scell.fiscal.deactivateKillSwitch();
// ─── Exports ──────────────────────────────────────────
const fec = await scell.fiscal.fecExport();
const forensic = await scell.fiscal.forensicExport();
const attestation = await scell.fiscal.attestation(2026);
const download = await scell.fiscal.attestationDownload(2026);

Stats

2 methods

Get aggregated and monthly statistics for invoices, signatures, and revenue. Available on ScellApiClient and ScellTenantClient.

MethodDescription
overview()Get aggregated statistics (total invoices, signatures, revenue)
monthly()Get month-by-month breakdown of activity and revenue
stats.ts
typescript
import { ScellApiClient } from '@scell/sdk';
const scell = new ScellApiClient('sk_live_your_api_key');
// Get overview statistics
const overview = await scell.stats.overview();
console.log(overview.total_invoices);
console.log(overview.total_signatures);
console.log(overview.total_revenue);
// Get monthly breakdown
const monthly = await scell.stats.monthly();
monthly.forEach(m => {
console.log(m.month, m.invoices_count, m.revenue);
});

Billing

7 methods

Manage billing invoices from Scell.io, view usage metrics, top up credits, and list billing transactions. Available on ScellApiClient and ScellTenantClient.

MethodDescription
invoices()List all billing invoices (Scell.io charges to your account)
showInvoice(id)Get details of a specific billing invoice
downloadInvoice(id)Download a billing invoice as PDF
usage()Get current period usage metrics (invoices, signatures, credits)
topUp(data)Initiate a credit top-up
confirmTopUp(data)Confirm a pending top-up with confirmation code
transactions()List all billing transactions
billing.ts
typescript
import { ScellApiClient } from '@scell/sdk';
const scell = new ScellApiClient('sk_live_your_api_key');
// List billing invoices
const invoices = await scell.billing.invoices();
// Get a specific billing invoice
const inv = await scell.billing.showInvoice('billing_inv_id');
// Download billing invoice PDF
const pdf = await scell.billing.downloadInvoice('billing_inv_id');
// Get current usage metrics
const usage = await scell.billing.usage();
console.log(usage.invoices_used);
console.log(usage.signatures_used);
console.log(usage.credits_remaining);
// Top up credits
await scell.billing.topUp({ amount: 100, payment_method: 'card' });
// Confirm a pending top-up
await scell.billing.confirmTopUp({ top_up_id: 'tu_id', confirmation_code: '1234' });
// List billing transactions
const transactions = await scell.billing.transactions();

Sub-Tenants

7 methods

Manage sub-tenants for multi-tenant partner platforms. Each sub-tenant gets their own tenant key (tk_live_*) and can be identified by your external ID system. Available on ScellApiClient and ScellTenantClient.

MethodDescription
list()List all sub-tenants
get(id)Get sub-tenant details by ID
create(data)Create a new sub-tenant with company details
update(id, data)Update sub-tenant information
delete(id)Delete a sub-tenant
findByExternalId(externalId)Look up a sub-tenant by your external ID
statsOverview(id)Get usage statistics for a specific sub-tenant
sub-tenants.ts
typescript
import { ScellApiClient } from '@scell/sdk';
const scell = new ScellApiClient('sk_live_your_api_key');
// Create a sub-tenant
const tenant = await scell.subTenants.create({
name: 'Partner Corp',
external_id: 'partner-001',
email: 'admin@partner-corp.com',
company: {
name: 'Partner Corp',
siren: '111222333',
address: {
street: '20 Boulevard Haussmann',
city: 'Paris',
postal_code: '75009',
country: 'FR',
},
},
});
console.log(tenant.id);
console.log(tenant.tenant_key); // tk_live_...
// List all sub-tenants
const list = await scell.subTenants.list();
// Get a specific sub-tenant
const detail = await scell.subTenants.get(tenant.id);
// Find by external ID
const found = await scell.subTenants.findByExternalId('partner-001');
// Update a sub-tenant
await scell.subTenants.update(tenant.id, { name: 'Partner Corp (Updated)' });
// Get sub-tenant stats
const stats = await scell.subTenants.statsOverview(tenant.id);
// Delete a sub-tenant
await scell.subTenants.delete(tenant.id);

MCP Agent@scell/mcp-client v1.6.0

Use Scell.io directly from your AI assistant. The MCP agent exposes 33 tools that let Claude, Cursor, or VS Code Copilot create invoices, manage signatures, and monitor fiscal compliance using natural language.

Setup

terminal
bash
# Claude Desktop
npx @scell/mcp-client claude YOUR_API_KEY

# Cursor
npx @scell/mcp-client cursor YOUR_API_KEY

# VS Code
npx @scell/mcp-client vscode YOUR_API_KEY

Invoices5 tools

ToolDescriptionExample Prompt
create_invoiceCreate a Factur-X/UBL/CII electronic invoice"Create a Factur-X invoice from ACME Corp to Client SA for 10 hours of consulting at 150 EUR/h"
list_invoicesList all invoices with optional filters"Show me all invoices from this month"
get_invoiceGet details of a specific invoice by ID"Get details for invoice inv_abc123"
submit_invoiceSubmit an invoice to the PDP network"Submit invoice inv_abc123 to the PDP"
download_invoiceDownload an invoice as PDF or XML"Download the PDF for invoice inv_abc123"

Signatures4 tools

ToolDescriptionExample Prompt
create_signatureCreate an eIDAS EU-SES signature request"Create a signature request for agreement.pdf with 2 signers: Jean Dupont and Marie Martin"
list_signaturesList all signature requests"List all pending signature requests"
get_signatureGet signature request details"What's the status of signature sig_xyz789?"
cancel_signatureCancel a pending signature request"Cancel signature request sig_xyz789"

Credit Notes2 tools

ToolDescriptionExample Prompt
create_credit_noteCreate a credit note linked to an invoice"Create a credit note for invoice inv_abc123 with a 150 EUR refund"
list_credit_notesList all credit notes"Show all credit notes issued this quarter"

Companies3 tools

ToolDescriptionExample Prompt
get_companyGet company details"Show me the details for company comp_id"
list_companiesList all registered companies"List all my companies"
create_companyRegister a new company"Register company ACME Corp with SIREN 123456789"

Balance3 tools

ToolDescriptionExample Prompt
get_balanceGet current credit balance"What's my current credit balance?"
list_transactionsList credit transactions"Show my last 10 credit transactions"
reload_balanceReload credits"Add 500 credits to my balance"

Webhooks2 tools

ToolDescriptionExample Prompt
list_webhooksList all webhook endpoints"Show all my webhook endpoints"
create_webhookCreate a new webhook endpoint"Create a webhook at https://myapp.com/hook for invoice.created events"

Fiscal12 tools

ToolDescriptionExample Prompt
get_fiscal_complianceGet fiscal compliance status"Am I NF525 compliant?"
get_fiscal_entriesGet immutable ledger entries"Show the last 50 fiscal entries"
get_fiscal_closingsList daily/monthly closings"Show all fiscal closings for March 2026"
fiscal_daily_closingTrigger a daily fiscal closing"Run the daily fiscal closing now"
get_fiscal_integrityVerify hash chain integrity"Verify fiscal data integrity"
get_fec_exportExport FEC file for tax authorities"Generate the FEC export for 2025"
get_attestationGet NF525 attestation for a year"Get my NF525 attestation for 2025"
get_kill_switch_statusGet kill switch status"Is the kill switch active?"
activate_kill_switchActivate emergency kill switch"Activate the kill switch immediately"
deactivate_kill_switchDeactivate kill switch"Deactivate the kill switch"
get_fiscal_rulesList fiscal automation rules"Show all fiscal rules"
create_fiscal_ruleCreate a fiscal automation rule"Create a rule to auto-close daily at midnight"

Sub-Tenants2 tools

ToolDescriptionExample Prompt
list_sub_tenantsList all sub-tenants"Show all my sub-tenants"
create_sub_tenantCreate a new sub-tenant"Create a sub-tenant for Partner Corp with external ID partner-001"

Webhook Events

Complete list of webhook events you can subscribe to. Use these event names when creating or updating webhook endpoints.

EventDescription
invoice.createdInvoice has been created
invoice.validatedInvoice validated (Factur-X/UBL generated)
invoice.submittedInvoice submitted to PDP
invoice.acceptedInvoice accepted by recipient
invoice.rejectedInvoice rejected
invoice.paidInvoice marked as paid
signature.createdSignature request created
signature.signedDocument signed by a signer
signature.completedAll signers have signed
signature.declinedSignature declined
signature.expiredSignature request expired
balance.lowCredit balance is low (alert threshold)
balance.depletedCredit balance is depleted
kyb.approvedKYB verification approved
kyb.rejectedKYB verification rejected

Error Handling

All SDK methods throw typed exceptions with HTTP status codes. Handle errors appropriately based on the status code.

CodeStatusDescription
400Bad RequestMalformed request body or invalid parameters
401UnauthorizedMissing, invalid, or expired authentication credentials
402Payment RequiredInsufficient credit balance to complete the operation
403ForbiddenValid credentials but insufficient permissions for the resource
404Not FoundThe requested resource does not exist
409ConflictResource already exists or state conflict (e.g. duplicate submission)
422Unprocessable EntityValidation error. Check the errors object for field-level details
429Too Many RequestsRate limit exceeded. Check Retry-After header
500Server ErrorInternal server error. Retry with exponential backoff
503Service UnavailableService temporarily unavailable. Retry after a short delay

Retry Strategy

  • 1.429 Rate LimitedRespect the Retry-After header. The SDK auto-retries up to 3 times with the indicated delay.
  • 2.500/503 Server ErrorRetry with exponential backoff: 1s, 2s, 4s. Max 3 retries. The SDK handles this automatically.
  • 3.4xx Client ErrorDo not retry. Fix the request payload or credentials and try again.
error-handling.ts
typescript
import { ScellApiClient } from '@scell/sdk';
const scell = new ScellApiClient('sk_live_your_api_key');
try {
const invoice = await scell.invoices.create({ /* ... */ });
} catch (error) {
if (error.status === 422) {
// Validation error — check error.errors for field-level details
console.error('Validation:', error.errors);
// { "seller.siren": ["The siren must be 9 digits."] }
} else if (error.status === 401) {
// Invalid or expired API key
console.error('Authentication failed');
} else if (error.status === 402) {
// Insufficient credits
console.error('Insufficient balance — top up credits');
} else if (error.status === 404) {
// Resource not found
console.error('Resource not found');
} else if (error.status === 429) {
// Rate limited — retry after error.retryAfter seconds
console.error('Rate limited, retry after', error.retryAfter, 'seconds');
} else if (error.status >= 500) {
// Server error — retry with exponential backoff
console.error('Server error, retrying...');
}
}

Ready to integrate?

Create your account and get your API keys in minutes. Start with 100 free credits.