Mass update deadlines - a JavaScript script

Hello there,

I need to update deadlines of all my goals pretty frequently.

I did that by editing the timezone of my account, but that’s becoming inconvenient because the times are messed up on the iOS app (I receive notifications at the wrong time, so I had to disable them altogether).

But now, I decided to use the correct feature: deadlines!

Sadly, there is no way to edit them in bulk from the web app.

So, I created a script, that I am sharing here :sunglasses:

#!/usr/bin/env node

// get it here:
const authentication = { "username": "sheik", "auth_token": "xxxxxxxxxxxxxxxxxxxx" }

 * deadline (number): Seconds by which your deadline differs from midnight.
 * Negative is before midnight, positive is after midnight.
 * Allowed range is -17*3600 to 6*3600 (7am to 6am).
const newDeadline = 5 * 3600 // Example: set the deadline to 5am!

 * Goals to exclude from the processing
const exclude = []

// Fetching goal list

const apiUrl = ''

const goalsResp = await fetch(apiUrl + '/users/' + authentication.username + '/goals.json' + '?auth_token=' + authentication.auth_token)

 * @type {{slug: string}[]}
const goals = await goalsResp.json()

console.log("=== fetched goals list. ===")
console.log( => g.slug))

for (const goal of goals) {
	if (exclude.includes(goal.slug)) {
		console.log("skipping " + goal.slug + " because excluded by user")
	console.log("editing deadline for " + goal.slug)
	const resp = await fetch(apiUrl + '/users/' + authentication.username + '/goals/' + goal.slug + '.json' + '?auth_token=' + authentication.auth_token, {
		method: 'PUT',
		headers: {
			'Content-Type': 'application/json'
		body: JSON.stringify({
			deadline: newDeadline
	console.log(await resp.text())

Usage tutorial

  1. Copy and paste this code in a file with a text editor. Save it as “beeminder_deadline_edit.mjs”
  2. Edit the value for the “authentication” variable and the “newDeadline” variable
  3. Install NodeJS version 21: Node.js — Download Node.js®
  4. Open a terminal instance (on Windows, Powershell, on Mac, open spotlight and type “terminal”
  5. Type "node " (the space is important) and then, drag and drop the file into the terminal, then tap “enter”

I’m a bit slow to answer, but I will eventually, so don’t hesitate to ask questions if you struggle using this script :+1:

1 Like