Banks & templates — GET /api/banks and /api/bank-templates

Before creating any cheque you need the bank and template IDs as the app knows them. Three read endpoints — banks that have templates, all templates, and one bank’s templates — with their literal response keys and caveats.

Last updated: 2026-09-21

On this page

GET /api/banks

Purpose: active banks that have templates — to pick bank_id or bank_name.

bash
curl -s -H "X-API-KEY: KEY" -H "Accept: application/json" "APP_URL/api/banks"

200 — a bare JSON array of full bank rows plus logo_url:

json
[
  { "id": 2, "name": "بنك مصر", "name_en": "BM", "status": 1,
    "logo": "uploads/banks/bm.png", "logo_url": "https://…/uploads/banks/bm.png", "…": "…" }
]

Caveats:

  • A bank appears when active and has at least one template — even if all its templates are disabled; verify with the next endpoint.
  • The row carries internal columns (is_official · official_key · official_version · is_modified · note · deleted_at) — ignore them; not part of the contract.
  • No audit row; no company filter (banks are installation-wide).

GET /api/bank-templates and GET /api/banks/{bankId}/templates

Purpose: templates — all, or one bank’s — to pick template_id/template_name.

bash
curl -s -H "X-API-KEY: KEY" -H "Accept: application/json" "APP_URL/api/banks/2/templates"

200 — an array with an explicit projection, keys in this order:

json
[
  { "id": 5, "bank_id": 2, "bank_name": "بنك مصر", "bank_name_en": "BM",
    "name": "بنك مصر - نموذج 1", "currency": "EGP", "with_stub": true, "featured": true,
    "status": 1, "logo": "…", "image": "…", "logo_url": "…", "image_url": "…",
    "size_position": { "…": "…" } }
]
Key Meaning
with_stub the template has a stub — affects stub-field fallback in Dynamics
featured “most used” — the tie-breaker in automatic template selection
status always 1 — both endpoints return active templates only; but they do not filter the parent bank’s status, so cross-check the bank via /api/banks
size_position cheque size and field positions — read-only

Caveats:

  • Unknown bankId200 with an empty array, not 404.
  • No audit row.

Correct usage

  1. GET /api/banks → pick the bank.
  2. GET /api/banks/{id}/templates → pick template_id (only active ones are returned).
  3. Pass template_id when creating or preparing — more precise than a name.
اطلب نسختك التجريبية مجانًا