Track a heart Start free
Developers

Heartswill for NGOs API.

Send donations from any system and get numbered receipts back. Read your donations, projects, deliveries and impact. Version 1.

Overview

The Heartswill for NGOs API lets your organisation's own systems talk to Heartswill: your website's donation form, your payment gateway's webhook, your CRM or your reporting tools. It is a JSON API over HTTPS.

Base URLhttps://app.ngo.heartswill.com/api/v1
FormatJSON in, JSON out. Amounts in rupees. Dates as YYYY-MM-DD, times in ISO 8601 UTC.
Versionv1. Additive changes don't change the version; breaking changes get a new one with notice.

Authentication

Owners and admins create keys in the app under API keys. A key looks like hwn_live_ followed by 48 characters and is shown once. Send it on every request:

http
Authorization: Bearer hwn_live_3f9a…

Server side only. Never put a key in a website's JavaScript, a mobile app or a public repository. The API refuses cross-origin browser calls. If a key leaks, revoke it in the app; it stops working immediately.

Scopes

ScopeAllows
donations:writeRecord donations and issue receipts
donations:readList donations, with donor IDs masked to the last four characters
receipts:readLook up a receipt by number or verify code
programmes:readList projects and deliveries
impact:readRead totals for the year and units delivered

Give each integration its own key with only the scopes it needs. A website donation form needs donations:write; an impact widget needs only impact:read.

Rate limits and retries

Each key can make 120 requests a minute. Over that you get 429 with Retry-After: 60. On 5xx or a network error, retry with the same external_ref: it is always safe.

Errors

Errors return a JSON body and an HTTP status:

json
{
  "error": {
    "code": "invalid_request",
    "message": "donor.pan must look like ABCDE1234F",
    "docs": "https://heartswill.com/ngos/developers/api"
  }
}
StatusCodeWhat to do
401unauthorizedKey missing, malformed or revoked. Check the header.
403forbiddenThe key lacks the scope. Create a key with it.
404not_foundNo such endpoint or record in your organisation.
422invalid_requestFix the field named in the message. Don't retry unchanged.
429rate_limitedWait 60 seconds, then retry.
500server_errorRetry with the same external_ref.

Endpoints

POST

/donations

donations:write

Records a donation, matches or creates the donor, and issues a receipt unless you set issue_receipt to false. Returns 201 for a new donation, or 200 with duplicate: true if this external_ref was already recorded.

FieldType
external_refstringRequired. Your unique ID, such as a Razorpay payment ID. Makes retries safe.
amount_inrnumberRequired. Rupees, e.g. 1500 or 1500.50.
donor.namestringRequired.
donor.email / donor.phonestringUsed to match a returning donor.
donor.pan or donor.aadhaarstringNeeded for the donation statement (Form 113). Stored encrypted.
donor.kindstringindividual (default) or organisation.
donor.address, city, state, pincodestringPrinted on the receipt.
modestringonline (default), upi, bank, cheque, cash or kind.
received_ondateDefaults to today (India time). Can't be in the future.
donation_typestringothers (default), corpus or specific.
purpose, notes, payment_referencestringOptional.
fcrabooleanTrue for foreign contribution. Kept out of the donation statement and not deduction-eligible.
issue_receiptbooleanDefault true.
curl
curl -X POST https://app.ngo.heartswill.com/api/v1/donations \
  -H "Authorization: Bearer $HEARTSWILL_NGO_KEY" -H "Content-Type: application/json" \
  -d '{"external_ref":"pay_TyXaZl5tn28x5r","amount_inr":1500,"mode":"upi",
       "donor":{"name":"Riya Kapoor","email":"riya@example.org","pan":"ABCDE1234F"}}'
json · 201
{
  "donation_id": "6f1c…",
  "duplicate": false,
  "external_ref": "pay_TyXaZl5tn28x5r",
  "receipt": {
    "number": "ASHA/2026-27/0042",
    "status": "issued",
    "eligible_for_deduction": true,
    "verify_code": "9c1e2a7f40b3d6e1",
    "verify_url": "https://app.ngo.heartswill.com/verify/9c1e2a7f40b3d6e1",
    "issued_on": "2026-11-15"
  }
}

Deduction eligibility follows the same rules as the app: your organisation needs a valid donor deduction approval, and cash above ₹2,000, gifts in kind and FCRA gifts are not eligible.

GET

/donations

donations:read

Lists donations, newest first. Query: since and until (dates), limit (1–200, default 50) and before (the next_before value from the previous page).

json · 200
{
  "data": [
    {
      "donation_id": "6f1c\u2026",
      "external_ref": "pay_TyXaZl5tn28x5r",
      "source": "api",
      "amount_inr": 1500,
      "mode": "upi",
      "received_on": "2026-11-15",
      "financial_year": "2026-27",
      "donation_type": "others",
      "fcra": false,
      "donor": {
        "name": "Riya Kapoor",
        "kind": "individual",
        "id_type": "pan",
        "id_last4": "234F"
      },
      "receipt_number": "ASHA/2026-27/0042",
      "receipt_status": "issued",
      "created_at": "2026-11-15T06:12:09Z"
    }
  ],
  "next_before": null
}
GET

/receipts/{number}

receipts:read

Fetches one receipt by its number (slashes are fine, e.g. /receipts/ASHA/2026-27/0042) or by its verify code. The content is the version frozen at issue.

GET

/projects

programmes:read

Lists projects with their impact unit, unit cost, target and units delivered and sealed.

GET

/deliveries

programmes:read

Lists deliveries, newest first, with status (recorded, submitted, sealed, rejected), photo and witness counts, proof hash and, once sealed, the public ledger number and story link. Query: project, limit, before.

GET

/impact

impact:read

Totals for the current financial year: amount raised, donations, donors, sealed deliveries and units per active project. Good for a live counter on your site.

json · 200
{
  "financial_year": "2026-27",
  "raised_inr_fy": 1840000,
  "donations_fy": 389,
  "donors_total": 412,
  "deliveries_sealed": 37,
  "projects": [
    {
      "name": "Girl Child Education",
      "unit": "school day",
      "units_delivered": 2140,
      "units_sealed": 1980
    }
  ]
}
GET

/org

no key

Returns your organisation's name, registration flags and the calling key's name and scopes. Any valid key works. Handy as a connection test.

GET

/verify/{code}

no key

Public. Checks a receipt from the code in its QR and returns the organisation, number, amount, date, status and donor initials only. No key needed.

Recipe: Razorpay to receipts, automatically

Record a donation for every captured Razorpay payment, from the webhook, so it works even if the donor closes the tab. Use the payment ID as external_ref.

javascript · Next.js route
import crypto from "node:crypto";

export async function POST(req) {
  const raw = await req.text();
  const expected = crypto.createHmac("sha256", process.env.RAZORPAY_WEBHOOK_SECRET).update(raw).digest("hex");
  if (req.headers.get("x-razorpay-signature") !== expected) return new Response("bad signature", { status: 400 });

  const event = JSON.parse(raw);
  if (event.event !== "payment.captured") return new Response("ignored");
  const p = event.payload.payment.entity;

  const res = await fetch("https://app.ngo.heartswill.com/api/v1/donations", {
    method: "POST",
    headers: { Authorization: `Bearer ${process.env.HEARTSWILL_NGO_KEY}`, "Content-Type": "application/json" },
    body: JSON.stringify({
      external_ref: p.id,                       // same payment, same receipt, however many retries
      amount_inr: p.amount / 100,               // Razorpay sends paise
      mode: p.method === "upi" ? "upi" : "online",
      payment_reference: p.id,
      donor: { name: p.notes?.name || "Donor", email: p.email, phone: p.contact, pan: p.notes?.pan },
    }),
  });
  if (res.status >= 500 || res.status === 429) return new Response("retry later", { status: 503 }); // Razorpay will retry
  if (!res.ok) console.error("Heartswill refused donation", p.id, await res.text());          // fix data, don't loop
  return new Response("ok");
}
python
import os, requests

r = requests.post(
    "https://app.ngo.heartswill.com/api/v1/donations",
    headers={"Authorization": f"Bearer {os.environ['HEARTSWILL_NGO_KEY']}"},
    json={"external_ref": "order-10293", "amount_inr": 2500, "mode": "bank",
          "donor": {"name": "Kavya Traders LLP", "kind": "organisation", "pan": "AAAPL1234C"}},
    timeout=15,
)
r.raise_for_status()
print(r.json()["receipt"]["verify_url"])

Security and privacy

  • Keys are stored only as SHA-256 fingerprints. Lose a key and you create a new one; nobody can recover it.
  • Every write through the API is recorded in your organisation's audit log with the key that made it.
  • Donor PAN and Aadhaar are encrypted at rest and returned only as the last four characters.
  • Keys only ever see their own organisation's data.
  • Collect donor IDs with consent and a clear notice. See Donor data and the DPDP Act.

Changelog

15 Nov 2026v1 releasedKeys with scopes, donations with safe retries and automatic receipts, receipts, projects, deliveries, impact, public verification.