Identity Service API endpoints and options

API endpoints and options

All four pass-creation endpoints accept the same JSON worker object. There are no documented query-string options. Use the HTTP method and path shown below.

Authentication and curl setup

Run these commands in the same terminal as the examples:

BASE_URL='https://<identity-service-host>'
API_KEY='<your-api-key>'

cat > worker.json <<'JSON'
{
  "firstName": "Jane",
  "lastName": "Smith",
  "company": "Example Staffing",
  "dob": "1992-08-24",
  "employeeId": "EMP-88301",
  "qrData": "EMP-88301",
  "targetWallet": "both"
}
JSON

Replace <your-api-key> with the API key issued to your organisation. Send it in the x-api-key header on /api/* requests. Send Content-Type: application/json on POST requests. Keep issuance calls in your backend or Salesforce credential configuration; worker-facing wallet links do not need the key.

Missing or incorrect keys return 401 UNAUTHORIZED.

The curl examples require a version supporting --fail-with-body. The optional response extraction examples also require jq. Response tokens shown below are illustrative, not working links.

Worker request fields

Field Required Accepted value and behaviour
firstName Yes String, up to 100 characters
middleName No String, up to 100 characters; included between first and last name
lastName Yes String, up to 100 characters
company Yes String, up to 100 characters; issuer organisation and default card title
dob Yes Valid past date as YYYY-MM-DD; shown on the card
employeeId Yes String, up to 100 characters; displayed on the card and used as the default QR value
qrData No String, up to 500 characters; defaults to employeeId when omitted or blank
photoUrl No HTTPS URL, up to 2,048 characters; see photo handling below
targetWallet No Exactly apple, google or both; omitted or null defaults to both
branding No Object containing colours, title and inline SVG logo
additionalDetails No Object containing front rows, back rows and notice

Text fields are trimmed. Required strings must contain a value. Send only documented fields; extra fields are not a way to configure pass expiry, barcode format or layout. The JSON body limit is 100 KB.

Branding options

Field within branding Limit / default Effect
primaryColor Six-digit hex, default #3e344a Background on both wallets
secondaryColor Six-digit hex, default #00ca72 when no custom background is supplied Apple labels
tertiaryColor Six-digit hex, default #ffffff when no custom background is supplied Apple values and title
title 30 characters; defaults to company Text beside Apple logo; Google card title
logoSvg Inline SVG string, 20,000 characters; defaults to 3B logo Logo rendered as PNG for the wallets

Supplying primaryColor without text colours selects contrasting dark or light Apple text; omitted secondaryColor then follows that text colour. Google selects its own text colour. SVG must be a valid document without scripts, entities, event handlers or external references. Fragment references and embedded data:image/ references are allowed by validation. An SVG that passes text validation can still fail image rendering.

Additional detail options

Field within additionalDetails Limit / behaviour
front Array of up to 3 { "label": "...", "value": "..." } rows
back Array of up to 10 rows with the same structure
Row label Required string, up to 30 characters
Row value Required string, up to 100 characters; numbers are converted to text
notice String, up to 500 characters; omitted or blank uses the service notice

Use strings for employee numbers, telephone numbers and other values where leading zeroes matter. See branding and card details for a complete custom request and the default notice.

Photo handling

For Apple, the service downloads the photo with a five-second timeout and a 5 MB limit. Redirects are rejected. The photo host must be permitted by the service. A supported image is cropped to a 3:4 portrait.

For Google, the URL is passed to Google as the card's hero image. It must be publicly reachable without authentication. A successful API response does not confirm that Google fetched the image. Link creation also does not fetch the Apple photo; a photo error may occur only when the recipient downloads the pass.

POST /api/v1/passes/apple

Use this when your application needs an Apple Wallet file. A valid targetWallet value is still validated, but this route always produces Apple output.

curl --fail-with-body --silent --show-error "$BASE_URL/api/v1/passes/apple" \
  -H "x-api-key: $API_KEY" -H 'Content-Type: application/json' \
  --data-binary @worker.json --output worker-id.pkpass

Success is 200 OK, with Content-Type: application/vnd.apple.pkpass and Content-Disposition: attachment; filename="worker-id.pkpass". The body is binary, not JSON. Only offer the downloaded file after a successful response; curl can write an error body to the output file on failure.

Each generation creates a new Apple pass serial number. Issuing again does not push an update to an installed pass.

POST /api/v1/passes/google

Use this to obtain a URL that the worker opens to save their Google Wallet card. This route always produces Google output, regardless of the valid targetWallet value supplied.

curl --fail-with-body --silent --show-error "$BASE_URL/api/v1/passes/google" \
  -H "x-api-key: $API_KEY" -H 'Content-Type: application/json' \
  --data-binary @worker.json

Success is 200 OK with JSON:

{
  "saveUrl": "https://pay.google.com/gp/v/save/<signed-token>"
}

The URL contains a signed Google Wallet payload. Signing does not encrypt that payload. Treat the URL as worker information and share it with the intended recipient.

Reissuing identical data uses the same Google Wallet object; changing details or branding produces a new object and a fresh pass, rather than updating the installed card. Saving in Google Wallet is a separate worker action; this response does not confirm installation.

POST /api/v1/passes/generate

Use this when your application needs both wallet outputs in one JSON response. targetWallet selects the output: apple, google or both.

curl --fail-with-body --silent --show-error "$BASE_URL/api/v1/passes/generate" \
  -H "x-api-key: $API_KEY" -H 'Content-Type: application/json' \
  --data-binary @worker.json --output generated.json

Success is 200 OK. With targetWallet: "both":

{
  "apple": {
    "pkpassBase64": "<base64-encoded-pass>",
    "mimeType": "application/vnd.apple.pkpass"
  },
  "google": {
    "saveUrl": "https://pay.google.com/gp/v/save/<signed-token>"
  }
}

Unrequested wallet properties are absent. Decode apple.pkpassBase64 to binary and serve it with apple.mimeType; do not save the base64 text itself as a .pkpass file. For example, after a successful response:

python3 - <<'PYTHON'
import base64, json
from pathlib import Path
result = json.loads(Path('generated.json').read_text())
Path('worker-id.pkpass').write_bytes(base64.b64decode(result['apple']['pkpassBase64']))
PYTHON

If a requested wallet is unavailable, the request fails with 503 WALLET_NOT_CONFIGURED; there is no partial success response. Set targetWallet to the wallet you actually need when issuing for only one platform.

POST /api/v1/passes/link

Use this for email, messaging or a portal button. It creates a shareable page with the wallet buttons selected by targetWallet.

curl --fail-with-body --silent --show-error "$BASE_URL/api/v1/passes/link" \
  -H "x-api-key: $API_KEY" -H 'Content-Type: application/json' \
  --data-binary @worker.json --output wallet-link.json

Success is 201 Created with JSON:

{
  "url": "https://<identity-service-host>/w/<token>",
  "expiresAt": "2026-11-04T12:00:00.000Z"
}

expiresAt is the actual UTC expiry timestamp, 30 days after creation; the timestamp above is illustrative. There is no request option to change this duration. The service does not keep a worker record to retrieve. The URL may be long, especially with custom SVG artwork, so check destination field and message length limits.

Anyone with the URL can add the pass, repeatedly until expiry. Link expiry does not invalidate a saved card. There is no individual-link revocation endpoint.

A 201 confirms link creation, not successful photo rendering or wallet installation. The actual Apple pass or Google save URL is generated when the worker selects a button.

GET /w/:token

Open the returned url in a browser. No API key is required: the token grants access. A valid link returns 200 text/html with Apple and/or Google buttons. The buttons open in a new tab, including when the page is embedded in a portal iframe.

WALLET_URL=$(jq -r '.url' wallet-link.json)
curl --fail-with-body --silent --show-error "$WALLET_URL" --output wallet-page.html

An invalid, tampered or expired token returns a 410 HTML page asking the worker to obtain a new link. This is the HTML exception to the JSON error format below.

GET /w/:token/apple

Downloads the Apple pass for a link that includes Apple Wallet. No API key is required.

curl --fail-with-body --silent --show-error "$WALLET_URL/apple" --output linked-worker-id.pkpass

Success is 200 with the same binary content type and attachment filename as the Apple POST endpoint. Invalid or expired tokens return JSON 410 LINK_EXPIRED. An excluded or unavailable Apple wallet returns 404 NOT_FOUND. Photo and rendering errors can also occur here.

GET /w/:token/google

Redirects the worker to Google Wallet for a link that includes Google Wallet. No API key is required.

curl --silent --show-error --dump-header - --output /dev/null "$WALLET_URL/google"

Success is 302 Found with the Google save URL in the Location header. Open this route in the worker's browser to complete the save journey. Invalid or expired tokens return JSON 410 LINK_EXPIRED; an excluded or unavailable Google wallet returns 404 NOT_FOUND.

All /w responses set Cache-Control: no-store, Referrer-Policy: no-referrer and X-Robots-Tag: noindex.

GET /assets/logo.png

Returns the default 3B logo used by Google Wallet. It is public and does not require an API key.

curl --fail-with-body --silent --show-error "$BASE_URL/assets/logo.png" --output default-logo.png

Success is 200 image/png, a 660 × 660 transparent PNG with padding for Google's circular logo presentation.

GET /assets/logo/:token.png

Returns a custom logo from a service-generated logo URL. Google Wallet fetches this automatically when branding.logoSvg is supplied. Use the exact URL embedded in the Google pass payload; this is a logo token, not the wallet-page token from /link.

# Set LOGO_URL to the service-generated custom logo URL before running this command.
curl --fail-with-body --silent --show-error "$LOGO_URL" --output custom-logo.png

Success is 200 image/png, with the same dimensions as the default logo. Invalid, expired or tampered logo tokens return 404 NOT_FOUND. Logo tokens are issued for ten years. Both logo routes set Cache-Control: public, max-age=31536000, immutable.

GET /health

Use this public route to check configuration. No API key or request body is required.

curl --fail-with-body --silent --show-error "$BASE_URL/health"

A healthy response looks like this:

{
  "status": "ok",
  "environment": "production",
  "sandbox": false,
  "authConfigured": true,
  "apple": { "mode": "live", "issues": [] },
  "google": { "mode": "live", "issues": [] },
  "warnings": []
}

The route returns 200 even when status is degraded; monitoring must inspect the JSON. issues lists wallet configuration problems; warnings lists other service configuration problems.

Wallet mode Meaning
live The wallet is configured and issuing real cards
unavailable The wallet configuration is incomplete or invalid; issuance for that wallet fails

Status is degraded if either wallet is unavailable or the service configuration is incomplete. A healthy response is a configuration check, not an end-to-end device installation test.

Errors and recovery

Except for the expired wallet HTML page, service errors use this JSON shape:

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request body",
    "details": { "dob": "must be a valid past date in YYYY-MM-DD format" }
  }
}

details is optional. Nested validation paths include branding.primaryColor and additionalDetails.front[1].value.

HTTP status Code Action
400 VALIDATION_ERROR Correct required fields, dates, nested options, JSON syntax, SVG or photo host
401 UNAUTHORIZED Check the x-api-key header
404 NOT_FOUND Check method, route, logo token and whether the link allows that wallet
410 LINK_EXPIRED Issue a new wallet link
413 PAYLOAD_TOO_LARGE Reduce the request below 100 KB, especially inline artwork
502 PHOTO_FETCH_FAILED Check the Apple photo URL, direct access, image format, size and response time
503 WALLET_NOT_CONFIGURED Check /health and contact 3B support
503 AUTH_NOT_CONFIGURED The service is not fully configured; contact 3B support
503 LINKS_NOT_CONFIGURED Links or custom Google logos are not available; contact 3B support
500 INTERNAL Retry cautiously and report persistent failures to 3B support

There is no idempotency-key option. Retrying link creation creates another link, and generating Apple output again creates another pass serial number. Retain successful outputs before retrying a wider workflow.