# Migrate a content entry

_NgCms / Content Entries_

`POST /ng-cms/content/{projectId}/{typeKey}/migrate`

## Parameters

- `projectId` (string, required) — Unique identifier of the project (bucket)
- `typeKey` (string, required) — Key or ID of the content type

## Request Body

### `MigrateContentEntryRequest`

- `fields` (object, required) — Key-value map of field data matching the content type schema
- `contentTypeKey` (string, optional) — Content type key (optional override; typically resolved from typeKey route param)
- `createdAt` (string, optional) — Original creation timestamp in ISO 8601 UTC format to preserve on migration
- `updatedAt` (string, optional) — Original last-updated timestamp in ISO 8601 UTC format to preserve on migration
- `publishedAt` (string, optional) — Original publish timestamp in ISO 8601 UTC format to preserve on migration

## Responses

### `201` — Entry migrated successfully. Returns the new entry ID.

Type: `ApiResponse<string>`

- `success` (boolean) — Always true on success
- `result` (string) — ID of the newly created content entry
- `errors` (ErrorDetail[]) — Empty on success

### `401` — Unauthorized.


### `404` — Content type or project not found.


### `400` — Validation failed.

Type: `ApiResponse<T>`

- `isValid` (boolean) — Always false
- `validationErrors` (ValidationError[]) — List of validation failures
  - `name` (string) — Field that failed
  - `attemptedValue` (object) — Submitted value
  - `message` (string) — Validation message

### `500` — Unexpected server error.

Type: `ApiResponse<T>`

- `success` (boolean) — Always false
- `errors` (ErrorDetail[]) — Server-side errors
  - `correlationId` (string) — Trace ID
  - `message` (string) — Error message
  - `stack` (string) — Stack trace (non-production only)


## Code Examples

### curl

```curl
curl --request POST \
  --url https://apis-spb.konso.io/ng-cms/content/{projectId}/{typeKey}/migrate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{"fields":{"title":"Migrated Entry"},"createdAt":"2024-01-15T10:30:00Z","publishedAt":"2024-01-15T12:00:00Z"}'
```

### javascript

```js
fetch('https://apis-spb.konso.io/ng-cms/content/{projectId}/{typeKey}/migrate', {
  method: 'POST',
  headers: { Authorization: 'Bearer <token>', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    fields: { title: 'Migrated Entry' },
    createdAt: '2024-01-15T10:30:00Z',
    publishedAt: '2024-01-15T12:00:00Z'
  })
});
```

### dotnet

```dotnet
await client.PostAsJsonAsync("https://apis-spb.konso.io/ng-cms/content/{projectId}/{typeKey}/migrate", new MigrateContentEntryRequest
{
    Fields = new Dictionary<string, object> { ["title"] = "Migrated Entry" },
    CreatedAt = DateTime.UtcNow.AddMonths(-6),
    PublishedAt = DateTime.UtcNow.AddMonths(-6)
});
```

### python

```python
requests.post("https://apis-spb.konso.io/ng-cms/content/{projectId}/{typeKey}/migrate", json={"fields": {"title": "Migrated Entry"}, "createdAt": "2024-01-15T10:30:00Z", "publishedAt": "2024-01-15T12:00:00Z"}, headers=headers)
```

### Request Body Example

```json
{
  "projectId": "example-string",
  "typeKey": "example-string"
}
```

### Response Example (201)

```json
{
  "success": true,
  "result": "ce_a1b2c3d4e5f6",
  "errors": []
}
```
