Skip to main content
Developer Portal

SDKs & Libraries

Official client libraries for Python, Node.js, and raw REST HTTP. Built with native TypeScript types, automatic token rotation, and robust retries.

Python SDK

Production ready client
v1.0.0
Async support (asyncio)Type hintsAutomatic retriesWebhook verification
pip install cantarell-sdk

QUICKSTART EXAMPLE

from cantarell import CantarellClient

# Initialize with your API key
client = CantarellClient("sk_live_your_key_here")

# List orders
orders = client.orders.list(limit=10)
for order in orders.data:
    print(f"{order.id}: {order.product} — {order.total_mxn} MXN")

# Create a payment
payment = client.payments.create(
    amount=225000,
    currency="MXN",
    clabe="012180000000000001",
    reference="INV-2024-001"
)
print(f"Payment {payment.id}: {payment.status}")

# Register a webhook
webhook = client.webhooks.create(
    url="https://yoursite.com/webhook",
    events=["order.*", "payment.*"]
)
print(f"Webhook secret: {webhook.secret}")

# Verify webhook signature
from cantarell.webhooks import verify_signature
is_valid = verify_signature(
    secret=webhook.secret,
    payload=request.body,
    signature=request.headers["X-Cantarell-Signature-256"],
    timestamp=request.headers["X-Cantarell-Timestamp"],
)

Node.js SDK

Production ready client
v1.0.0
TypeScript-firstPromise-basedAutomatic retriesWebhook verification
npm install @cantarell/sdk

QUICKSTART EXAMPLE

import { CantarellClient } from '@cantarell/sdk';

// Initialize with your API key
const client = new CantarellClient('sk_live_your_key_here');

// List orders
const orders = await client.orders.list({ limit: 10 });
orders.data.forEach(order => {
  console.log(`${order.id}: ${order.product} — ${order.totalMxn} MXN`);
});

// Create a payment
const payment = await client.payments.create({
  amount: 225000,
  currency: 'MXN',
  clabe: '012180000000000001',
  reference: 'INV-2024-001',
});
console.log(`Payment ${payment.id}: ${payment.status}`);

// Register a webhook
const webhook = await client.webhooks.create({
  url: 'https://yoursite.com/webhook',
  events: ['order.*', 'payment.*'],
});
console.log(`Webhook secret: ${webhook.secret}`);

// Verify webhook signature (Express example)
import { verifyWebhook } from '@cantarell/sdk/webhooks';

app.post('/webhook', (req, res) => {
  const isValid = verifyWebhook({
    secret: process.env.WEBHOOK_SECRET,
    payload: req.body,
    signature: req.headers['x-cantarell-signature-256'],
    timestamp: req.headers['x-cantarell-timestamp'],
  });
  if (!isValid) return res.status(401).send('Invalid signature');
  // Process event...
  res.status(200).send('OK');
});

cURL / HTTP

Universal REST

No SDK required. Directly call any endpoint with standard HTTPS requests from any language, workflow engine, or API client like Postman or Insomnia.

Base Endpoint
https://api.cantarell-os.tech/api/v2

COMMON REQUEST PATTERNS

# List orders
curl -X GET https://api.cantarell-os.tech/api/v2/orders \
  -H "Authorization: Bearer sk_live_..."

# Create a webhook
curl -X POST https://api.cantarell-os.tech/api/v2/webhooks \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"url":"https://you.com/hook","events":["order.*"]}'

# Get credit score
curl -X GET https://api.cantarell-os.tech/api/v2/credit/score \
  -H "Authorization: Bearer sk_live_..."
Cantarell OS - The Operating System for Fuel Markets