All Products
Search
Document Center

DataWorks:CreateFile

Last Updated:Oct 16, 2026

Creates a file in Data Studio. This operation does not support creating data integration node tasks.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

dataworks:*

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

FileFolderPath

string

No

The path of the file.

Business_process/First_Business_Process/MaxCompute/Folder_1/Folder_2

ProjectId

integer

No

The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Configuration page to obtain the workspace ID.

You must specify either this parameter or the ProjectIdentifier parameter to determine the DataWorks workspace for this API operation.

10000

FileName

string

Yes

The name of the file.

File name

FileDescription

string

No

The description of the file.

This is the file description

FileType

integer

Yes

The code type of the file. The code format varies based on the file type. For more information, see DataWorks node types.

You can call the ListFileType operation to query the code type of the file.

10

Owner

string

No

The Alibaba Cloud user ID of the file owner. If this parameter is left empty, the Alibaba Cloud user ID of the caller is used by default.

1000000000001

Content

string

No

The code content of the file. The code format varies based on the file type. You can find a task of the corresponding type in Operation Center, right-click the task, and select View Code to view the specific code format.

SHOW TABLES;

AutoRerunTimes

integer

No

The number of automatic reruns after an error occurs. Maximum value: 10.

3

AutoRerunIntervalMillis

integer

No

The interval between automatic reruns after an error occurs. Unit: milliseconds. Maximum value: 1800000, which indicates 30 minutes.

This parameter corresponds to the Rerun Interval setting in Schedule Configuration > Time Attributes > Automatic Rerun after Error for a data development task in the DataWorks console. The time unit for the Rerun Interval setting in the console is minutes. Make sure to convert the time when you call this operation.

120000

RerunMode

string

No

The rerun mode. Valid values:

  • ALL_ALLOWED: The task can be rerun after it succeeds or fails.

  • FAILURE_ALLOWED: The task cannot be rerun after it succeeds, but can be rerun after it fails.

  • ALL_DENIED: The task cannot be rerun after it succeeds or fails.

This parameter corresponds to the Rerun Mode setting in Schedule Configuration > Time Attributes > Rerun Mode for a data development task in the DataWorks console.

Valid values:

  • ALL_ALLOWED :

    The task can be rerun after it succeeds or fails.

  • ALL_DENIED :

    The task cannot be rerun after it succeeds or fails.

  • FAILURE_ALLOWED :

    The task cannot be rerun after it succeeds, but can be rerun after it fails.

ALL_ALLOWED

Stop

boolean

No

Specifies whether to pause scheduling. Valid values:

  • true: Pause scheduling.

  • false: Do not pause scheduling.

This parameter corresponds to the Pause Scheduling option in Schedule Configuration > Time Attributes > Schedule Type for a data development task in the DataWorks console.

false

ParaValue

string

No

The scheduling parameters. Separate multiple parameters with spaces.

This parameter corresponds to the Parameters setting in Schedule Configuration > Parameters for a data development task in the DataWorks console. For more information, see Scheduling parameters.

a=x b=y

StartEffectDate

integer

No

The timestamp in milliseconds when automatic scheduling starts.

This parameter corresponds to the start time in the Effective Date setting in Schedule Configuration > Time Attributes > Effective Date for a data development task in the DataWorks console. The value is a timestamp in milliseconds.

1671608450000

EndEffectDate

integer

No

The timestamp in milliseconds when automatic scheduling stops.

This parameter corresponds to the end time in the Effective Date setting in Schedule Configuration > Time Attributes > Effective Date for a data development task in the DataWorks console. The value is a timestamp in milliseconds.

1671694850000

CronExpress

string

No

The cron expression for periodic scheduling. This parameter corresponds to the cron Expression setting in Schedule Configuration > Time Property > cron Expression for a data development node in the DataWorks console. After you configure the Schedule Cycle and timed scheduling time, DataWorks automatically generates the corresponding cron expression.

Examples:

  • Schedule the task at 05:30 every day: 00 30 05 * * ?

  • Schedule the task at the 15th minute of every hour: 00 15 00-23/1 * * ?

  • Schedule the task every 10 minutes: 00 00/10 * * * ?

  • Schedule the task every 10 minutes from 08:00 to 17:00 every day: 00 00-59/10 8-17 * * * ?

  • Schedule the task at 00:20 on the first day of every month: 00 20 00 1 * ?

  • Schedule the task every three months starting from 00:10 on January 1: 00 10 00 1 1-12/3 ?

  • Schedule the task at 00:05 every Tuesday and Friday: 00 05 00 * * 2,5

Due to the rules of the DataWorks scheduling system, the cron expression has the following limits:

  • The minimum scheduling interval is 5 minutes.

  • The earliest scheduling time of a day is 00:05.

00 05 00 * * ?

CycleType

string

No

The type of the scheduling cycle. Valid values: NOT_DAY (minute or hour) and DAY (day, week, or month).

This parameter corresponds to the Schedule Cycle setting in Schedule Configuration > Time Attributes > Schedule Cycle for a data development task in the DataWorks console.

Valid values:

  • NOT_DAY :

    Scheduled by minute or hour.

  • DAY :

    Scheduled by day, week, or month.

DAY

DependentType

string

No

The dependency on the previous cycle. Valid values:

  • SELF: Depends on the current node.

  • CHILD: Depends on the first-level child nodes.

  • USER_DEFINE: Depends on other nodes.

  • NONE: Does not depend on the previous cycle.

  • USER_DEFINE_AND_SELF: Depends on a combination of the current node and other nodes across cycles.

  • CHILD_AND_SELF: Depends on a combination of the first-level child nodes and the current node across cycles.

Valid values:

  • CHILD_AND_SELF :

    Depends on a combination of the first-level child nodes and the current node across cycles.

  • USER_DEFINE :

    Depends on other nodes.

  • SELF :

    Depends on the current node.

  • USER_DEFINE_AND_SELF :

    Depends on a combination of the current node and other nodes across cycles.

  • NONE :

    Does not depend on the previous cycle.

  • CHILD :

    Depends on the first-level child nodes.

NONE

DependentNodeIdList

string

No

The list of nodes that the current node depends on in the previous cycle.

abc

InputList

string

No

The output names of the upstream files on which the current file depends. Separate multiple output names with commas (,).

This parameter corresponds to the Parent Node Output Name setting when Same Cycle is selected in Schedule Configuration > Scheduling Dependencies for a data development task in the DataWorks console.

project_root,project.file1,project.001_out

OutputList

string

No

The output names of the file. Separate multiple output names with commas (,). This parameter corresponds to the Output Name of Current Node setting in Schedule Configuration > Scheduling Dependencies for a data development task.

project_root,project.file1,project.001_out

ProjectIdentifier

string

No

The name of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Configuration page to obtain the workspace name.

You must specify either this parameter or the ProjectId parameter to determine the DataWorks workspace for this API operation.

dw_project

ResourceGroupIdentifier

string

No

The resource group used to run the task after the file is deployed. You can call the ListResourceGroups operation and obtain the list of available resource groups for the workspace from the identifier field.

Note

Make sure that the resource groups returned by the ListResourceGroups operation are bound to the workspace where the file is created. Only bound resource groups can be used in the CreateFile operation.

group_375827434852437

ResourceGroupId

integer

No

[Deprecated] Do not use this parameter.

The resource group used to run the task after the file is deployed. This parameter corresponds to the Schedule Resource Group setting in Schedule Configuration > Resource Attributes on the page. You can specify either this parameter or the ResourceGroupIdentifier parameter.

You can call the ListResourceGroups operation to obtain the list of available resource groups for the workspace. Set ResourceGroupType to 1 and obtain the ID field from the result.

375827434852437

ConnectionName

string

No

The data source connected when the task is run after the file is deployed. You can call the UpdateDataSource operation to obtain the list of available data sources for the workspace.

odps_source

AutoParsing

boolean

No

Specifies whether to enable the automatic parsing feature for the file. Valid values:

  • true: The file automatically parses the code.

  • false: The file does not automatically parse the code.

This parameter corresponds to the Code Parsing setting when Same Cycle is selected in Schedule Configuration > Scheduling Dependencies for a data development task in the DataWorks console.

true

SchedulerType

string

No

The scheduling type. Valid values:

  • NORMAL: Normal scheduling task.

  • MANUAL: Manual task. It is not run on a daily schedule and corresponds to a node in a manual workflow.

  • PAUSE: Paused task.

  • SKIP: Dry-run task. It is run on a daily schedule, but its status is directly set to successful when the scheduling is triggered.

Valid values:

  • PAUSE :

    Paused task.

  • SKIP :

    Dry-run task. It is run on a daily schedule, but its status is directly set to successful when the scheduling is triggered.

  • MANUAL :

    Manual task. It is not run on a daily schedule and corresponds to a node in a manual workflow.

  • NORMAL :

    Normal scheduling task.

NORMAL

AdvancedSettings

string

No

The advanced settings of the task.

This parameter corresponds to the Advanced Settings section in the right-side navigation pane of the edit page for EMR Spark Streaming and EMR Streaming SQL data development tasks in the DataWorks console.

Currently, only EMR Spark Streaming and EMR Streaming SQL tasks support this parameter, and the value must be in JSON format.

{"queue":"default","SPARK_CONF":"--conf spark.driver.memory=2g"}

StartImmediately

boolean

No

Specifies whether to start the task immediately after it is deployed.

This parameter corresponds to the Startup Method setting in Configuration > Time Attributes > Startup Method in the right-side navigation pane of the edit page for EMR Spark Streaming and EMR Streaming SQL data development tasks in the DataWorks console.

true

InputParameters

string

No

The context input parameters of the node. The value is in JSON format. For the included fields, refer to the InputContextParameterList parameter structure in the response of the GetFile operation.

This parameter corresponds to the Input Parameters of Current Node setting in Schedule Configuration > Node Context for a data development task in the DataWorks console.

[{"ValueSource": "project_001.first_node:bizdate_param","ParameterName": "bizdate_input"}]

OutputParameters

string

No

The context output parameters of the node. The value is in JSON format. For the included fields, refer to the OutputContextParameterList parameter structure in the response of the GetFile operation.

This parameter corresponds to the Output Parameters of Current Node setting in Schedule Configuration > Node Context for a data development task in the DataWorks console.

[{"Type": 1,"Value": "${bizdate}","ParameterName": "bizdate_param"}]

IgnoreParentSkipRunningProperty

boolean

No

Specifies whether to inherit the dry-run property from the previous cycle. Valid values:

  • true: Inherit the dry-run property from the previous cycle.

  • false: Do not inherit the dry-run property from the previous cycle.

false

CreateFolderIfNotExists

boolean

No

Specifies whether to enable automatic creation of the directory specified by the FileFolderPath parameter if it does not exist in the system. Valid values:

  • true: Enables automatic creation of the directory if it does not exist.

  • false: The call fails if the directory does not exist.

false

ApplyScheduleImmediately

boolean

No

Specifies whether the scheduling configuration takes effect immediately after deployment.

true

Timeout

integer

No

The timeout definition in the scheduling configuration.

1

ImageId

string

No

The ID of the custom image.

m-bp1h4b5a8ogkbll2f3tr

Response elements

Element

Type

Description

Example

object

The response structure.

HttpStatusCode

integer

The HTTP status code.

200

Data

integer

The ID of the file after it is created.

1000001

RequestId

string

The unique ID of the request. You can use the ID to troubleshoot issues when an error occurs.

0000-ABCD-EFG

ErrorMessage

string

The error message.

The connection does not exist.

Success

boolean

Indicates whether the request is successful. Valid values:

  • true: The request is successful.

  • false: The request fails.

true

ErrorCode

string

The error code.

Invalid.Tenant.ConnectionNotExists

Examples

Success response

JSON format

{
  "HttpStatusCode": 200,
  "Data": 1000001,
  "RequestId": "0000-ABCD-EFG",
  "ErrorMessage": "The connection does not exist.",
  "Success": true,
  "ErrorCode": "Invalid.Tenant.ConnectionNotExists"
}

Error codes

HTTP status code

Error code

Error message

Description

500 InternalError.System An internal system error occurred. Try again later.
500 InternalError.UserId.Missing An internal system error occurred. Try again later.
403 Forbidden.Access Access is forbidden. Please first activate DataWorks Enterprise Edition or Flagship Edition. No permission, please authorize
429 Throttling.Api The request for this resource has exceeded your available limit.
429 Throttling.System The DataWorks system is busy. Try again later.
429 Throttling.User Your request is too frequent. Try again later.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.