PemyStackPemyStack

Quickstart

Get your first API call working in 5 minutes.

1

Create an account

Sign up with Google or email at the PemyKonekt dashboard.

2

Get your API key

Go to Settings → API Keys → Create Key. Copy the pk_live_... key - it's shown only once.

pk_live_a962daf8ee2af98d6e27154b250a...
3

Initialize your eTIMS device

Call the init endpoint to register with KRA and get your CMC key.

curl -X POST https://etims.pemystack.com/api/etims-init \
  -H "Authorization: Bearer YOUR_API_KEY"
4

Submit your first invoice

Send an invoice to KRA and get back a CU invoice number.

curl -X POST https://etims.pemystack.com/api/invoices \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "invoiceNo": "INV-001",
    "items": [{
      "name": "Chai Maziwa",
      "quantity": 10,
      "unitPrice": 5000,
      "taxType": "A"
    }],
    "paymentType": "04"
  }'
5

Check the response

You'll get back the KRA CU invoice number and QR code data.

{
  "success": true,
  "cuInvoiceNo": "CUA0051001",
  "qrCodeData": "base64-encoded-qr-data"
}

Code samples

Here's how to call the API from popular languages:

Node.js

const res = await fetch('https://etims.pemystack.com/api/invoices', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    invoiceNo: 'INV-001',
    items: [{ name: 'Chai', quantity: 10, unitPrice: 5000, taxType: 'A' }],
  }),
});
const data = await res.json();
console.log(data.cuInvoiceNo);

Python

import requests

res = requests.post('https://etims.pemystack.com/api/invoices',
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    json={
        'invoiceNo': 'INV-001',
        'items': [{'name': 'Chai', 'quantity': 10, 'unitPrice': 5000, 'taxType': 'A'}],
    })
print(res.json()['cuInvoiceNo'])