# Create a User Secret PIN

This endpoint creates a User Secret PIN for a given User. A User Secret PIN is 6 characters long string of numbers and digits. The User Secret PIN is required to generate a User Secret.

IMPORTANT NOTE

A User Secret PIN is valid for 10 minutes, and it can be used only once to generate a User Secret. After a User Secret has been generated, the User Secret PIN is automatically deleted from the system.

Method Path Operation*
POST /users/{user}/secrets create_user_secret_pin

*

In order for a User to perform the "create_user_secret_pin" operation, the "create_user_secret_pin" permission must be included in the list of allowed actions in the statement of the User's Role.

# Request

Parameter Type In Description
{user}
required
string path User UUID of the User for whom User Secret PIN is generated.
validity_ts
optional *
timestamp, DEFAULT=null body Time at which the User Secret expires. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch (opens new window). If the value is null, the User Secret does not expire.

*

The "validity_ts" parameter is optional and does not need to be included in the request body when creating a User Secret PIN. If it is not included in the request body, its default value (null) is used.

In our example, User A (User UUID "fcf998ae-80e0-4eac-b7e8-378db626aefe"), who already has access to the Trusted Twin platform, generates a User Secret PIN for User B (User UUID "333b4bf7-43b6-4df1-927a-9ddbd7336144"). As User A wants the User Secret to expire on the 16th of March 2022 at 17:00:00 GMT, they set the "validity_ts" to 1647450000.0.

# Response

The response returns the User Secret PIN "P700SC" generated by User A for User B (User UUID "333b4bf7-43b6-4df1-927a-9ddbd7336144"). User B will use this User secret PIN to generate a User Secret through the create_user_secret endpoint.

# Status codes

Requests to this endpoint result in generic status codes. For a comprehensive list of status codes, please consult the Status Codes section.