Skip to content

Photos

For developers

Photo files never pass through the API itself. You ask for a short-lived upload link, send the file straight to storage, and then tell CardOffice it has arrived.

  1. POST /photos to get an upload link.
  2. PUT the file to that link, with the headers it gives you.
  3. POST /photos/{photoId}/finalize to have the photo checked.

After finalising, CardOffice checks the photo automatically for problems such as low resolution, poor focus, bad lighting, a busy background or the wrong framing. It then waits for a member of staff to approve or reject it, unless your organisation approves photos that pass every check automatically. Listen for the photo.approved and photo.rejected webhooks to learn the outcome.

POST/photosscope: photos:write
Field Type Notes
cardHolderId uuid, required Must belong to your organisation
contentType enum, required image/jpeg, image/png, image/webp or image/heic
contentLength integer, required Size in bytes. Maximum 15 MB
filename string Optional, for your own reference
Terminal window
curl -sS -X POST "$CARDOFFICE_API/photos" \
-H "Authorization: Bearer $CARDOFFICE_KEY" \
-H "Content-Type: application/json" \
-d '{
"cardHolderId": "0b5e4c1a-6a53-4d3b-9d45-3f6f6b2c9a10",
"contentType": "image/jpeg",
"contentLength": 482113
}'

Returns 201:

{
"data": {
"photoId": "5d1f0a52-7e0b-4f7e-8d6e-2a9c1f0e6b33",
"uploadUrl": "https://storage.example/...signed...",
"headers": { "Content-Type": "image/jpeg" },
"expiresAt": "2027-02-01T02:29:09.000Z"
}
}
Status When
404 not_found The card holder does not exist in your organisation
413 quota_exceeded The file is over 15 MB, or would take the organisation past its photo storage allowance
422 validation_failed An unsupported type, or a missing field

Send a PUT to uploadUrl with the raw image bytes as the body. Include every header listed in headers, and send exactly contentLength bytes. This request goes to storage, not to the API, so it carries no Authorization header.

Terminal window
curl -sS -X PUT "$UPLOAD_URL" \
-H "Content-Type: image/jpeg" \
--data-binary @emma.jpg

The link works for about 15 minutes, until expiresAt. Use it straight away and do not store it. If it lapses, ask for a new one.

POST/photos/{photoId}/finalizescope: photos:write

Tells CardOffice the file has arrived. CardOffice confirms the file is really in storage before going further, and replies:

{ "data": { "photoId": "5d1f0a52-7e0b-4f7e-8d6e-2a9c1f0e6b33", "status": "processing" } }

Finalising can be repeated safely. If the photo is already past this stage, the call reports its current status instead of failing, so a bulk loader can retry freely.

Status When
404 not_found No such photo in your organisation
409 upload_incomplete The file never arrived in storage, for example because the PUT failed or the link expired first. The upload is discarded: request a new upload link and start again

Once the photo has been checked, CardOffice sends photo.uploaded.

When you move to CardOffice with photos that were already checked under supervision, such as an archive from a previous card system, a key that also holds photos:attest has its uploads approved without review. Use a separate key for the load and revoke it afterwards.

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