[GH-ISSUE #2395] [API v2] Pagination ignored in /api/v2/templates endpoint #673

Closed
opened 2026-02-26 18:48:00 +03:00 by kerem · 0 comments
Owner

Originally created by @jormigo on GitHub (Jan 17, 2026).
Original GitHub issue: https://github.com/documenso/documenso/issues/2395

Issue Description

The findTemplates service implementation ignores the perPage parameter. This causes the /api/v2/template endpoint to return all matching templates regardless of the requested limit, breaking pagination functionality

Steps to Reproduce

Ensure the database has more than 1 template (e.g. 2).
Make a request to the V2 template endpoint requesting only 1 item per page:

bash
curl "http://localhost:3000/api/v2/template?page=1&perPage=1" \
  -H "Authorization: Bearer YOUR_API_KEY"

Expected Behavior

The API should return a single template item in the specific page data, respecting the perPage=1 limit.

Current Behavior

The API returns all available templates in the data array (e.g. 2 items), even though the metadata in the response correctly acknowledges perPage: 1.

// Request: perPage=1
// Response:
{
  "data": [
    { "id": 10, ... },
    { "id": 9, ... }  // <--- Should not be here on page 1
  ],
  "count": 2,
  "currentPage": 1,
  "perPage": 1,
  "totalPages": 2
}

### Screenshots (optional)

_No response_

### Operating System [e.g., Windows 10]

MacOs

### Browser [e.g., Chrome, Firefox]

Chrome

### Version [e.g., 2.0.1]

2.3.1

### Please check the boxes that apply to this issue report.

- [x] I have searched the existing issues to make sure this is not a duplicate.
- [x] I have provided steps to reproduce the issue.
- [x] I have included relevant environment information.
- [ ] I have included any relevant screenshots.
- [x] I understand that this is a voluntary contribution and that there is no guarantee of resolution.
- [x] I want to work on creating a PR for this issue if approved
Originally created by @jormigo on GitHub (Jan 17, 2026). Original GitHub issue: https://github.com/documenso/documenso/issues/2395 ### Issue Description The findTemplates service implementation ignores the perPage parameter. This causes the /api/v2/template endpoint to return all matching templates regardless of the requested limit, breaking pagination functionality ### Steps to Reproduce Ensure the database has more than 1 template (e.g. 2). Make a request to the V2 template endpoint requesting only 1 item per page: ``` bash curl "http://localhost:3000/api/v2/template?page=1&perPage=1" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Expected Behavior The API should return a single template item in the specific page data, respecting the perPage=1 limit. ### Current Behavior The API returns all available templates in the data array (e.g. 2 items), even though the metadata in the response correctly acknowledges perPage: 1. ``` // Request: perPage=1 // Response: { "data": [ { "id": 10, ... }, { "id": 9, ... } // <--- Should not be here on page 1 ], "count": 2, "currentPage": 1, "perPage": 1, "totalPages": 2 } ### Screenshots (optional) _No response_ ### Operating System [e.g., Windows 10] MacOs ### Browser [e.g., Chrome, Firefox] Chrome ### Version [e.g., 2.0.1] 2.3.1 ### Please check the boxes that apply to this issue report. - [x] I have searched the existing issues to make sure this is not a duplicate. - [x] I have provided steps to reproduce the issue. - [x] I have included relevant environment information. - [ ] I have included any relevant screenshots. - [x] I understand that this is a voluntary contribution and that there is no guarantee of resolution. - [x] I want to work on creating a PR for this issue if approved
kerem 2026-02-26 18:48:00 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/documenso#673
No description provided.