# Create Twin

This endpoint creates a Twin.

Method Path Operation*
POST /twins create_twin

*

In order for a user to perform the "create_twin" operation, the "create_twin" permission must be included in the list of allowed actions in the statement of the user's role.

# Request

Parameter Type In Description
description
optional *
dictionary body User-defined key-value pairs:
- key: It must match the regular expression(opens new window) ^[a-z_][0-9a-z_]{0,63}$.
- value: JSON compliant value.
Only the owner of a Twin can update its description.
For more details consult the description field section.

*

If no attributes are provided in the request body of "description" ("description": {}), the response will return an empty dictionary ("description": {}).
If "description" with the value null is provided in the request body, the response will not return the "description" field.
If the request body does not contain "description", the response will not return the "description" field.

In our example, we are going to create a Twin with the following "description":

# Response

Attribute Type Description
owner string Account UUID of the account which is the current owner of the Twin. The ownership of a Twin can be transferred.
status string, value is "alive" or "terminated" The status of a Twin can be "alive" or "terminated". In case of alive Twins, the "description" can be updated by the owner of the Twin. In case of terminated Twins, the "description" cannot be updated. Ledger Entries, Identities, and Docs can be attached to alive and terminated Twins by all users involved in the process.
updated_ts timestamp Time at which the Twin was last updated. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window).
description dictionary Attributes of the Twin defined by the owner in form of key-value pairs:
- key: It must match the regular expression(opens new window) ^[a-z_][0-9a-z_]{0,63}$.
- value: JSON compliant value.
Only the owner of the Twin can update the description of the Twin.
For more details consult the description section.
creation_certificate dictionary
Certificate generated automatically by the system upon creation of the Twin. It cannot be modified after it has been generated.
Attribute Type Description
uuid string Twin UUID. It is generated automatically when the Twin is created and stored in the "uuid" field of the creation certificate.
creator string Account UUID of the account creating the Twin.
created_ts timestamp Time at which the Twin was created. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window).
termination_certificate dictionary
Certificate generated automatically by the system when the Twin is terminated. It cannot be modified after it has been generated.
Attribute Type Description
issuer string Account UUID of the account terminating the Twin.
terminated_ts timestamp Time at which the Twin was terminated. Measured in seconds (to three decimal places) that have elapsed since the Unix epoch(opens new window).

In our example, the response returns the details of the Twin with the Twin UUID "f63ce1df-4643-49b2-9d34-38f4b35b9c7a" that we created:

# Status codes

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

Was this article helpful?