---
title: "Create a migration job"
method: POST
path: "/migration-jobs"
tags: ["private"]
---

# Create a migration job

`POST /migration-jobs`

## Request

- Base URL: `/v1` (relative, and the document’s source URL is not known)
- URL: `/v1/migration-jobs`
- Auth: API key in header `Authorization`

Creates a migration job using body data.

## Query parameters

- `dry_run` boolean

## Request body

- object
  - `source_id` string, required
  - `target_id` string
  - `type` 'static_dataset', required

## Response `200`

Successful dry run response

- MigrationJobPreview
  - `allOf` MigrationJob
    - `job_number` integer
    - `last_updated` string, date-time
    - `label` string: The title of the source dataset, automatically populated during job creation
    - `links` object
      - `events` object: A link to all the events for the migration job
        - `href` string: A fully qualified URL to the migration job's events API response
      - `self` object: A link to the individual migration job
        - `href` string: A fully qualified URL to the migration job API response
        - `job_number` integer
      - `tasks` object: A link to all the tasks for the migration job
        - `href` string: A fully qualified URL to the migration job's tasks API response
    - `config` MigrationJobConfig
      - `collection_id` string
      - `source_id` string
      - `target_id` string
      - `type` 'static_dataset'
    - `state` 'submitted' | 'in_review' | 'approved' | 'published' | 'completed' | 'rejected' | 'cancelled' | 'migrating' | 'publishing' | 'pending_post_publish' | 'post_publishing' | 'reverting' | 'failed_post_publish' | 'failed_publish' | 'failed_migration' | 'failed_reversion'
    - `type` 'static_dataset'
  - `tasks` MigrationTask[]
    - `id` string
    - `last_updated` string, date-time
    - `source` MigrationTaskMetadata
      - `id` string
      - `label` string
      - `dataset_id` string
    - `state` 'submitted' | 'in_review' | 'approved' | 'published' | 'completed' | 'rejected' | 'cancelled' | 'migrating' | 'publishing' | 'pending_post_publish' | 'post_publishing' | 'reverting' | 'failed_post_publish' | 'failed_publish' | 'failed_migration' | 'failed_reversion'
    - `target` MigrationTaskMetadata
      - `id` string
      - `label` string
      - `dataset_id` string
    - `type` 'dataset_series' | 'dataset_edition' | 'dataset_version' | 'dataset_download'

## Other responses

- `202`: Successful task acceptance
- `400`: Invalid request body or source title not found
- `401`: Request is not authenticated
- `403`: Request is not authorised
- `409`: Already running job with these parameters
- `500`: Generic error response

---

[API](https://skmtc.dev/office-of-national-statistics/apis/dis-migration-service.md) - [All operations](https://skmtc.dev/office-of-national-statistics/apis/dis-migration-service/llms.txt) - [OpenAPI document](https://skmtc.dev/office-of-national-statistics/apis/dis-migration-service/revisions/5dddd1472e20?raw)
