# Duplicate a module

`POST https://api.cademi.com.br/api/v3/products/{product_id}/modules/{module_id}/copies`

Operation ID: `modules.copies.create` · API v3

Starts an asynchronous operation that copies the module, including its contents, into the product given in `target_product_id`. Optionally, use `parent_id` to place the copy inside a group of the target product and `name` to rename it.

Requires the `modules.create` permission on the target product. Replicated modules cannot be copied, and modules cannot be copied into replicated products; both cases return the `replica_readonly` error code.

The `Idempotency-Key` header is required. Track progress through the returned operation; when it completes, the item result contains `copy_id`, the public ID of the new module.

Required permissions: `modules.create`.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `product_id` | path | string | yes |  |
| `module_id` | path | string | yes |  |

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string or null | no |  |
| `parent_id` | string or null | no |  |
| `target_product_id` | string | yes |  |

## Responses

### 202

The copy was accepted for asynchronous processing. Returns the operation that tracks its progress.

Body: `data`: Operation.

Fields of Operation:

| Field | Type | Required | Description |
|---|---|---|---|
| `attempt` | object or null | yes |  |
| `cancellation_requested` | boolean | yes |  |
| `created_at` | string (date-time) | yes |  |
| `error` | object or null | yes |  |
| `expires_at` | string (date-time) | yes |  |
| `finished_at` | string or null (date-time) | yes |  |
| `id` | string | yes | Public ID, with the op_ prefix. |
| `items_url` | string | yes |  |
| `object` | string, one of `operation` | yes |  |
| `progress` | object | yes |  |
| `result_url` | string or null | yes |  |
| `started_at` | string or null (date-time) | yes |  |
| `status` | string, one of `queued`, `running`, `succeeded`, `partially_succeeded`, `failed`, `canceled` | yes |  |
| `type` | string | yes | Type of the operation, from a fixed set of values. |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 404

The module or the target product was not found or is not accessible with the current credentials.

Body: Error.

### 422

The request does not include the required Idempotency-Key header.

Body: Error.

Full schema: https://cademi.dev/openapi/v3.json
