Daftora
Daftora Developers · API v1

Complete Daftora API integration guide

A secure REST API for synchronizing customers, invoices, products, inventory, journal entries, and account balances with your Daftora workspace. Every response is JSON and every key is isolated to one company.

1. Create a key and authenticate

In your company workspace, open Settings → API integration, give the integration a clear name, then select Create API key. The full key is displayed only once.

Send the key on every request in the Authorization header as a Bearer token. Never put it in a URL or client-side code.
Authorization: Bearer dft_live_xxxxxxxxxxxxxxxxxxxx

Base URL for all requests:

https://yusrplus.com/api/public/v1

2. Available endpoints

GET/api/public/v1/customers
POST/api/public/v1/customers
GET/api/public/v1/products
POST/api/public/v1/products
GET/api/public/v1/invoices
POST/api/public/v1/invoices
GET/api/public/v1/accounts
GET/api/public/v1/journal-entries
POST/api/public/v1/journal-entries

List endpoints support limit from 1 to 100 and offset pagination, for example ?limit=50&offset=100.

const response = await fetch(
  "https://yusrplus.com/api/public/v1/invoices?limit=50",
  { headers: { Authorization: `Bearer ${process.env.DAFTORA_API_KEY}` } }
);
if (!response.ok) throw new Error(await response.text());
const { data, meta } = await response.json();

3. Create customers automatically

Send your own code to keep a stable customer reference across both systems. The code must be unique within the company.

curl -X POST https://yusrplus.com/api/public/v1/customers \
  -H "Authorization: Bearer $DAFTORA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "WEB-1001",
    "name": "شركة المثال",
    "email": "finance@example.com",
    "phone": "+201000000000"
  }'

4. Create and post invoices

Use either customerId or customerCode. Daftora automatically posts a balanced accounting entry when the invoice is created. Supported statuses are draft, sent, partially_paid, paid, overdue, and cancelled.

curl -X POST https://yusrplus.com/api/public/v1/invoices \
  -H "Authorization: Bearer $DAFTORA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customerCode": "WEB-1001",
    "number": "STORE-INV-9001",
    "totalMinor": 125000,
    "paidMinor": 0,
    "status": "sent",
    "issueDate": "2026-09-09",
    "dueDate": "2026-09-23"
  }'
All money values use the smallest unit of the workspace base currency to avoid floating-point errors: 125000 means 1,250.00, and the currency code is returned in the currency field.

5. Products and inventory

Creating a product immediately updates inventory screens and valuation. salePriceMinor uses minor units; stockQuantity and reorderLevel are integers.

curl -X POST https://yusrplus.com/api/public/v1/products \
  -H "Authorization: Bearer $DAFTORA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "sku": "SKU-500",
    "name": "منتج تجريبي",
    "salePriceMinor": 49900,
    "stockQuantity": 25,
    "reorderLevel": 5
  }'

6. Accounts and journal entries

GET /accounts returns debit, credit, and balance totals by account code. You can also import a journal from another system, provided total debits equal total credits.

curl -X POST https://yusrplus.com/api/public/v1/journal-entries \
  -H "Authorization: Bearer $DAFTORA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "reference": "ERP-ENTRY-1007",
    "postingDate": "2026-09-09",
    "lines": [
      {"accountCode":"1100-CASH","debitMinor":50000,"creditMinor":0},
      {"accountCode":"4100-SALES","debitMinor":0,"creditMinor":50000}
    ]
  }'
CodeAccount
1100-CASHCash
1200-ARAccounts receivable
2100-TAXVAT payable
4100-SALESSales revenue

7. Errors and production safety

The API uses standard HTTP codes: 201 created, 401 invalid key or missing scope, 404 missing reference, 409 duplicate record, and 422 validation error.

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "totalMinor must be a positive integer"
  }
}
  • Store the key in a server-side environment variable.
  • Use a unique invoice number or reference to prevent duplicates during retries.
  • Revoke the key immediately from Settings if exposure is suspected.
  • Log response codes and error bodies, never the key itself.