Cardholder API
Reference version 1.2.3 · Last updated November 4, 2026 · Changelog
Send new hires and badge requests from your HR, payroll or identity system to Percard ID. Your account settings determine whether submissions wait in intake or become individual orders automatically. When card approval is required, your staff can preview the card, adjust the photo and approve it directly from your browser workflow.
Quickstart
Account owners manage API keys in the portal's API section. Start with a test key (pcid_test_…): submissions are validated but no cardholder, photo, order or approval link is saved. A valid test submission returns status: "test_accepted" with a temporary test_… ID that cannot be used to look up a saved cardholder. Use a live key (pcid_live_…) for actual submissions. Keys are shown once; store them on your server, never in browser code.
curl https://ahokzlxudlwhizmjrlfv.supabase.co/functions/v1/corporate-api/v1/forms \
-H "Authorization: Bearer pcid_test_..."curl -X POST https://ahokzlxudlwhizmjrlfv.supabase.co/functions/v1/corporate-api/v1/cardholders \
-H "Authorization: Bearer pcid_test_..." \
-H "Content-Type: application/json" \
-d '{
"external_id": "EMP-10442",
"form": "nurses",
"fields": { "first_name": "Ana", "last_name": "Diaz", "title": "RN" },
"photo_url": "https://hr.example.com/photos/10442.jpg"
}'A live submission returns 201 with data.ok: true and status: "received", or "held" if it needs release. Sending the same external_id for a saved cardholder returns 200 with status: "duplicate" and its existing ID; it does not update the card. Keep your external IDs stable across retries. A received reply confirms receipt, not approval, printing or payment.
Forms
Many accounts have several forms, for example one for nurses with a photo and one for contractors without. Each form has a short name such as nurses. Send it as "form" with every cardholder. If your account has only one form you can leave it out. GET /forms lists every form your key can use, with each field's type, whether it's required, dropdown choices, and whether a photo is required, optional or not accepted.
- Dropdowns: send one of the listed choices (value or label). Capital letters and extra spaces are forgiven.
- Dates:
YYYY-MM-DD. - Addresses: an object with
street1,city,state,zipand optionallystreet2,country,name,phone. - Fields the form doesn't have are rejected, so typos never disappear silently.
When a form changes. Form descriptions include version; accepted submissions include form and form_version when available. If a recently changed form breaks a previously working live integration, eligible validation problems are held with status: "held" and held_reason: "form_changed" rather than discarded. Other validation errors are rejected normally. Re-read GET /forms, update your mapping, and review held submissions in the portal's API section.
Endpoints
Base URL: https://ahokzlxudlwhizmjrlfv.supabase.co/functions/v1/corporate-api/v1
| GET | /forms | Your forms: fields, dropdown choices, photo rule, version |
| GET | /forms/{form} | One form by its short name |
| POST | /cardholders | Add one cardholder |
| POST | /cardholders/batch | Add up to 100 cardholders, per-row results |
| GET | /cardholders?since=ISO | Status changes since a time (read permission) |
| GET | /cardholders/{id} | Status of one cardholder. Use ext:{external_id} to look up by your ID |
| DELETE | /cardholders/{id} | Remove an API-sent cardholder before production starts |
Photos: photo_url (public https link) or photo_base64. JPEG, PNG, WebP or HEIC, up to 10 MB. Use photo_url for batches. Statuses: received, confirmed, in_production, printed, shipped, replaced.
Send 1–100 cardholders per batch. A valid batch request returns 207 even if some or all rows fail. Check each row's ok, status and error.code, not just the HTTP status. summary.accepted includes held rows; summary.held counts that subset. A malformed batch request is rejected before row processing.
Browser preview and card approval
For live submissions on accounts requiring client card approval, the response can include a top-level approval object alongside data. It covers this request's received or duplicate cards, not failed or held rows. One batch can return one link for several cards. Test submissions do not generate approval links.
{
"data": {
"ok": true,
"id": "00000000-0000-4000-8000-000000000001",
"external_id": "EMP-10442",
"status": "received",
"form": "nurses",
"form_version": 1,
"order_number": 42
},
"approval": {
"required": true,
"url": "https://percardid.com/approve/EXAMPLE_TOKEN",
"cards": 1,
"expires_at": "2026-12-04T12:00:00.000Z"
}
}The link opens a Percard ID approval screen; it does not automatically embed into your form. No portal sign-in or approval-link email is needed. Your staff can preview the full card, drag or zoom the photo and approve its placement. Cards without photos can still be previewed and approved. Portal users can do the same review in Saved Cards; overall badge design approval remains in Designs and is a separate decision.
Approval links expire 30 days after creation. Treat the full URL as a secret: anyone holding it can view and approve the linked cards. Do not publish it or include it in analytics. If it is missing, do not assume approval is unnecessary: confirm the account setting and use Saved Cards or contact Percard ID. If a link expires, use Saved Cards or request a replacement. Printing remains subject to the account's approval requirement.
Seamless popup flow. Submit to Percard ID from your own server and pass the response to your browser. Open a blank popup inside the user's click handler, before awaiting that server response, to avoid popup blocking. This example expects your own server route, not a Percard ID API route:
// Run inside your submit button's click handler.
const popup = window.open("about:blank", "percard-approve", "width=900,height=900");
const onApproval = (event) => {
if (event.origin !== "https://percardid.com" || event.source !== popup) return;
const message = event.data;
if (!message || message.type !== "percard:approval") return;
if (!["progress", "all_approved"].includes(message.event)) return;
// Update your UI from approved_ids / pending_ids and the counts.
if (message.event === "all_approved") {
window.removeEventListener("message", onApproval);
}
};
window.addEventListener("message", onApproval);
try {
// Your server keeps the API key and calls POST /cardholders.
const response = await fetch("/your-server/cardholders", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(cardholder)
});
const result = await response.json();
if (!response.ok) throw new Error(result.error?.message || "Submission failed");
if (result.approval?.url) {
const url = new URL(result.approval.url);
if (url.origin !== "https://percardid.com" || !url.pathname.startsWith("/approve/")) {
throw new Error("Unexpected approval URL");
}
if (popup) popup.location.replace(url.href);
else {
window.removeEventListener("message", onApproval);
// Show result.approval.url as a clickable review link if popups are blocked.
}
} else {
popup?.close();
window.removeEventListener("message", onApproval);
// Handle received / duplicate / held; absence of a link is not approval.
}
} catch (error) {
popup?.close();
window.removeEventListener("message", onApproval);
throw error;
}The popup sends progress on load and after approval changes, then all_approved when no cards remain pending. It closes about two seconds after completion if opened as a popup. Check both event.origin and event.source; keep the opener connection for these messages. Closing the popup early is not approval. Messages contain IDs and counts only, never names, photos or payment information:
{
"type": "percard:approval",
"event": "all_approved",
"approved_ids": ["00000000-0000-4000-8000-000000000001"],
"pending_ids": [],
"approved": 1,
"pending": 0
}Preview availability. Browser preview and photo positioning are available through approval.url and Saved Cards once the account's card layout is ready. A standalone POST /preview or POST /v1/preview endpoint returning an image or PDF is not available. Do not send photo transforms or approval flags in the cardholder payload; these are saved by the approval screen. Status lookups do not expose a separate awaiting_client_approval status or approval timestamp; use the popup's messages for this browser step.
Errors and 410 recovery
Single-request errors use {"error":{"code":"validation_failed","message":"…","details":{…}}}. details is optional and varies by error. Match on the HTTP status and error.code, not message text.
What 410 means. The key's submission destination cannot accept the cardholder. It is not a shipping error, payment error or notice that a shipped cardholder's data was deleted. The rejected row was not accepted. Although HTTP calls this status “Gone,” some destinations can be reopened or extended; repeating the same request unchanged will not resolve it.
| Code | Cause | Recovery |
|---|---|---|
| form_closed | The submission link pinned to this key is not active. | Have the link reopened, or use a key connected to an active destination. |
| form_expired | The pinned submission link has passed its expiry date. | Have its expiry extended, or use a new active destination. |
| order_closed | The destination order is missing, archived or no longer accepts submissions. | Use a new open destination order or an account-level form. |
| destination_full | The destination stopped accepting submissions or reached its cardholder limit. | Have its limit or availability reviewed, or use a new destination. |
| no_forms | The key has no usable active form. | Activate a form and check that the key is allowed to use it. |
| destination_closed | The submission link pinned to this key no longer exists. | Replace the key with one connected to an existing destination. |
HTTP 410
{
"error": {
"code": "form_expired",
"message": "The form this key sends to has expired. Ask Percard ID to extend it."
}
}410 reasons inside a batch. The outer status remains 207. The failed row carries the same destination code inside data[i].error.code; successful rows are not rolled back. Inspect every row and retry only failed rows after fixing their destination. Held rows are already stored for review, so release or discard them rather than blindly resubmitting them.
{
"data": [
{ "ok": true, "id": "00000000-0000-4000-8000-000000000001", "external_id": "EMP-10442", "status": "received" },
{ "ok": false, "external_id": "EMP-10443", "error": { "code": "form_expired", "message": "The form this key sends to has expired. Ask Percard ID to extend it." } }
],
"summary": { "accepted": 1, "failed": 1, "held": 0 }
}Other errors. 400 means a malformed request or missing form selection; 401 means a missing or invalid key; 403 means access, scope, IP or account restrictions; 404 means an unknown form, cardholder or endpoint; 409 means a conflict, including attempted removal after production starts; 422 means field or photo validation failed. For 429, wait and retry with backoff; for 500, retry later using the same external ID. Request history records error codes and, for 207, failed row indexes and codes, without cardholder names, photos or answers.
Orders and tracking
By default, submissions wait in intake for grouping into orders. Accounts can instead use one order per cardholder, automatic release and no admin intake-review hold. These are separate account settings, not fields to send with each API request. A reply includes order_number only when an order was created or already exists. If automatic ordering is paused, capped or cannot complete, an accepted cardholder can remain in intake without an order number. Required client card approval still applies even when admin review is off.
Shipping defaults. Ordering mode and shipping mode are independent. An account can ship to individual cardholders and choose USPS Ground Advantage, USPS Priority Mail, USPS Priority Mail Express, UPS Ground, UPS 3 Day Select, UPS 2nd Day Air, UPS Next Day Air Saver, UPS Next Day Air, or USPS Stamp (untracked, $2 flat). Send each cardholder's shipping address using the address field returned by GET /forms; do not add an unsupported top-level shipping field. A default service is a preference, not a purchased label or guaranteed rate. Tracked postage is added to the order when the label is purchased, using the actual label cost and any configured account markup. Stamp postage is added when the card is marked mailed.
Billing. Accounts can invoice each order when it ships; automatic payment depends on the account's billing setup and card on file. Submission and approval replies are not invoice or payment confirmations. Card pricing, double-sided inclusion, slot punches and holders follow your agreed account catalog and production settings; there is no API-wide second-side surcharge.
GET /cardholders/{id} returns current status and a nested tracking object, not top-level tracking fields. Per-cardholder shipment information takes priority over order-level tracking. Tracking is null before shipping; untracked mail has no tracking number or URL. Status responses do not return cardholder names, photos, addresses or form answers.
{
"data": {
"id": "00000000-0000-4000-8000-000000000001",
"external_id": "EMP-10442",
"status": "shipped",
"submitted_at": "2026-11-04T12:00:00.000Z",
"confirmed_at": null,
"printed_at": "2026-11-05T12:00:00.000Z",
"shipped_at": "2026-11-05T16:00:00.000Z",
"tracking": { "carrier": "USPS", "number": "EXAMPLE_TRACKING", "url": "https://tools.usps.com/go/TrackConfirmAction?tLabels=EXAMPLE_TRACKING" }
}
}Limits
Default 60 requests per minute and 500 cardholders per rolling 24 hours per key. We can raise both for your account. Over the daily limit, eligible live submissions are held with status: "held" and held_reason: "daily_cap"; account owners can review held submissions in the portal's API section. Over the request-rate limit you get 429. Wait and retry with backoff.
Security
- Keys are stored only as a one-way fingerprint. We can't see or recover your key, only revoke and reissue it.
- The API key endpoints accept server-to-server calls only. The public approval screen is a separate browser workflow using the scoped approval token, never your API key.
- Each key has its own permissions (send, or send + read status), optional IP allowlist, limits and expiry date.
- Status responses and popup messages contain no names, photos or form answers. Request history stores request metadata, status, error codes and failed batch row indexes, not request payloads.
- Photo links are fetched only from public internet addresses over https, with size and file-type checks.
- All traffic is encrypted in transit (TLS). Your account owners are emailed whenever a live key is created or revoked.
- Repeated failed key attempts are blocked automatically.
Changelog
- 1.2.3 — November 4, 2026. Documentation refresh: complete approval response and popup integration, Saved Cards review, no-photo preview, separate order/shipping/billing settings, nested tracking, all six 410 reasons and batch recovery. OpenAPI now includes approval and batch response schemas. The API route remains
/v1; no standalone preview endpoint was added. - 1.2.2 — November 1, 2026. Card approval popup: open
approval.urlfrom your app and get progress messages back, with no sign-in or email step. - 1.2.1 — October 30, 2026.
410responses now name the exact reason (form_closed,form_expired,order_closed,destination_full). Match on the 410 status if you only need to know the destination is unavailable. - 1.2.0 — October 20, 2026. Added
order_numberto submit replies for accounts set to one order per cardholder. Status lookups now return per-cardholder tracking when a card ships on its own. Backwards compatible. - 1.1.0 — October 18, 2026. Multiple forms per account,
GET /v1/forms, form versions, and holding cardholders after form changes. - 1.0.0 — October 17, 2026. First release.
API terms
By using a Percard ID API key you agree to: keep keys confidential and on your servers; send only cardholders you are authorized to submit, with their consent where required; not exceed or work around rate limits; and tell us promptly at orders@percardid.com if a key may be exposed. We process cardholder data only to produce and ship your cards, as described in our privacy policy. We may suspend a key that is misused or putting the service at risk. These terms add to our general terms.