SDKs and Libraries
Official and community-maintained libraries for integrating TotalApp into your own applications, scripts, and automation pipelines.
Overview
TotalApp exposes a fully documented REST API (see API Documentation) that any HTTP client can call directly. The SDKs below wrap the raw HTTP layer with idiomatic language bindings, automatic token refresh, type-safe request/response models, and built-in retry logic so you can focus on building rather than plumbing.
Authentication
Every SDK client requires an APP_JWT obtained from the POST /api/auth/login endpoint. Pass it as Authorization: Bearer <token>. Tokens expire after 24 hours; the SDKs handle refresh automatically when a 401 response is detected.
JavaScript / TypeScript
The official TotalApp JS/TS client is the same apiFetch utility used by the TotalApp React frontend itself — thin, dependency-free, and fully typed.
Installation
npm install @totalapp/client
Quick Start
import { TotalAppClient } from '@totalapp/client';
const client = new TotalAppClient({
baseUrl: 'https://app.totalapp.app',
token: process.env.TOTALAPP_JWT,
});
// Fetch employees
const employees = await client.employees.list();
// Create a project
const project = await client.projects.create({
title: 'Q3 Roadmap',
description: 'Planning cycle for Q3',
});
Key Modules
| Module | Methods | Endpoint prefix |
|---|---|---|
client.employees | list, get, create, update, delete | /api/data/employees |
client.projects | list, get, create, update, delete | /api/data/projects-index |
client.finance | accounts, transactions, reconcile | /api/data/financial-accounts |
client.webhooks | subscribe, unsubscribe, list | /api/webhooks/* |
Python
The Python library targets Python 3.9+ and uses httpx under the hood for async-first operation. A synchronous wrapper is also provided for scripts and notebooks.
Installation
pip install totalapp-client
Quick Start (async)
import asyncio
from totalapp import TotalAppClient
async def main():
async with TotalAppClient(token=os.environ["TOTALAPP_JWT"]) as client:
employees = await client.employees.list()
for emp in employees:
print(emp.name, emp.department)
asyncio.run(main())
Quick Start (sync)
from totalapp.sync import TotalAppClient
client = TotalAppClient(token=os.environ["TOTALAPP_JWT"])
projects = client.projects.list()
print(projects[0].title)
REST API — cURL Examples
No SDK installed? You can call any TotalApp endpoint directly with any HTTP client. Replace $TOKEN with your app JWT.
List employees
curl -H "Authorization: Bearer $TOKEN" \
https://app.totalapp.app/api/data/employees
Create a leave request
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"employeeId":"emp-001","type":"annual","startDate":"2026-07-14","endDate":"2026-07-18","reason":"Summer holiday"}' \
https://app.totalapp.app/api/data/leaves
Trigger a Claude AI generation
curl -X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"command":"write-blog","topic":"10 productivity tips for remote teams","apiMode":"api"}' \
https://app.totalapp.app/api/claude
Webhook Verification Helper
TotalApp signs every outbound webhook request with an HMAC-SHA256 signature in the X-TotalApp-Signature header. Use the verification helper to confirm payloads are genuine before processing them.
Node.js
import { verifyWebhookSignature } from '@totalapp/client/webhooks';
app.post('/my-webhook', (req, res) => {
const isValid = verifyWebhookSignature({
payload: req.body, // raw Buffer
signature: req.headers['x-totalapp-signature'],
secret: process.env.WEBHOOK_SECRET,
});
if (!isValid) return res.status(401).send('Invalid signature');
// process req.body ...
res.sendStatus(200);
});
Python
from totalapp.webhooks import verify_signature
@app.route('/webhook', methods=['POST'])
def handle_webhook():
valid = verify_signature(
payload=request.get_data(),
signature=request.headers.get('X-TotalApp-Signature'),
secret=os.environ['WEBHOOK_SECRET']
)
if not valid:
abort(401)
data = request.get_json()
# process data ...
return '', 200
Rate Limits & Best Practices
| Plan | Requests / minute | Burst allowance |
|---|---|---|
| Starter | 60 | 120 for 10 s |
| Basic | 300 | 600 for 10 s |
| Standard | 600 | 1 200 for 10 s |
| Pro | 1 500 | 3 000 for 10 s |
| Enterprise | Custom | Custom |
SDK Auto-Retry
Both the JS and Python SDKs implement exponential back-off with jitter on 429 Too Many Requests responses. If you call the REST API directly, inspect the Retry-After header and wait that many seconds before retrying.
Frequently Asked Questions
fetch). The Python SDK targets Python 3.9 and above. Older runtimes may work but are not officially tested.401 response and re-authenticate using the credentials you provided at construction time, then transparently retry the failed request. For scripts that do not use the SDK, store the token's exp claim and refresh proactively before it expires.BASE_URL and TOKEN and covers all core endpoints with example request bodies.