Short answer. Atlassian removed Jira Cloud's /rest/api/3/search and /rest/api/2/search. Calls to them now answer 410 Gone. Change the address to /rest/api/3/search/jql, page with nextPageToken instead of startAt, and list the fields you need. Below is a drop-in function for Apps Script.
The error
In Apps Script, the run stops at the UrlFetchApp call with something like:
Exception: Request failed for https://yourcompany.atlassian.net returned code 410.
Truncated server response: {"errorMessages":["The requested API has been removed.
Please migrate to the /rest/api/3/search/jql API. …Scripts that worked for years fail the same way: Google Sheets imports, timesheet macros, Slack or email digests built on a JQL search.
Why it happens
Atlassian announced in 2024 that the old search endpoints would be replaced by /rest/api/3/search/jql, then switched them off. The error message links to the migration notes in its developer changelog (CHANGE-2046). There is no setting to bring the old endpoints back: the script has to change.
What is different in /search/jql
startAt=0startAt=100startAt=200total: 1,234page 1 + tokenpage 2 + tokenpage 3isLast: true| Old /search | New /search/jql | |
|---|---|---|
| Address | GET or POST /rest/api/3/search | GET or POST /rest/api/3/search/jql |
| Paging | startAt and maxResults, any page in any order | nextPageToken from the previous page, in order |
| Last page | startAt + maxResults ≥ total | isLast is true, or no nextPageToken |
| Total | total in every response | None; POST /rest/api/3/search/approximate-count for an estimate |
| Fields | Navigable fields unless you say otherwise | Name the fields you need in fields |
JQL itself is unchanged, and each work item in the response looks the same. The full parameter list is in Atlassian's issue search reference.
The fix for Apps Script
A typical old call looked like this:
// Before: removed. Answers 410 Gone.
const url = SITE + '/rest/api/3/search?jql=' + encodeURIComponent(jql) + '&startAt=' + startAt + '&maxResults=100';
const page = JSON.parse(UrlFetchApp.fetch(url, { headers: { Authorization: AUTH } }).getContentText());
// page.issues, page.total, page.startAtReplace it with a function that follows nextPageToken until the last page. SITE is your site address, such as https://yourcompany.atlassian.net, and AUTH is the same Authorization header you used before.
// After: every work item matching the JQL, with the fields you name, 100 per request.
function searchAll(jql, fields) {
const issues = [];
let nextPageToken;
while (true) {
const response = UrlFetchApp.fetch(SITE + '/rest/api/3/search/jql', {
method: 'post',
contentType: 'application/json',
headers: { Authorization: AUTH, Accept: 'application/json' },
payload: JSON.stringify({ jql: jql, fields: fields, maxResults: 100, nextPageToken: nextPageToken }),
});
const page = JSON.parse(response.getContentText());
issues.push(...page.issues);
// Jira may send fewer than maxResults per page, so follow the token rather than counting.
if (page.isLast || !page.nextPageToken) return issues;
nextPageToken = page.nextPageToken;
}
}
// For example:
const issues = searchAll('project = WEB AND updated >= -7d', ['summary', 'status', 'assignee']);Where your script read page.issues inside a startAt loop, read the array searchAll returns instead. Apps Script stops a run after 6 minutes, so for tens of thousands of work items, save nextPageToken in script properties and carry on in the next run.
If you used total
The new endpoint doesn't say how many work items match. If your script only used total to know when to stop, the loop above replaces it. If you show the number, ask for it separately:
const response = UrlFetchApp.fetch(SITE + '/rest/api/3/search/approximate-count', {
method: 'post',
contentType: 'application/json',
headers: { Authorization: AUTH, Accept: 'application/json' },
payload: JSON.stringify({ jql: 'project = WEB AND statusCategory != Done' }),
});
const count = JSON.parse(response.getContentText()).count;As the name says, the count is an estimate, close to the real number but not guaranteed exact.
Other things that trip scripts up
- Fields: name every field you read, such as
summary,statusor a custom field id likecustomfield_10016. Missing ones come back undefined. - Worklogs: the
worklogfield in a search result holds at most 20 worklogs per work item. For timesheets, use the worklog endpoints instead, as in our free timesheet template. - Version 2 to 3: if you also moved from
/rest/api/2, text fields such as description and comments arrive as Atlassian Document Format (JSON) in version 3, not plain text. - Next time: Atlassian announces removals in its developer changelog months ahead and sends a
Deprecationheader on responses from endpoints that are going away. Logging that header turns the next removal into a warning instead of an outage.
Pulling Jira into Google Sheets for reports? Jira to Google Sheets: 5 ways compared covers options that need no script.