Skip to main content
On Node.js, Deno, Python, PHP or Laravel, use the server SDK instead of this page: npm install @proofage/node, pip install proofage, composer require proofage/php-sdk or composer require proofage/laravel-client. It signs every request, retries only what is safe to retry and verifies webhooks. Sign by hand only in a language without an SDK.

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:
  • METHOD is upper case: POST, GET.
  • path includes 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=20 is signed as GET/v1/verifications?limit=20&status=approved%2Cdeclined.
  • The body is the exact bytes you send. A GET has an empty body.
For example, creating a verification at Unix time 1795049078:
is signed over:

The timestamp

  • The API accepts a timestamp up to 300 seconds before or after its own clock, and answers TIMESTAMP_OUT_OF_RANGE otherwise. Keep your server’s clock synchronised (NTP). Every response carries a Date header with the API’s time; the server SDKs use it to correct a clock that is off.
  • A signed request other than GET is accepted once: the same signature sent again within the window is refused with REPLAYED_REQUEST, even if the first attempt failed. Sign every attempt, including a retry, with a new X-Timestamp. To retry a create safely, also send an Idempotency-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_REQUEST too. 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 GET is allowed, so polling within one second works.

Without a timestamp

Requests signed without X-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

A multipart/form-data request, such as a media upload, is not signed over its raw body. Its canonical string has three lines:
For a selfie upload with the single field type=selfie:
Nested fields are sorted at every level. With 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.
The multipart helpers sort only the top level of 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

  1. With X-Timestamp, sign X-Timestamp + "." followed by the canonical string, and send the same timestamp you signed.
  2. 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.
  3. Use the path with /v1 and without the host.
  4. Include the query string, with its ?, sorted by parameter name.
  5. Use a secret key of the same workspace as the public key: a test key does not sign for a live workspace.
  6. 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.