# Create or replace a twin.

Endpoint: PUT /twins
Version: v3
Security: oauth2

## Security:

  - `oauth2` (unknown)
    oauth2

## Request body:

  - `application/json` (unknown)
    Instance of DigitalTwin.

## Request fields (application/json):

  - `id` (string, required)
    The unique Id of the digital twin.

  - `modelId` (string, required)
    Digital Twin Model Identifier.

  - `lastUpdateTime` (null | string)
    Timestamp when the twin was last updated in ISO 8601 format.

  - `eTag` (null | string)
    Concurrency tag for optimistic concurrency control. Populated from the underlying ADT entity when sourced from AdtQuery; null when sourced from ADX.

  - `contents` (object)
    This field will contain properties and components as defined in the contents section of the DTDL definition of the twin.

## Response 200:

  - `200` (unknown)
    Created Twin .

## Response 200 fields (application/json):

  - `id` (string, required)
    The unique Id of the digital twin.

  - `modelId` (string, required)
    Digital Twin Model Identifier.

  - `lastUpdateTime` (null | string)
    Timestamp when the twin was last updated in ISO 8601 format.

  - `eTag` (null | string)
    Concurrency tag for optimistic concurrency control. Populated from the underlying ADT entity when sourced from AdtQuery; null when sourced from ADX.

  - `contents` (object)
    This field will contain properties and components as defined in the contents section of the DTDL definition of the twin.

## Response 400 fields (application/json):

  - `type` (null | string)

  - `title` (null | string)

  - `status` (null | integer)

  - `detail` (null | string)

  - `instance` (null | string)

