Version: 1.2.0 · Last updated: 2025-10-09
This repository contains practical examples for integrating with the Mālama Labs Data API (https://api.malamalabs.com/v1). Examples cover token management, event creation, evidence uploads, pagination, idempotency, retries with backoff, MQTT streaming, and a local queue for offline recovery.
Docs reference: https://docs.malamalabs.com/api
malama-api-examples/
├── README.md
├── LICENSE
├── .env.example
├── openapi/
│ └── malama-openapi.yaml
├── http/
│ ├── token.json.http
│ ├── list-projects.http
│ ├── create-event.http
│ └── upload-evidence.http
├── curl/
│ ├── get_token.sh
│ ├── list_projects.sh
│ ├── create_event.sh
│ └── upload_evidence.sh
├── postman/
│ └── Malama.postman_collection.json
├── python/
│ ├── requirements.txt
│ ├── quickstart.py
│ ├── create_event.py
│ ├── upload_evidence.py
│ ├── paginate_events.py
│ ├── mqtt_stream_handler.py
│ └── local_queue_processor.py
└── javascript/
├── package.json
├── quickstart.mjs
├── createEvent.mjs
├── uploadEvidence.mjs
└── paginateEvents.mjs
cd python
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp ../.env.example .env # fill in values
python quickstart.pycd javascript
npm i
cp ../.env.example .env # fill in values
node quickstart.mjs- Use a single cached access token until expiry (60 min). Refresh on HTTP 401.
- Include
X-Idempotency-Keyfor POST retries. - Default rate limit: 1,000 req/min. Respect
Retry-Afteron 429. - Evidence file limit: 10 MB each.
MIT License.