Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

### Fixed
- Fixed `create_list_from_template_in_folder` and `create_list_from_template_in_space` returning HTTP 404. The URL path used `/list/template/{templateId}` (with a slash) instead of `/list_template/{templateId}` (with an underscore), which is what the ClickUp API expects per the [createListFromTemplate](https://developer.clickup.com/reference/createlistfromtemplate) and [createListFromTemplateInSpace](https://developer.clickup.com/reference/createlistfromtemplateinspace) endpoints.

## [1.12.0] - 2025-04-14

Expand Down
32 changes: 26 additions & 6 deletions src/clickup-client/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,25 +116,45 @@ export class ListsClient {
}

/**
* Create a new list from a template in a folder
* Create a new list from a template in a folder.
* The POST response from ClickUp returns `deleted: true` as an artefact —
* we refetch the list immediately to return its real state.
* @param folderId The ID of the folder to create the list in
* @param templateId The ID of the template to use
* @param params The list parameters
* @returns The created list
* @returns The created list with real (post-creation) state
*/
async createListFromTemplateInFolder(folderId: string, templateId: string, params: CreateListParams): Promise<List> {
return this.client.post(`/folder/${folderId}/list/template/${templateId}`, params);
const created = await this.client.post<List>(`/folder/${folderId}/list_template/${templateId}`, params);
if (created?.id) {
try {
return await this.getList(created.id);
} catch {
return created;
}
}
return created;
}

/**
* Create a new list from a template in a space
* Create a new list from a template in a space.
* The POST response from ClickUp returns `deleted: true` as an artefact —
* we refetch the list immediately to return its real state.
* @param spaceId The ID of the space to create the list in
* @param templateId The ID of the template to use
* @param params The list parameters
* @returns The created list
* @returns The created list with real (post-creation) state
*/
async createListFromTemplateInSpace(spaceId: string, templateId: string, params: CreateListParams): Promise<List> {
return this.client.post(`/space/${spaceId}/list/template/${templateId}`, params);
const created = await this.client.post<List>(`/space/${spaceId}/list_template/${templateId}`, params);
if (created?.id) {
try {
return await this.getList(created.id);
} catch {
return created;
}
}
return created;
}
}

Expand Down