# Manage your document codes

A document code is a serial number bought from a provider such as SAHPA or SanParks. Permit and indemnity documents consume one code each when they are generated. The Codes screen shows the stock your school holds, its status, and when it expires.

Source: https://help.pigi.io/guides/compliance/codes/document-codes

## Quick answers

**Where do I see my codes?**
**Compliance → Codes**, at /school/admin/compliance/codes. The screen is titled
**Codes** and lists Code, Provider, Activity, Expiry, Order and Status.

**What do the five code statuses mean?**
**Available** (green) — in stock, ready to be spent. **Assigned** (cyan) — claimed by a
document that has not finished yet. **Held** (yellow) — reserved, e.g. by an in-flight
order or an offline device. **Used** (grey/pink) — spent on a completed document.
**Expired** (red) — past its batch expiry and no longer usable.

**Where is the summary of how many codes I have left?**
Above the list. Press the chevron on the right to expand the collapsed stats panel; it
breaks the counts down per provider, in the order Available, Assigned, Held, Used,
Expired.

**Why does a code read like 25301/26?**
Providers re-use the same numbers each purchasing cycle, so PiGi prints the cycle's
short suffix after the number to keep them apart. Codes minted before a suffix was set
show the bare number.

**When does a document take a code?**
When the document is *generated* — at registration, when a tandem flight is captured,
or when someone presses a generate action. It flips to Used when the document completes.

**What happens when I run out?**
The generator skips those requirements and reports "Your company has no available codes
for N compliance document(s). Please purchase more codes to generate these documents."
The students affected end up with a missing document, which Audit Readiness reports as a
critical gap.

**Do codes expire?**
Yes — the Expiry column comes from the batch's expiry date, and the badge turns red once
it has passed. A scheduled job flips past-expiry codes to Expired automatically, skipping
anything already Used.

**Can I move codes to another school in my group?**
Not from this screen. Reassignment between schools exists but only on the platform
surface; a school admin cannot move its own stock.

**Can I filter the list?**
Yes — by **Select Provider** and **Select Status**, plus the search box.

**Why does my code count not go up after I paid for an order?**
It should — paying now hands the reserved codes straight into your account, whether you
paid by card or the provider approved your EFT proof. If the count has not moved, open
the order: it will either still be Awaiting Payment, or it will carry a note saying the
payment landed but allocation failed. See "Order more document codes".

**What does Held mean on my own codes?**
An order you placed has them reserved while you pay. They are yours to buy for 24 hours
and count as neither Available nor spent. If the window lapses the order is cancelled
and they go back to the provider's pool.

## What this is

Codes are the school's consumable stock of regulator-issued serial numbers. Only
templates with the **Activity Compliance** purpose burn them; contracts, medicals and
training documents do not.

Each code belongs to a batch (which sets its expiry and its provider/activity) and to a
purchasing cycle (which sets its price, colour and printed suffix). Your school's stock
is the set of codes allocated to your company — codes sitting unallocated in the
provider's pool are not yours until they are assigned.

## Steps

1. Open **Compliance → Codes**.
2. Expand the stats panel to see per-provider Available counts.
3. Filter by **Select Provider** or **Select Status** to narrow the list.
4. If Available is low, go to **Compliance → Orders** and place an order.

## Known limitations

- **Codes are spent on generation, not on signature.** A registration that is started
  and abandoned still consumes the code attached to its documents; there is no automatic
  return to stock.
- **There is no code detail screen.** A code is read here and through its batch; the
  number is plain text, not a link, on every layout.
- **No batch, cycle, provider or reassign screens for schools.** They exist, but only
  for platform staff and code providers.
- **The reservation window is fixed at 24 hours** and is not configurable per provider
  or per school.

## Related

- [Order more document codes](code-orders.md)
- [Create a compliance document template](document-templates.md)
