> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Import a New Workflow API

<Badge icon="arrow-left" color="gray">[Back to API List](/ai-for-process/apis/apis)</Badge>

This API imports a new workflow by providing the necessary **file IDs**, ensuring all the necessary configurations, including the workflow's flow data, app definitions, and environment variables are correctly imported. After triggering the import, the response returns a `dockStatusId`. Use this ID to call the [Get Dock Status API](/ai-for-process/apis/apis-list/get-dock-status) and verify the successful import of the workflow.

To import a workflow, follow the steps below:

1. **Upload Files**: Use the [File Upload API](/ai-for-process/apis/apis-list/upload-file-api) to upload the files for the flow definition, app definition, and environment variables. This API returns unique **file IDs** for each file.
2. **Import the Workflow**: Call the Import Workflows API using the retrieved **file IDs** along with the workflow name.
3. **Track Import Status**: The API response returns a `dockStatusId` that helps monitor the import progress using the [Get Dock Status API](/ai-for-process/apis/apis-list/get-dock-status).

|                   |                                                        |
| ----------------- | ------------------------------------------------------ |
| **Method**        | POST                                                   |
| **Endpoint**      | `https://{host}/api/public/workflows/import`           |
| **Content Type**  | application/json                                       |
| **Authorization** | **`X-api-key`** - The API key used for authentication. |

**Where can I find the API key?**

To use the API, you will need an API key. [Learn more](/ai-for-process/workflows/triggers-and-access#create-an-api-key).

## Query Parameters

| PARAMETER | DESCRIPTION                                                           | TYPE   | REQUIRED/OPTIONAL |
| --------- | --------------------------------------------------------------------- | ------ | ----------------- |
| **host**  | The environment URL. For example, `https://ai-for-process.domain.ai/` | String | Required          |

## Sample Request

```js theme={null}
curl --location 'https://{host}/api/public/workflows/import' 
--header 'x-api-key: kg-90xxxxx5-9xxe-5xxf-9xx7-9xxxxxxxxxx4-55xxxxx4-axx9-4xx2-axx2-fxxxxxxxxxxa' 
--header 'Content-Type: application/json' 
--data '{
    "workflowDataFileId": "67bxxxxxxxxxxxxxxxxxxxxc",
    "flowDataFileId": "67bxxxxxxxxxxxxxxxxxxxx2",
    "envVariablesFileId": "67bxxxxxxxxxxxxxxxxxxxxx2",
    "workflowName":"Staging Workflow"
}'
```

## Body Parameters

| PARAMETER              | DESCRIPTION                                  | TYPE   | REQUIRED/OPTIONAL |
| ---------------------- | -------------------------------------------- | ------ | ----------------- |
| **workflowDataFileId** | The `file ID` for the workflow data file.    | String | Required          |
| **flowDataFileId**     | The `file ID` for the flow data file.        | String | Required          |
| **envVariablesFileId** | The `file ID` for the environment variables. | String | Optional          |
| **workflowName**       | The name of the workflow.                    | String | Required          |

## Sample Response

```js theme={null}
{
   "dockStatusId": "{dockStatusId}",
   "workflowId": "{workflowId}",
   "jobType": "WORKFLOWS",
   "action": "IMPORT",
   "status": "IN_PROGRESS"
}
```

## Response Parameters

| PARAMETER        | DESCRIPTION                                                     | TYPE   | SAMPLE VALUE                                  |
| ---------------- | --------------------------------------------------------------- | ------ | --------------------------------------------- |
| **dockStatusId** | The unique identifier to track the status of the import action. | String | e.g., ds-cxxxxxx5-dxxd-5xxf-9xxd-0xxxxx6c5xx8 |
| **workflowId**   | The unique identifier for the workflow.                         | String | e.g., a-8xxxxxxe-6xxe-5xx1-8xxc-b3xxxxx80xx6  |
| **jobType**      | The type of job being performed.                                | String | `WORKFLOWS`                                   |
| **action**       | The action that's performed on the workflow/model.              | String | `IMPORT`                                      |
| **status**       | The current status of the job.                                  | String | `IN_PROGRESS`, `SUCCESS`, or `FAILED`         |
