Folders
How to list, create, update, move, copy and delete folders in a project using the public API
Folders organize the test cases of a project into a tree. Folder IDs are numbers; parentId is 0 for root folders.
Folder Object
{
id: number // Folder ID
parentId: number // ID of the parent folder (0 for root folders)
title: string // Title of the folder, unique among its siblings
comment: html // Additional notes or description
projectId: string // ID of the project the folder belongs to
pos: number // 0-based position of the folder among its siblings
children?: Folder[] // Get Folder Tree only: subfolders, absent when there are none
path?: Folder[] // List Folders with include=path only: folders from the root down to the folder, itself included
tcaseCount?: number // Get Folder Tree with include=tcaseCount only: test cases in the folder and its subtree
}List Folders
/paginated endpoints are transitional. In API v1, the base paths will return paginated responses and the /paginated suffix will be removed.
Returns the folders of the project as a flat, paginated list. This endpoint ignores the Sort folders alphabetically setting; use sortField instead, or Get Folder Tree for the order the web app shows.
Path Parameters
project_id: The project identifier (can be either the project code or UUID)
Query Parameters
| Parameter | Type | Description | Default | Example |
|---|---|---|---|---|
offset | number | Number of items to skip. | 0 | offset=10 |
limit | number | Maximum number of items to return. Accepted range: 0–1,000. | 100 | limit=10 |
sortField | string | Field to sort by: id, project_id, title, pos, parent_id, created_at or updated_at. | pos | sortField=title |
sortOrder | string | Sort direction for sortField: asc or desc. | asc | sortOrder=desc |
include | string | Include additional fields omitted by default. Accepted value: path, the folders from the root down to each folder. | None | include=path |
Example Request
curl \
-H "Authorization: ApiKey your.api.key.here" \
"https://company.qasphere.com/api/public/v0/project/BD/folder/paginated?offset=10&limit=10&sortField=title"Response
Status: 200 OK
{
total: number // Number of matching folders across all pages
offset: number // Offset applied to this response
limit: number // Limit applied to this response
data: Folder[] // Folders in the page (see Folder Object)
}Example Response
{
"total": 12,
"offset": 0,
"limit": 2,
"data": [
{
"id": 11866,
"parentId": 11844,
"title": "Welcome",
"comment": "",
"projectId": "1CGeNZsqU_BRPFrugwAVDs3",
"pos": 4
},
{
"id": 11855,
"parentId": 11844,
"title": "Today's menu",
"comment": "",
"projectId": "1CGeNZsqU_BRPFrugwAVDs3",
"pos": 3
}
]
}Get Folder Tree
Returns every folder of the project as a tree, in the order the web app shows it: by position, or alphabetically when Settings → Customization → Sort folders alphabetically is on. The response is not paginated, so prefer List Folders for very large projects.
Query Parameters
| Parameter | Type | Description | Default | Example |
|---|---|---|---|---|
include | string | Include additional fields omitted by default. Accepted value: tcaseCount, the test cases in each folder and its subtree. | None | include=tcaseCount |
Response
Status: 200 OK
{
folders: Folder[] // Root folders, each with its subfolders in children (see Folder Object)
}Get Folder
Returns one folder.
Get Folder Path
Returns the folders from the root down to the folder, itself included.
Response
Status: 200 OK
{
folders: Folder[] // Root first
}Create Folder
Creates one folder. Upsert Folders creates whole paths and reuses existing folders.
Request Body
{
title: string // Title of the folder (max 255 characters), unique among its siblings
parentId?: number // Parent folder; 0 or omitted for a root folder
pos?: number // 0-based position among the siblings; omitted adds it last
comment?: html // Additional notes or description
}Response
Status: 201 Created
The created folder.
Errors
| Status Code | Description |
|---|---|
| 409 | A sibling folder already has the same title |
Update Folder
Renames a folder or changes its comment. Use Move Folders to change its parent or position.
Request Body
{
title?: string // New title (max 255 characters)
comment?: html // New comment; "" clears it
}At least one field is required. Omitted fields are left unchanged.
Response
Status: 200 OK
The updated folder.
Errors
| Status Code | Description |
|---|---|
| 409 | A sibling folder already has the same title |
Move Folders
Moves folders, with their subfolders and test cases, under a new parent, or reorders them within their current parent. Folders may come from different parents.
Request Body
{
newParentId: number // The new parent folder; 0 for the root
items: Array<{ // 1 to 1,000 items
id: number // Folder to move
pos: number // Final position among the new parent's children
}>
}How positions work
posis the 0-based position each folder ends up at among the children ofnewParentId, counted after the move. The other children keep their relative order around the moved folders.- All items are applied together, so their order in
itemsdoesn't matter. - A negative
poscounts from the end:-1is the last position,-2the one before. It is resolved against the number of children after the move. - Two items can't end up at the same position (for example
-1andn-1), and a position past the last one is rejected.
For example, if folder 10 has children A, B and C, moving X from elsewhere with {"newParentId": 10, "items": [{"id": X, "pos": 1}]} gives A, X, B, C. Moving X and C with positions 0 and -1 gives X, A, B, C.
Response
Status: 200 OK
{
folders: Array<{ id: number }> // The moved folders
}Live runs
Moving folders to another parent re-evaluates every open live run. Their test cases are added to runs whose folder filter now matches them, and removed from runs whose folder filter no longer does, including test cases that already have results. Reordering within the same parent changes no run.
Errors
| Status Code | Description |
|---|---|
| 400 | Invalid or duplicate positions, more than 1,000 items or a folder moved into itself or one of its subfolders |
| 409 | A folder with the same title already exists in the new parent |
Copy Folders
Copies folders, with their subfolders and test cases, into a folder of the project in the path. The folders can come from another project.
Set move to move folders from another project instead: they are copied and then deleted from the source project. To move folders within a project, use Move Folders.
Moving between projects
The moved folders and test cases go to the source project's trash as one entry, and are removed from its open runs, as with Delete Folder. Their results and history stay with the originals. Restoring the entry brings the originals back without removing the copies.
Request Body
{
folderIds: number[] // Folders to copy (1 to 1,000)
targetFolderId?: number // Folder to copy into; 0 or omitted for the root
sourceProjectId?: string // Code or ID of the project the folders are in; defaults to the project in the path
move?: boolean // Delete the folders from the source project after copying; it must differ from the project in the path
}Response
Status: 200 OK
{
folders: Array<{ id: number }> // The copies, in the order of folderIds
}Behavior
- Copies are added last in the target folder. A copy whose name is already taken there gets a numbered suffix, like
Login (1). - Copied test cases get new IDs and sequence numbers, and start a fresh version history.
- A folder listed together with one of its subfolders is copied twice: once with the subfolder, and the subfolder again on its own.
- You need access to the source project.
- With
move, the copy and the delete succeed or fail together, and a folder can't be listed together with one of its subfolders. - With
move, folders and test cases keep their creation and update times, and test cases keep their authors. Without it, copied test cases are authored by the caller.
Errors
| Status Code | Description |
|---|---|
| 400 | With move, the source is the same project or folders are nested |
| 403 | With move, the source project is archived |
Delete Folder
Deletes a folder with all its subfolders and test cases. They go to the trash as one entry, which can be restored within 60 days.
Deleted test cases are removed from open runs. Restoring them adds them back, as open, only to the open live runs they match; their results stay with the runs they were removed from.
Response
Status: 200 OK
The trash entry of the deletion. Its id restores it.
Delete Folders
Deletes several folders with all their subfolders and test cases, and optionally more test cases, as one trash entry.
Request Body
{
folderIds: number[] // Folders to delete (at least one)
tcaseIds?: string[] // More test cases to delete: IDs, sequence numbers or legacy IDs
}At most 1,000 folders and test cases in total.
Response
Status: 200 OK
The trash entry of the deletion.
Upsert Folders
Creates or updates multiple folders in a single request using folder path hierarchies. This endpoint automatically creates nested folder structures and updates existing folders' comments.
Request Body
{
folders: Array<{ // Folders to create or update (at most 1,000)
path: string[] // Folder names from the root down to the folder
comment?: html // Additional notes or description
}>
}Response
Status: 200 OK
{
ids: Array<number[]> // Each array represents the full folder path hierarchy in the request as an array of folder IDs, from root to leaf
}Details:
- The
idsfield is an array where each item corresponds to one input folder path. - Each inner array contains folder IDs that map 1 to the specified folder path in the request.
- For example, if your path is
["Frontend", "Components", "Navigation"], the result could be[12, 13, 14]where12is "Frontend",13is "Components",14is "Navigation".
- For example, if your path is
- Newly created folders will always get new IDs; existing folders return their original IDs.
- The order of returned arrays matches the order of the input
foldersin the request.
Example Request
curl -X POST \
-H "Authorization: ApiKey your.api.key.here" \
-H "Content-Type: application/json" \
-d '{
"folders": [
{
"path": ["Frontend", "Components", "Navigation"],
"comment": "<p>Tests for navigation components</p>"
},
{
"path": ["Frontend", "Components", "Forms"],
"comment": "<p>Form validation and interaction tests</p>"
},
{
"path": ["Backend", "API", "Authentication"],
"comment": "<p>Authentication endpoint tests</p>"
}
]
}' \
https://company.qasphere.com/api/public/v0/project/BD/folder/upsertExample Response
Status: 200 OK
{
"ids": [
[12, 13, 14],
[12, 13, 15],
[16, 17, 18]
]
}Behavior
- Creates nested structure: Automatically creates all parent folders in the path if they don't exist
- Updates existing folders: If a folder path already exists, only the comment is updated
- Idempotent: Running the same request multiple times produces the same result
- Preserves hierarchy: Maintains proper parent-child relationships between folders
- Position assignment: New folders are positioned automatically within their parent
Example Folder Creation
Given the request above, the following folder structure would be created:
Frontend/
├── Components/
│ ├── Navigation/ (comment: "Tests for navigation components")
│ └── Forms/ (comment: "Form validation and interaction tests")
Backend/
└── API/
└── Authentication/ (comment: "Authentication endpoint tests")Validation Rules
- Each folder name in the path must be 1–255 characters long
- Folder names cannot be empty strings
- The
patharray cannot be empty - folder comment should be in html format
The endpoint only updates the comment field for existing folders. Other properties like position and parent relationships are preserved.
Deprecated Routes
These routes keep working, with the same behavior as the routes that replace them.
| Deprecated route | Use instead |
|---|---|
GET /api/public/v0/project/{project_id}/tcase/folders/paginated | List Folders: GET /api/public/v0/project/{project_id}/folder/paginated |
POST /api/public/v0/project/{project_id}/tcase/folder/bulk | Upsert Folders: POST /api/public/v0/project/{project_id}/folder/upsert |
GET /api/public/v0/project/{project_id}/tcase/folders | List Folders, described below |
List Folders (Legacy Pagination)
Deprecated
This endpoint is deprecated. Use List Folders (GET /api/public/v0/project/{project_id}/folder/paginated) instead.
Returns the folders of the project.
Query Parameters
| Parameter | Type | Description | Default | Example |
|---|---|---|---|---|
offset | number | Number of items to skip. | 0 | offset=10 |
limit | number | Maximum number of items to return. Accepted range: 0–5,000. | 10 with page, else no limit | limit=10 |
page | number | Deprecated. Page to return, from 1: skips (page - 1) × limit items. Ignored when offset is sent. | None | page=1 |
sortField | string | Field to sort by: id, project_id, title, pos, parent_id, created_at or updated_at. | pos | sortField=title |
sortOrder | string | Sort direction for sortField: asc or desc. | asc | sortOrder=desc |
Response
Status: 200 OK
{
total: number // Number of matching folders across all pages
offset?: number // Offset applied, when `offset` or `page` was sent
limit?: number // Limit applied, when `limit` or `page` was sent
page?: number // Deprecated: the `page` sent, when sent without `offset`
data: Folder[] // Folders (see Folder Object)
}