bexio API: The Complete 2026 Guide for Swiss Freelancers
Connect Switzerland's most popular business software with virtually any tool you use. OAuth 2.0 setup, code examples, and a simpler invoice API alternative compared.

Stop the Manual Data Entry.
Automate Everything.
You're spending hours on manual data entry between your tools. Your invoicing app doesn't talk to your CRM. Your e-commerce store requires copy-pasting orders into accounting software. The bexio API solves this—connecting 40,000+ Swiss businesses with virtually any other tool.
5+ Hours Weekly
Lost to manual data entryDisconnected Tools
Apps that don't talk to each otherCopy-Paste Chaos
Orders manually entered into accountingWhat Is the bexio API?
An API (Application Programming Interface) lets different software systems exchange data automatically. The bexio API is a RESTful interface that exposes bexio's core features—contacts, invoices, accounting, inventory—to external applications.
In practical terms: Instead of manually creating an invoice in bexio after completing a project, your project management tool can trigger automatic invoice creation. Instead of copying customer details from your webshop, orders flow directly into bexio.
The API uses HTTPS and JSON format, making it compatible with any programming language. bexio currently offers API version 3.0.0.
What You Can Automate
| Function | API Capability |
|---|---|
| Contacts | Create, update, list clients and suppliers |
| Invoices | Generate, send, track payment status |
| Orders | Create from external systems, update status |
| Products | Sync inventory, update stock levels |
| Accounting | Fetch accounts, record transactions |
| Projects | Create, assign, track time |
2025 Authentication Migration
If you have existing bexio API integrations, read this first.
bexio decommissioned idp.bexio.com on 31 March 2025. All applications must use the new identity provider:
Old: https://idp.bexio.com
New: https://auth.bexio.com/realms/bexio
For most applications, migration requires only updating the authorization and token endpoint URLs. If you haven't migrated yet, your integration is no longer working.
Migration checklist:
- Update authorization URL in your app configuration
- Update token endpoint URL
- Test the complete OAuth flow
- Monitor bexio's status page at bexio-status.com for announcements
No-Code Integration
For Non-Developers
Don't want to write code? You have options. bexio connects with 8,000+ apps through Zapier alone.
Zapier Integration
The fastest path to automation without programming. Connect to 8,000+ apps instantly.
- New/Updated Company triggers
- New/Updated Order triggers
- New Product triggers
- New/Updated Quote triggers
Make.com (Integromat)
More complex multi-step workflows than Zapier with conditional logic.
- Different invoice templates by client type
- Conditional routing based on order value
- Visual workflow builder
- Advanced data transformations
Pipedream
Visual workflow building with code flexibility for developers who want both.
- Pre-built bexio connectors
- Custom JavaScript/Python steps
- Bridge between no-code and full development
- Real-time event processing
Popular Zapier Automations for Freelancers
- Shopify → bexio: New order creates invoice automatically
- Toggl → bexio: Logged time entries sync to project
- HubSpot → bexio: New CRM contact creates bexio contact
- Gmail → bexio: Email attachment creates expense entry
Getting Started with the bexio API
Everything you need to know for your first integration
Prerequisites
- bexio Account: Any paid plan (Starter CHF 45/month, Pro CHF 75/month, Pro+ CHF 125/month). API access is included.
- Developer Portal Access: Visit the bexio Developer Portal and log in with your bexio credentials.
Creating API Credentials
- Navigate to "My Apps" in the developer portal
- Click "Create New App"
- Set a Redirect URL (required for OAuth flow)
- Save your Client ID and Client Secret immediately—you won't see the secret again
Authentication Deep Dive
bexio uses OAuth 2.0, the industry standard for API authorization. Understanding the dual authorization system is crucial.
Two Levels of Authorization
Level 1: Application Scopes When users connect your app, they grant specific permissions (scopes). Request only what you need—users see these permissions in the consent screen.
Available scope categories:
contact_show,contact_edit— Contact managementkb_invoice_show,kb_invoice_edit— Invoice accessaccounting_show— Read accounting dataarticle_show,article_edit— Product management
Level 2: User Rights API requests execute with the permissions of the user who authorized the connection. If that user lacks permission to delete invoices in bexio, your API can't delete invoices either.
OAuth 2.0 Flow
1. Your app redirects user to:
https://auth.bexio.com/realms/bexio/protocol/openid-connect/auth
?client_id=YOUR_CLIENT_ID
&redirect_uri=YOUR_REDIRECT_URL
&response_type=code
&scope=contact_show kb_invoice_edit
2. User logs in and approves permissions
3. bexio redirects to your URL with authorization code
4. Exchange code for tokens at:
https://auth.bexio.com/realms/bexio/protocol/openid-connect/token
5. Use access token for API requests
Token management:
- Access tokens are short-lived (typically 1 hour)
- Refresh tokens get new access tokens without user interaction
- Store refresh tokens securely and implement automatic token refresh
bexio API in Python & JavaScript
Ready-to-use code snippets for the most common use cases
Python
import requests
BASE_URL = "https://api.bexio.com/2.0"
ACCESS_TOKEN = "your_access_token"
headers = {
"Authorization": f"Bearer {ACCESS_TOKEN}",
"Accept": "application/json"
}
# Fetch all contacts
response = requests.get(f"{BASE_URL}/contact", headers=headers)
contacts = response.json()
for contact in contacts:
print(f"{contact['id']}: {contact['name_1']}")
# Create new invoice
invoice_data = {
"contact_id": 1,
"title": "Project Work - January 2026",
"positions": [
{
"type": "KbPositionCustom",
"text": "Consulting Services",
"unit_price": "150.00",
"amount": "10"
}
]
}
response = requests.post(
f"{BASE_URL}/kb_invoice",
headers=headers,
json=invoice_data
)
print(response.json())
JavaScript (Node.js)
const axios = require('axios');
const BASE_URL = 'https://api.bexio.com/2.0';
const ACCESS_TOKEN = process.env.BEXIO_TOKEN;
const api = axios.create({
baseURL: BASE_URL,
headers: {
'Authorization': `Bearer ${ACCESS_TOKEN}`,
'Accept': 'application/json'
}
});
// Fetch contacts
async function getContacts() {
const response = await api.get('/contact');
return response.data;
}
// Create contact
async function createContact(contactData) {
const response = await api.post('/contact', {
contact_type_id: 1, // 1 = Company, 2 = Person
name_1: contactData.company,
name_2: contactData.name,
mail: contactData.email,
country_id: 1 // Switzerland
});
return response.data;
}
getContacts().then(contacts => console.log(contacts));
Note: Community libraries exist for PHP and Python, but they cover only a subset of API methods. For complete functionality, direct HTTP calls may be needed.
E-Commerce
Shopify/Shopware → bexio: Auto-generate invoices, sync contacts, update inventory
Time Tracking
Toggl → bexio: Sync logged time to projects, generate invoices from time entries
CRM
HubSpot → bexio: Sync deals and contacts, auto-invoice on close
Accounting
Bank feeds → bexio: Reconcile payments, track expenses automatically
bexio API Limitations
& Workarounds
Being transparent about what the API can't do saves you hours of frustration. bexio's API has limitations—but knowing them upfront helps you plan better.
No Native Webhooks
Use polling or Zapier as workaroundsUndocumented Rate Limits
Implement backoff and cachingNo Sandbox Environment
Test with real data carefullyWorkarounds for No Webhooks
- Polling: Check for changes periodically (every 5-15 minutes)
- Zapier: Uses polling but handles the infrastructure
- Third-party webhook services: Some integration platforms offer pseudo-webhook functionality
Handling Rate Limits
Based on community experience:
- Implement exponential backoff on 429 errors
- Cache responses where possible
- Batch requests when the API supports it
- Avoid unnecessary polling frequency
Limited Client Libraries
Official SDKs don't exist. Community libraries are incomplete. For production applications, expect to write custom code.
Just Need to Generate Swiss Invoices via API?
The bexio API is powerful but complex—OAuth 2.0, scopes, token management, no sandbox. If all you need is to generate Swiss QR invoices programmatically, the Magic Heidi Invoice API is a dramatically simpler option. One POST request. One API key. A PDF invoice with Swiss QR code in return.

Magic Heidi Invoice API
The Magic Heidi Swiss Invoice QR Code API is an open, single-endpoint API for generating professional Swiss invoices with QR payment slips. No OAuth, no token refresh, no scopes—just an API key and a POST request.
How It Works
- Send a POST request with your invoice data (sender, customer, line items)
- Receive a PDF download URL valid for 24 hours
- That's it—no OAuth flow, no developer portal registration
Python Example
import requests
response = requests.post(
"https://europe-west6-magic-heidi.cloudfunctions.net/create_invoice_abstract_v1d",
headers={"key": "your_api_key"},
json={
"user_details": {
"name": "Muster GmbH",
"address": "Bahnhofstrasse 1",
"zip": "8001",
"city": "Zurich",
"iban": "CH93 0076 2011 6238 5295 7"
},
"customer_details": {
"name": "Acme AG",
"address": "Bundesplatz 3",
"zip": "3011",
"city": "Bern"
},
"invoice_items": [
{
"description": "Web Development",
"quantity": 10,
"unit_price": 150
},
{
"description": "Design Review",
"quantity": 3,
"unit_price": 120
}
],
"language": "en",
"currency": "CHF",
"vat_enabled": true,
"vat_percentage": 8.1,
"vat_number": "CHE-123.456.789 MWST"
}
)
data = response.json()
print(f"Download your invoice: {data['url']}")
JavaScript (Node.js) Example
const axios = require('axios');
const response = await axios.post(
'https://europe-west6-magic-heidi.cloudfunctions.net/create_invoice_abstract_v1d',
{
user_details: {
name: 'Muster GmbH',
address: 'Bahnhofstrasse 1',
zip: '8001',
city: 'Zurich',
iban: 'CH93 0076 2011 6238 5295 7'
},
customer_details: {
name: 'Acme AG',
address: 'Bundesplatz 3',
zip: '3011',
city: 'Bern'
},
invoice_items: [
{ description: 'Web Development', quantity: 10, unit_price: 150 },
{ description: 'Design Review', quantity: 3, unit_price: 120 }
],
language: 'en',
currency: 'CHF'
},
{ headers: { key: 'your_api_key' } }
);
console.log(`Download your invoice: ${response.data.url}`);
Key Features
- Swiss QR invoices compliant with Swiss payment standards
- Multi-language: English, German, French, Italian
- CHF and EUR currency support
- VAT handling with configurable rates and VAT number
- Custom logos via URL
- QR-only mode for generating just the payment slip
- Free testing without an API key
- Open documentation on GitHub
bexio API vs. Magic Heidi Invoice API
Choose the right tool for your use case
| Feature | Magic Heidi API | bexio API |
|---|---|---|
| Use Case | Invoice generation | Full business suite |
| Authentication | ✓ Simple API key | OAuth 2.0 flow |
| Setup | API key only | Developer portal + OAuth app |
| Swiss QR Invoices | ✓ Built-in | ⚠ Manual setup |
| Sandbox / Free Testing | ✓ Yes | ✗ No |
| Contacts & CRM | ✗ No | ✓ Yes |
| Accounting | ✗ No | ✓ Yes |
| Minimum Cost | Free to test | CHF 45/month |
Frequently Asked Questions
Is the bexio API free?
Yes, API access is included with all paid bexio plans (starting CHF 45/month).
What programming languages work with these APIs?
Any language that can make HTTP requests—Python, JavaScript, PHP, C#, Ruby, Go, etc. Both the bexio API and Magic Heidi API use standard REST/JSON.
Can I use the bexio API without coding?
Yes. Zapier and Make.com offer no-code automation with bexio.
Does bexio support webhooks?
Not natively. Use polling or Zapier as workarounds.
What's the difference between bexio API and Magic Heidi API?
bexio API gives you access to a full business suite (contacts, accounting, invoices, inventory). Magic Heidi's API is focused on one thing: generating Swiss QR invoices with a single API call. If you just need programmatic invoice generation, Magic Heidi is much simpler.
Can I test the Magic Heidi API for free?
Yes. You can send requests without an API key for testing. Production use requires an API key—contact hello@magicheidi.ch.
Is there a bexio test/sandbox environment?
No. You must test with real data carefully.
Need Simpler Swiss Invoicing?
Magic Heidi handles QR invoices, expenses, and VAT—available on every platform. Use the app or generate invoices via API.