Help Center/ KooDrive/ API Reference/ API/ Synchronization directory./ Creating a Synchronization Directory
Updated on 2025-10-22 GMT+08:00

Creating a Synchronization Directory

Function

Create a synchronization directory.

Authorization Information

No identity policy-based permission required for calling this API.

URI

POST /koodrive/ose/v1/syncDir/create

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Authorization

Yes

String

Access token. Token authentication is used to call KooDrive APIs. A token indicates the permission. When an API is called, the token is added to the request header to obtain the operation permission. For details about how to obtain an access token, see the corresponding developer guide. The format is Bearer+{access_token}.

X-User-Id

Yes

String

User ID, which is used for app authentication.

X-Date

Yes

String

Date, which is used for app authentication.

Host

Yes

String

Address, which is used for app authentication.

X-Traceid

No

String

Message log trace ID. The value contains 58 bits.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

container

Yes

String

Space ID.

fileName

No

String

Name of the synchronization directory.

Note: When a name is transferred, the system checks whether a directory with the same name exists in the root directory. If a directory with the same name exists, the system creates a new directory with a time suffix and sets it as the synchronization directory. If no directory with the same name exists in the root directory, the system creates a new synchronization directory in the root directory using the provided file name. This parameter is mutually exclusive with fileId. If fileId is transferred, this parameter is optional. Otherwise, this parameter is mandatory.

hidden

No

Boolean

Whether it is hidden.

Default value: false.

parentFolder

No

String

Parent directory ID.

The root directory (root or sbox) cannot be transferred. If no directory is transferred, the directory is created in the root directory by default.

Note: This field is mutually exclusive with fileId.

fileId

No

String

ID of the directory to be set as the synchronization directory.

After this parameter is transferred, the directory is set as the synchronization directory. This parameter is mutually exclusive with fileName, hidden, and parentFolder.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

container

String

Space ID.

fileId

String

File ID.

fileName

String

Name of the synchronization directory.

exist

Boolean

Whether the synchronization directory exists.

This field is returned only when the synchronization directory already exists.

Example Requests

Example request for creating a synchronization directory.

POST /koodrive/ose/v1/syncDir/create

Authorization:Bearer+10f88*********4791e9ff
{
  "container": "K*****",
  "fileName": "K*****",
  "parentFolder": "K*****",
  "fileId": "K*****",
  "hidden": true
}

Example Responses

Status code: 200

Response to the request for creating and associating a synchronization directory.

{
  "container" : "K*****",
  "fileName" : "K*****",
  "fileId" : "K*****",
  "exist" : true
}

Status Codes

Status Code

Description

200

Response to the request for creating and associating a synchronization directory.