# Create Twin Identity
This endpoint creates one or more Identities and attaches them to the given Twin.
In order for a user to perform the "create_twin_identity" operation, the "create_twin_identity" permission must be included in the list of allowed actions in the statement of the user's role.
|timestamp, ||body||Time at which the Identity expires. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window). If not provided, the value is set to |
|string, ||body||Visibility of the Identity. An Identity created in an account is visible to users belonging to that account. If the value of the |
"validity_ts" parameters are optional and do not need to be included in the request body when creating Identities. If they are not included in the request body, their default values are used.
In our example we create two Identities. We attach them to the Twin with the Twin UUID
The first Identity is
- It expires on the 8th of March 2023 at 10:23:14 a.m. GMT (
- It is a public Identity. Public Identities are visible to users of the account that owns the Identity and also to users of other accounts if the visibility rule of the Identity evaluates to
True. In our example, the Identity is visible to users whose
"visibility": "USER.profession == 'accounting' or USER.profession == 'sales'").
The second Identity is
- It does not expire (
- The Identity is private (
"visibility": null). Private Identities are only visible to users of the account that owns the Identity.
The response returns a list of Identities with their attributes.
|visibility||string||Visibility of the Identity. An Identity created in an account is visible to users belonging to that account. If the value of the |
|validity_ts||timestamp||Time at which the Identity expires. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window). If the value is |
|updated_ts||timestamp||Time at which the Identity was last updated. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window).|
Certificate generated automatically by the system upon creation of the Identity. The creation certificate cannot be modified after it has been generated.
# Response ('Identity already exists')
If you try to create an Identity that already exists, you will receive the message
"error": 'Identity already exists.'" for this particular Identity in the response. However, the response itself will return the
201 Created status code. Please see the below example for more details.
In the example below, we create two Identities - the Identity
"RFID#ae14bdc-0f6d-a00-4091-1a6d793aaaa" ( it already exists in the account) and the Identity
"RFID#ae14bdc-0f6d-a00-4091-1a6d793dddd" (it does not exist in the account yet).
The response returns the message
"error": "Identity already exists." for the Identity
"RFID#ae14bdc-0f6d-a00-4091-1a6d793aaaa" (the Identity that already exists in the account) and the details of the created Identity
"RFID#ae14bdc-0f6d-a00-4091-1a6d793dddd". The status code of the response is
# Status codes
Requests to this endpoint result in generic status codes. For a comprehensive list of status codes, please consult the Status codes section.
|201||Created||If an Identity that you are trying to create already exists, you will receive the error: |