# Duplicate a project

`POST /api/project/{projectId}/duplicate`

URL: https://repsona.com/api/post-project-projectid-duplicate

Duplicates statuses, milestones and the task tree (tags included). Task status/responsible/ball are cleared. Notes, teammates and Kaizen are not duplicated.

## Parameters

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `projectId` | path | integer | required | The project ID. |

## Request body

| name | in | type | required | description |
| --- | --- | --- | --- | --- |
| `key` | body | string | required | Unique key of the new project: 3 to 30 characters of letters, numbers, `_`, `-` and `.`. |
| `name` | body | string | required | Display name of the new project (up to 255 characters). Falls back to `key` when empty. |
| `userIds` | body | integer[] |  | IDs of users to add as members of the new project (up to 500). You are always added. Users outside the space are ignored. |
| `startDate` | body | integer \| null |  | Start day of the copied schedule, in epoch milliseconds, from 2000-01-01 to 2099-12-31. Task dates are shifted so the earliest start or due date of the source tasks falls on this day (UTC). Omit or pass `null` to keep the original dates. |

## Request

```sh
curl -X POST "https://<space>.repsona.com/api/project/{projectId}/duplicate" \
  -H "Authorization: Bearer $REPSONA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "key": "WEB-NEXT",
    "name": "Website renewal (phase 2)",
    "userIds": [
      4782
    ],
    "startDate": 1797292800000
  }'
```

## Responses

- 200: Duplicated project detail
- 400: Invalid body or project name already exists
- 401: Authentication is required
- 403: Not a project member
- 404: Project not found

## Example response

```json
{
  "id": 12526,
  "name": "WEB-NEXT",
  "fullName": "Website renewal (phase 2)",
  "purpose": "",
  "avatarUrl": "",
  "backgroundUrl": "",
  "productImageUrl": "",
  "isClosed": false,
  "isPublic": false,
  "free": false,
  "holidays": [],
  "regularHolidays": [
    0,
    6
  ],
  "members": [
    {
      "id": 4781,
      "name": "sam.carter",
      "fullName": "Sam Carter",
      "avatarUrl": null,
      "color": null,
      "state": "active"
    },
    {
      "id": 4782,
      "name": "reon.walls",
      "fullName": "Reon Walls",
      "avatarUrl": null,
      "color": null,
      "state": "active"
    }
  ],
  "hasTask": true
}
```
