Create a new data subject or update an existing one.

PATCH /v1/subjects/{type}/{subjectId}?saveOption=option
Content-Type: application/json

The request body is an open-ended valid JSON object containing data elements you wish to store for data subjects. type determines the subject type, usually user. This API updates the subject if one exists or creates a new one if one does not exist. If there is already a subject record, the saveOption query parameter determines how the subject record will be stored:

merge or unspecified
Merge the given subject information with the subject information in the database. This will update any field with matching name with the new value, while preserving existing fields that are not specified in the input document.
rewrite
Overwrite the subject information as given in the request body.

If the subject already exists, the existing state of the subject will be stored in the version archive.

Example

Existing subject:

{
  "name": "John Doe",
  "birthDate": "1985-04-12"
}

Request:

PATCH /v1/subjects/user/123e4567-e89b-12d3-a456-426655440000
Content-Type: application/json
  
{
  "birthDate": "1995-04-12",
  "country": "US"
}

Result:

{
  "name": "John Doe",
  "birthDate": "1995-04-12",
  "country": "US"
}

Response

200 Ok

Subject successfully created or updated.

400 Bad Request

Malformed request, invalid value, etc. The return value is a JSON error object containing diagnostic information.

403 Forbidden

The authenticated key does not have the privileges for this operation. The return value is a JSON error object containing diagnostic information.