Skip to content

Quickstart

For developers

Most systems that connect to CardOffice do not add data to it. They react to what already happens there: a door access system switching off someone’s access, a dashboard showing that a card was revoked, a help desk ticket when a photo is rejected. This page walks through that shape from start to finish, using curl and jq. You need an administrator account in CardOffice.

  1. Create an API key

    In the portal open Settings → Integrations, and under API keys create a key with card_holders:read and card_holders:write. Give it an expiry. The write scope is only so that this walkthrough can change a test person’s status. An integration that only reacts to events needs read scopes alone.

    Terminal window
    export CARDOFFICE_KEY="idp_..."
    export CARDOFFICE_API="https://app.cardoffice.nz/api/v1"

    Check the key works, and has the scopes you chose:

    Terminal window
    curl -sS "$CARDOFFICE_API/me" -H "Authorization: Bearer $CARDOFFICE_KEY" | jq '.data.key'
  2. Get somewhere to receive a delivery

    For this walkthrough, open webhook.site. It gives you a unique address and shows every request sent to it. Anyone who has that address can read what arrives, so use it only with test data. In a real integration this is an https:// endpoint of your own.

  3. Register a webhook

    In Settings → Integrations, under Webhooks, choose New webhook. Enter the webhook.site address, and these events:

    card_holder.status_changed, card.revoked

    Copy the signing secret. It is shown once, and a real receiver needs it to verify deliveries.

  4. Trigger a real event

    Create a test person, then make them inactive. This is what an HR or student system does when someone leaves:

    Terminal window
    HOLDER_ID=$(curl -sS -X POST "$CARDOFFICE_API/card-holders" \
    -H "Authorization: Bearer $CARDOFFICE_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "externalId": "TEST-0001", "firstName": "Test", "lastName": "Holder", "holderType": "staff" }' \
    | jq -r '.data.id')
    curl -sS -X PATCH "$CARDOFFICE_API/card-holders/$HOLDER_ID" \
    -H "Authorization: Bearer $CARDOFFICE_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "status": "inactive" }'
  5. Look at what arrived

    Within a few seconds, webhook.site shows a POST:

    {
    "event": "card_holder.status_changed",
    "createdAt": "2027-02-01T03:00:00.412Z",
    "companyId": "7e0d9c3a-2d8b-4e57-8f43-5c3a1b2d9e10",
    "data": {
    "id": "0b5e4c1a-6a53-4d3b-9d45-3f6f6b2c9a10",
    "externalId": "TEST-0001",
    "from": "active",
    "to": "inactive",
    "via": "api"
    }
    }

    It carries an X-IDPortal-Signature header. A real receiver checks that signature before it trusts anything in the body; see Verifying signatures for receivers in Node.js, Python, C# and PHP. The payload says that something changed. It is not the whole record.

  6. Read the current state

    Before acting on a delivery, read the record back:

    Terminal window
    curl -sS "$CARDOFFICE_API/card-holders/$HOLDER_ID" \
    -H "Authorization: Bearer $CARDOFFICE_KEY"

    That is the whole pattern: a webhook arrives, you verify it, you read the current state, and then you act. A door access system switching off access on card_holder.status_changed is the most common real version of it.

  • Delete the test webhook in Settings → Integrations, so nothing more is sent to webhook.site.
  • Archive the test person in the portal.
  • Revoke the key if you no longer need it.
  • Event reference: everything CardOffice can tell you.
  • Webhooks overview: retries, timeouts, and designing a receiver for at-least-once delivery.
  • Building a secure integration: the checklist to work through before you connect a production system.
  • If your integration’s job runs the other way, keeping CardOffice’s roster current from a student or HR system, start at Sync feeds.

© 2026 Secure ID Ltd. All rights reserved.Documentation licence and terms