# Lock a document in one call curl -X POST https://api.asknana.co.ke/v1/documents \ -H "Authorization: Bearer sk_live_…" \ -d '{ "type": "invoice", "parties": ["+254712…","+254722…"], "amount": 18500, "confirm": "otp" }' # → 201 Created { "id": "NANA-2026-K8F2", "status": "locked", "sha256": "9f2c…e81b"▋ }
// Create a locked document in 3 API calls // 1. Create the document const doc = await fetch('https://api.asknana.co.ke/api/document/create', { method: 'POST', headers: { 'Authorization': 'Bearer nana_live_xxxx' }, body: JSON.stringify({ doc_type: 'invoice', creator_phone: '+254712345678', counterparty_phone: '+254722987654', items: [{ name: 'Service fee', quantity: 1, unit_price: 15000 }] }) }); // Returns: { doc_id, nana_ref: 'NANA-2026-0048', status: 'draft' } // 2. Send OTP to counterparty await fetch('https://api.asknana.co.ke/api/document/send-otp', { ... }); // 3. Verify OTP — document locks automatically const result = await fetch('https://api.asknana.co.ke/api/document/verify-otp', { ... }); // Returns: { verified: true, verify_url, sha256_hash, locked_at }
| Method | Endpoint | What it does |
|---|---|---|
| POST | /api/user/create | Register a new user. Returns nana_ref and plan tier. |
| POST | /api/document/create | Create a new document in DRAFT status. Returns doc_id and preview. |
| POST | /api/document/send-otp | Generate and deliver OTP to the counterparty's WhatsApp. |
| POST | /api/document/verify-otp | Verify OTP. Document locks automatically on success. Returns hash. |
| GET | /api/verify/:doc_id | Public verification endpoint. No auth required. Returns document status and hash. |
| GET | /api/document/:id/pdf | Generate and return the locked document as an A4 PDF. |
| POST | /api/dispute/create | File a dispute on a locked document. Both parties notified. |
| GET | /api/user/:id/trade-statement | Return verified trade history. Used for credit scoring integration. |