Skip to Content
Endpoints

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

GET/api/public/v0/project/{project_id}/folder/paginated

/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

ParameterTypeDescriptionDefaultExample
offsetnumberNumber of items to skip.0offset=10
limitnumberMaximum number of items to return. Accepted range: 0–1,000.100limit=10
sortFieldstringField to sort by: id, project_id, title, pos, parent_id, created_at or updated_at.possortField=title
sortOrderstringSort direction for sortField: asc or desc.ascsortOrder=desc
includestringInclude additional fields omitted by default. Accepted value: path, the folders from the root down to each folder.Noneinclude=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

GET/api/public/v0/project/{project_id}/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

ParameterTypeDescriptionDefaultExample
includestringInclude additional fields omitted by default. Accepted value: tcaseCount, the test cases in each folder and its subtree.Noneinclude=tcaseCount

Response

Status: 200 OK

{
  folders: Folder[]  // Root folders, each with its subfolders in children (see Folder Object)
}

Get Folder

GET/api/public/v0/project/{project_id}/folder/{folder_id}

Returns one folder.

Get Folder Path

GET/api/public/v0/project/{project_id}/folder/{folder_id}/path

Returns the folders from the root down to the folder, itself included.

Response

Status: 200 OK

{
  folders: Folder[]  // Root first
}

Create Folder

POST/api/public/v0/project/{project_id}/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 CodeDescription
409A sibling folder already has the same title

Update Folder

PATCH/api/public/v0/project/{project_id}/folder/{folder_id}

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 CodeDescription
409A sibling folder already has the same title

Move Folders

PATCH/api/public/v0/project/{project_id}/folder/location

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

  • pos is the 0-based position each folder ends up at among the children of newParentId, counted after the move. The other children keep their relative order around the moved folders.
  • All items are applied together, so their order in items doesn't matter.
  • A negative pos counts from the end: -1 is the last position, -2 the 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 -1 and n-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 CodeDescription
400Invalid or duplicate positions, more than 1,000 items or a folder moved into itself or one of its subfolders
409A folder with the same title already exists in the new parent

Copy Folders

POST/api/public/v0/project/{project_id}/folder/copy

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 CodeDescription
400With move, the source is the same project or folders are nested
403With move, the source project is archived

Delete Folder

DELETE/api/public/v0/project/{project_id}/folder/{folder_id}

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

POST/api/public/v0/project/{project_id}/folder/delete

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

POST/api/public/v0/project/{project_id}/folder/upsert

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 ids field 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] where 12 is "Frontend", 13 is "Components", 14 is "Navigation".
  • 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 folders in 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/upsert

Example 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 path array 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 routeUse instead
GET /api/public/v0/project/{project_id}/tcase/folders/paginatedList Folders: GET /api/public/v0/project/{project_id}/folder/paginated
POST /api/public/v0/project/{project_id}/tcase/folder/bulkUpsert Folders: POST /api/public/v0/project/{project_id}/folder/upsert
GET /api/public/v0/project/{project_id}/tcase/foldersList 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.

GET/api/public/v0/project/{project_id}/tcase/folders

Returns the folders of the project.

Query Parameters

ParameterTypeDescriptionDefaultExample
offsetnumberNumber of items to skip.0offset=10
limitnumberMaximum number of items to return. Accepted range: 0–5,000.10 with page, else no limitlimit=10
pagenumberDeprecated. Page to return, from 1: skips (page - 1) × limit items. Ignored when offset is sent.Nonepage=1
sortFieldstringField to sort by: id, project_id, title, pos, parent_id, created_at or updated_at.possortField=title
sortOrderstringSort direction for sortField: asc or desc.ascsortOrder=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)
}