API

Pseudonym endpoint

Computes the same pseudonyms the jobs of a project write with its Person Key, for new rows that never go through Gigantics: a dbt model in BigQuery, a data pipeline, a script.

Computing the pseudonym of a known identifier is how someone recognises a known person in a pseudonymised dataset. The endpoint is therefore off by default, takes only the API keys granted to the subject type, counts every value against a quota, and logs every call. Anyone allowed to call it can still recognise the people they already know, within the quota.

Turning it on

In Person Key → Edit of the subject type, open Links, re-identification and external pseudonyms:

  1. Switch on Allow external pseudonym computation.
  2. Choose the API keys granted: create an API key of its own for the pipeline. Keys of dataset shares are never granted, and are refused even when they were.
  3. Set Pseudonyms a key may compute in an hour and in a day (1,000 and 5,000 by default). A call that would pass a quota is refused whole.

Request

POST /api/<organization>/<project>/pseudonym
Authorization: Bearer <api key>
Content-Type: application/json

{ "subjectType": "person", "kind": "candidate_id", "values": ["553", "554"] }
{ "subjectType": "person", "epoch": 2, "pseudonyms": ["P-7F3K9Q2M3B", "P-1DS4XM72VH"] }
  • At most 10,000 values in a call. A value that is no identifier (empty) gives null.
  • The links of the subject type are applied: a worker id gives the pseudonym of the person it belongs to.
  • The key goes in the header (or ?api_key= unless the instance takes keys in the header only, see Authentication).

As a BigQuery remote function

The endpoint also takes the request of a BigQuery remote function and answers in its format:

{ "calls": [["553"], ["554"]], "userDefinedContext": { "subjectType": "person", "kind": "candidate_id" } }
{ "replies": ["P-7F3K9Q2M3B", "P-1DS4XM72VH"] }

Put it behind the connection of the remote function (for example a Cloud Run proxy that adds the Authorization header), with user_defined_context set to the subject type and the kind.

From the command line

gig-cmd admin person-key pseudonym --project hr --subject-type person --kind candidate_id --values 553,554

It needs Manage Person Keys, the same switch, and counts against a quota per user.

Errors

StatusWhy
403No key, an invalid or expired key, a key not granted the subject type, a key of a share, or external computation off
404No such project or subject type
413More than 10,000 values
429The quota of the key for the hour or the day, or too many invalid keys from the address

Every call, allowed or refused, is a Person Key event of the project with the key, the number of values and the address of the caller, never the values.