# Update Twin

This endpoint updates the description of the Twin. Only the owner of a Twin can update the description of the Twin.

Method Path Operation*
PATCH /twins/{twin} update_twin

*

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

# Request

Parameter Type In Description
{twin}
required
string path Twin UUID of the Twin to be retrieved.
description
optional *
dictionary body Attributes of the Twin 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.

*

If the "description" field with attributes is provided in the request body, the "description" field from the request body will replace the current "description" field.

If no attributes are provided in the request body of "description" ("description": {}), all attributes from the current "description" will be removed. The response will return an empty dictionary ("description": {}).

If "description" with the value null is provided in the request body, all attributes from the current "description" will be removed. The response will not return the "description" field.
If the request body does not contain "description", no changes will be made to the "description" field.

In our example, we want to change the value of the "qa_passed" attribute from true to false. The attribute is nested in the "description" field of the Twin:

# Response

Attribute Type Description
owner string Account UUID of the account that 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 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).

# 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?