How To
Summary
What is the process of creating new folders within a project via REST API?
Objective
You are attempting to create new folders within your watsonx.ai as a Service (hosted on IBM Cloud) as per the IBM Cloud Documentation. After enabling Folders in the project, you are able to create it using the UI. The request is how to accomplish the same task using REST API?
Environment
This request is applicable to a watsonx.ai as a Service instance hosted on IBM Cloud. With a few adjustments, you can also accomplish this task in an on-premise instance of watsonx.ai/Cloud Pak for Data installed on IBM Software Hub.
Steps
watsonx.ai on IBM Cloud
Note 1: The example below is using the JP-TOK data centre of IBM. For other data centre endpoints, please refer to our IBM Cloud Documentation.
Note 2: Replace {project_id} with the actual Project ID value of your project
Note 3: Replace ${TOKEN} with your Bearer Token. Steps to obtain this can be found in our IBM Cloud Documentation.
Note 4: Replace the values for absolute_path with the folder name/structure you wish to use
curl -X 'POST'
"https://api.jp-tok.dataplatform.cloud.ibm.com/v1/asset_folders?project_id={project_id}"
-H "Authorization: Bearer ${TOKEN}"
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"absolute_path": "/f1/f2/f3",
"ensure_dir": true
}'
| jq -r
watsonx.ai on Software Hub 5.3.x (on-premise)
Note 1: Replace ${cpd_host} with the URL of your Software Hub cluster
Note 2: Replace {project_id} with the actual Project ID value of your project
Note 3: Replace ${TOKEN} with your Bearer Token. Steps to obtain this can be found in our IBM Software Hub Documentation
Note 4: Replace the values for absolute_path with the folder name/structure you wish to use
curl -X 'POST'
"https://${cpd_host}/projects/api/rest/v1/asset_folders?project_id=${project_id}"
-H "Authorization: Bearer ${TOKEN}"
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"absolute_path": "/f1/f2/f3",
"ensure_dir": true
}'
| jq -r
Document Location
Worldwide
Was this topic helpful?
Document Information
Modified date:
14 May 2026
UID
ibm17273064