curl --request POST \
--url https://api.dify.ai/v1/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/workflow-imports \
--header 'Authorization: Bearer <token>' \
--header 'Idempotency-Key: <string>' \
--header 'Content-Type: application/json' \
--data '{
"items": [
{
"lastEditedTime": "2026-09-01T12:00:00.000Z",
"name": "Onboarding",
"pageId": "3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c",
"providerItemId": "[\"ws_01HZYQ8K3M\",\"3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c\"]",
"type": "page",
"workspaceId": "ws_01HZYQ8K3M"
},
{
"lastEditedTime": "2026-08-20T09:30:00.000Z",
"name": "Runbooks",
"pageId": "5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e",
"providerItemId": "[\"ws_01HZYQ8K3M\",\"5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e\"]",
"type": "database",
"workspaceId": "ws_01HZYQ8K3M"
}
],
"kind": "online-document-import"
}'
import requests
url = "https://api.dify.ai/v1/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/workflow-imports"
headers = {
"Authorization": "Bearer <token>",
"Idempotency-Key": "<string>",
"Content-Type": "application/json",
}
payload = {
"items": [
{
"lastEditedTime": "2026-09-01T12:00:00.000Z",
"name": "Onboarding",
"pageId": "3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c",
"providerItemId": "[\"ws_01HZYQ8K3M\",\"3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c\"]",
"type": "page",
"workspaceId": "ws_01HZYQ8K3M"
},
{
"lastEditedTime": "2026-08-20T09:30:00.000Z",
"name": "Runbooks",
"pageId": "5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e",
"providerItemId": "[\"ws_01HZYQ8K3M\",\"5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e\"]",
"type": "database",
"workspaceId": "ws_01HZYQ8K3M"
}
],
"kind": "online-document-import"
}
response = requests.request("POST", url, headers=headers, json=payload)
print(response.text)
const response = await fetch('https://api.dify.ai/v1/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/workflow-imports', {
method: 'POST',
headers: {
'Authorization': 'Bearer <token>',
'Idempotency-Key': '<string>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
"items": [
{
"lastEditedTime": "2026-09-01T12:00:00.000Z",
"name": "Onboarding",
"pageId": "3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c",
"providerItemId": "[\"ws_01HZYQ8K3M\",\"3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c\"]",
"type": "page",
"workspaceId": "ws_01HZYQ8K3M"
},
{
"lastEditedTime": "2026-08-20T09:30:00.000Z",
"name": "Runbooks",
"pageId": "5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e",
"providerItemId": "[\"ws_01HZYQ8K3M\",\"5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e\"]",
"type": "database",
"workspaceId": "ws_01HZYQ8K3M"
}
],
"kind": "online-document-import"
})
});
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.dify.ai/v1/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/workflow-imports',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{
"items": [
{
"lastEditedTime": "2026-09-01T12:00:00.000Z",
"name": "Onboarding",
"pageId": "3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c",
"providerItemId": "[\\"ws_01HZYQ8K3M\\",\\"3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c\\"]",
"type": "page",
"workspaceId": "ws_01HZYQ8K3M"
},
{
"lastEditedTime": "2026-08-20T09:30:00.000Z",
"name": "Runbooks",
"pageId": "5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e",
"providerItemId": "[\\"ws_01HZYQ8K3M\\",\\"5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e\\"]",
"type": "database",
"workspaceId": "ws_01HZYQ8K3M"
}
],
"kind": "online-document-import"
}',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer <token>',
'Idempotency-Key: <string>',
'Content-Type: application/json',
],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://api.dify.ai/v1/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/workflow-imports"
payload := strings.NewReader("{\n \"items\": [\n {\n \"lastEditedTime\": \"2026-09-01T12:00:00.000Z\",\n \"name\": \"Onboarding\",\n \"pageId\": \"3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c\",\n \"providerItemId\": \"[\\\"ws_01HZYQ8K3M\\\",\\\"3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c\\\"]\",\n \"type\": \"page\",\n \"workspaceId\": \"ws_01HZYQ8K3M\"\n },\n {\n \"lastEditedTime\": \"2026-08-20T09:30:00.000Z\",\n \"name\": \"Runbooks\",\n \"pageId\": \"5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e\",\n \"providerItemId\": \"[\\\"ws_01HZYQ8K3M\\\",\\\"5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e\\\"]\",\n \"type\": \"database\",\n \"workspaceId\": \"ws_01HZYQ8K3M\"\n }\n ],\n \"kind\": \"online-document-import\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Idempotency-Key", "<string>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.dify.ai/v1/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/workflow-imports"))
.header("Authorization", "Bearer <token>")
.header("Idempotency-Key", "<string>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"items\": [\n {\n \"lastEditedTime\": \"2026-09-01T12:00:00.000Z\",\n \"name\": \"Onboarding\",\n \"pageId\": \"3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c\",\n \"providerItemId\": \"[\\\"ws_01HZYQ8K3M\\\",\\\"3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c\\\"]\",\n \"type\": \"page\",\n \"workspaceId\": \"ws_01HZYQ8K3M\"\n },\n {\n \"lastEditedTime\": \"2026-08-20T09:30:00.000Z\",\n \"name\": \"Runbooks\",\n \"pageId\": \"5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e\",\n \"providerItemId\": \"[\\\"ws_01HZYQ8K3M\\\",\\\"5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e\\\"]\",\n \"type\": \"database\",\n \"workspaceId\": \"ws_01HZYQ8K3M\"\n }\n ],\n \"kind\": \"online-document-import\"\n}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
require 'uri'
require 'net/http'
url = URI('https://api.dify.ai/v1/knowledge-fs/spaces/{knowledge_base_id}/sources/{source_id}/workflow-imports')
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = url.scheme == 'https'
request = Net::HTTP::Post.new(url)
request['Authorization'] = 'Bearer <token>'
request['Idempotency-Key'] = '<string>'
request['Content-Type'] = 'application/json'
request.body = '{
"items": [
{
"lastEditedTime": "2026-09-01T12:00:00.000Z",
"name": "Onboarding",
"pageId": "3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c",
"providerItemId": "[\\"ws_01HZYQ8K3M\\",\\"3f9a1c2b-7d4e-4f5a-8b6c-9d0e1f2a3b4c\\"]",
"type": "page",
"workspaceId": "ws_01HZYQ8K3M"
},
{
"lastEditedTime": "2026-08-20T09:30:00.000Z",
"name": "Runbooks",
"pageId": "5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e",
"providerItemId": "[\\"ws_01HZYQ8K3M\\",\\"5c1b2d3e-8f4a-4b6c-9d7e-0f1a2b3c4d5e\\"]",
"type": "database",
"workspaceId": "ws_01HZYQ8K3M"
}
],
"kind": "online-document-import"
}'
response = http.request(request)
puts response.read_body