Keys
Every workspace has two kinds of keys, shown in the console on the workspace’s page.
A workspace can hold several secret keys so you can rotate without downtime: any of them signs requests. See Workspaces and keys.
Signing a request
Send three headers on every request:X-Timestamp is the current Unix time in seconds. The signature is the lowercase hex HMAC-SHA256 of a canonical string, keyed with a secret key:
METHODis upper case:POST,GET.pathincludes the version and no host:/v1/verifications.- The query string, when there is one, is appended after a
?, with its parameters sorted by name and encoded as RFC 3986 (spaces as%20, a comma as%2C).GET /v1/verifications?status=approved,declined&limit=20is signed asGET/v1/verifications?limit=20&status=approved%2Cdeclined. - The body is the exact bytes you send. A
GEThas an empty body.
1795049078:
The timestamp
- The API accepts a timestamp up to 300 seconds before or after its own clock, and answers
TIMESTAMP_OUT_OF_RANGEotherwise. Keep your server’s clock synchronised (NTP). Every response carries aDateheader with the API’s time; the server SDKs use it to correct a clock that is off. - A signed request other than
GETis accepted once: the same signature sent again within the window is refused withREPLAYED_REQUEST, even if the first attempt failed. Sign every attempt, including a retry, with a newX-Timestamp. To retry a create safely, also send anIdempotency-Key. - Two requests with the same method, path, query and body signed in the same second have the same signature, so the second is refused with
REPLAYED_REQUESTtoo. A request refused this way was not processed: sign it again after the next second and send it. The server SDKs do this for you. - Repeating the same signed
GETis allowed, so polling within one second works.
Without a timestamp
Requests signed withoutX-Timestamp, over the canonical string alone (METHOD + path [+ "?" + query] + raw body), are still accepted for existing workspaces. Such a request can be captured and sent again for as long as the key is valid, so move to the timestamped form.
A workspace can be set to require the timestamp; ask ProofAge support. A signed request without X-Timestamp is then answered TIMESTAMP_REQUIRED. It does not affect creating without a signature. New workspaces may require it from the start, so sign new integrations with X-Timestamp, as the server SDKs do.
A workspace that does not require the timestamp also accepts a signature over the canonical string alone when the request carries an X-Timestamp header, as it did before the header existed. A workspace that requires it accepts only the timestamped form.
File uploads
Amultipart/form-data request, such as a media upload, is not signed over its raw body. Its canonical string has three lines:
type=selfie:
X-Timestamp, the timestamp and a dot come first, as for any other request (1795049078.POST/v1/verifications/…/media on the first line). The signature is the hex HMAC-SHA256 of that string with the secret key.
Reference implementations
For porting the signing to another language. In these three languages, install the server SDK instead.fields; if you send nested form fields, sort each level the same way.
Creating without a signature
POST /v1/verifications also accepts a request with only X-API-Key, so a page can start a verification with the public key alone. Such a request cannot tie the verification to your user: the API drops external_id and callback_url from it. Create verifications on your backend, signed, whenever you need to know whose verification it is. Every other endpoint requires the signature.
Authentication errors
The body is
{"error": {"code": "…", "message": "…"}}. All codes are on Errors.
When the signature does not match
- With
X-Timestamp, signX-Timestamp + "."followed by the canonical string, and send the same timestamp you signed. - Sign the exact bytes you send. Serialise the JSON once, sign that string, and send that string; a client that re-encodes the body after signing changes it.
- Use the path with
/v1and without the host. - Include the query string, with its
?, sorted by parameter name. - Use a secret key of the same workspace as the public key: a test key does not sign for a live workspace.
- Send the signature as lowercase hex.
Keep the secret key secret
- Sign on your server only. Browser and mobile code should call your backend, which calls ProofAge.
- Keep keys in environment variables or a secrets manager, never in source control.
- Rotate by adding a new secret key, deploying it, then deleting the old one. See Workspaces and keys.