Identity
Create or retrieve an Identity object.
Endpoint
https://api.dfend.app/identity
Accepts requests from server environments only (secret API key).
Methods
GET
Retrieve the Identity for a user.
Accepts
body  object  An object containing one of the following fields:
userIdstring The user's primary key or unique ID in your system.idstring Theidvalue of the user's Identity in DFend.
Returns
A JSON-encoded Identity object.
POST
Register an identity for a user.
Accepts
body  object  An object containing the following fields:
userIdstring The user's primary key or unique ID in your system.emailstring optional The user's email address. Must be a valid email address.phonestring optional The user's phone number. Must be in E. 164 format.mergeboolean optional Update an existing Identity with this data if one exists.metadataobject optional Custom metadata you wish to add to this Identity.
If you are using any partner integrations, please be sure to merge the email address a user uses with the integration provider into the Identity you created for them in any other application or service to avoid duplicate Identities.
Returns
A JSON-encoded object containing the following fields:
idstring The user's Identity ID under your account on DFend.createdboolean Whether a new Identity was created.mergedboolean Whether an existing Identity was updated.
You must add the id field to the connected user's data in your system. This is the only way you will be able to match Events to your users.
Last updated