curl --request PUT \
--url https://api.habitify.me/v2/habits/{habitId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"occurrence": {
"type": "daily"
},
"startDate": "2023-12-25",
"icon": "<string>",
"colorHex": "<string>",
"customUnitName": "<string>",
"areaIds": [
"<string>"
],
"timeOfDayIds": [
"<string>"
],
"reminders": {
"timeTriggers": [
{
"time": {
"hour": 11,
"minute": 29
},
"occurrenceFilter": {
"weekDays": []
},
"showLiveActivity": true,
"showAsAlarm": true
}
],
"habitStacks": [
{
"conditionHabitId": "<string>",
"timerDelaySecs": 123
}
]
},
"endCondition": {
"type": "date",
"date": "2023-12-25"
}
}
'import requests
url = "https://api.habitify.me/v2/habits/{habitId}"
payload = {
"name": "<string>",
"description": "<string>",
"occurrence": { "type": "daily" },
"startDate": "2023-12-25",
"icon": "<string>",
"colorHex": "<string>",
"customUnitName": "<string>",
"areaIds": ["<string>"],
"timeOfDayIds": ["<string>"],
"reminders": {
"timeTriggers": [
{
"time": {
"hour": 11,
"minute": 29
},
"occurrenceFilter": { "weekDays": [] },
"showLiveActivity": True,
"showAsAlarm": True
}
],
"habitStacks": [
{
"conditionHabitId": "<string>",
"timerDelaySecs": 123
}
]
},
"endCondition": {
"type": "date",
"date": "2023-12-25"
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
occurrence: {type: 'daily'},
startDate: '2023-12-25',
icon: '<string>',
colorHex: '<string>',
customUnitName: '<string>',
areaIds: ['<string>'],
timeOfDayIds: ['<string>'],
reminders: {
timeTriggers: [
{
time: {hour: 11, minute: 29},
occurrenceFilter: {weekDays: []},
showLiveActivity: true,
showAsAlarm: true
}
],
habitStacks: [{conditionHabitId: '<string>', timerDelaySecs: 123}]
},
endCondition: {type: 'date', date: '2023-12-25'}
})
};
fetch('https://api.habitify.me/v2/habits/{habitId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.habitify.me/v2/habits/{habitId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'occurrence' => [
'type' => 'daily'
],
'startDate' => '2023-12-25',
'icon' => '<string>',
'colorHex' => '<string>',
'customUnitName' => '<string>',
'areaIds' => [
'<string>'
],
'timeOfDayIds' => [
'<string>'
],
'reminders' => [
'timeTriggers' => [
[
'time' => [
'hour' => 11,
'minute' => 29
],
'occurrenceFilter' => [
'weekDays' => [
]
],
'showLiveActivity' => true,
'showAsAlarm' => true
]
],
'habitStacks' => [
[
'conditionHabitId' => '<string>',
'timerDelaySecs' => 123
]
]
],
'endCondition' => [
'type' => 'date',
'date' => '2023-12-25'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.habitify.me/v2/habits/{habitId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"occurrence\": {\n \"type\": \"daily\"\n },\n \"startDate\": \"2023-12-25\",\n \"icon\": \"<string>\",\n \"colorHex\": \"<string>\",\n \"customUnitName\": \"<string>\",\n \"areaIds\": [\n \"<string>\"\n ],\n \"timeOfDayIds\": [\n \"<string>\"\n ],\n \"reminders\": {\n \"timeTriggers\": [\n {\n \"time\": {\n \"hour\": 11,\n \"minute\": 29\n },\n \"occurrenceFilter\": {\n \"weekDays\": []\n },\n \"showLiveActivity\": true,\n \"showAsAlarm\": true\n }\n ],\n \"habitStacks\": [\n {\n \"conditionHabitId\": \"<string>\",\n \"timerDelaySecs\": 123\n }\n ]\n },\n \"endCondition\": {\n \"type\": \"date\",\n \"date\": \"2023-12-25\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.habitify.me/v2/habits/{habitId}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"occurrence\": {\n \"type\": \"daily\"\n },\n \"startDate\": \"2023-12-25\",\n \"icon\": \"<string>\",\n \"colorHex\": \"<string>\",\n \"customUnitName\": \"<string>\",\n \"areaIds\": [\n \"<string>\"\n ],\n \"timeOfDayIds\": [\n \"<string>\"\n ],\n \"reminders\": {\n \"timeTriggers\": [\n {\n \"time\": {\n \"hour\": 11,\n \"minute\": 29\n },\n \"occurrenceFilter\": {\n \"weekDays\": []\n },\n \"showLiveActivity\": true,\n \"showAsAlarm\": true\n }\n ],\n \"habitStacks\": [\n {\n \"conditionHabitId\": \"<string>\",\n \"timerDelaySecs\": 123\n }\n ]\n },\n \"endCondition\": {\n \"type\": \"date\",\n \"date\": \"2023-12-25\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.habitify.me/v2/habits/{habitId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"occurrence\": {\n \"type\": \"daily\"\n },\n \"startDate\": \"2023-12-25\",\n \"icon\": \"<string>\",\n \"colorHex\": \"<string>\",\n \"customUnitName\": \"<string>\",\n \"areaIds\": [\n \"<string>\"\n ],\n \"timeOfDayIds\": [\n \"<string>\"\n ],\n \"reminders\": {\n \"timeTriggers\": [\n {\n \"time\": {\n \"hour\": 11,\n \"minute\": 29\n },\n \"occurrenceFilter\": {\n \"weekDays\": []\n },\n \"showLiveActivity\": true,\n \"showAsAlarm\": true\n }\n ],\n \"habitStacks\": [\n {\n \"conditionHabitId\": \"<string>\",\n \"timerDelaySecs\": 123\n }\n ]\n },\n \"endCondition\": {\n \"type\": \"date\",\n \"date\": \"2023-12-25\"\n }\n}"
response = http.request(request)
puts response.read_bodyUpdate a habit
Update the properties of an existing habit. Only the fields provided in the request body are updated; omitted fields remain unchanged.
curl --request PUT \
--url https://api.habitify.me/v2/habits/{habitId} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"description": "<string>",
"occurrence": {
"type": "daily"
},
"startDate": "2023-12-25",
"icon": "<string>",
"colorHex": "<string>",
"customUnitName": "<string>",
"areaIds": [
"<string>"
],
"timeOfDayIds": [
"<string>"
],
"reminders": {
"timeTriggers": [
{
"time": {
"hour": 11,
"minute": 29
},
"occurrenceFilter": {
"weekDays": []
},
"showLiveActivity": true,
"showAsAlarm": true
}
],
"habitStacks": [
{
"conditionHabitId": "<string>",
"timerDelaySecs": 123
}
]
},
"endCondition": {
"type": "date",
"date": "2023-12-25"
}
}
'import requests
url = "https://api.habitify.me/v2/habits/{habitId}"
payload = {
"name": "<string>",
"description": "<string>",
"occurrence": { "type": "daily" },
"startDate": "2023-12-25",
"icon": "<string>",
"colorHex": "<string>",
"customUnitName": "<string>",
"areaIds": ["<string>"],
"timeOfDayIds": ["<string>"],
"reminders": {
"timeTriggers": [
{
"time": {
"hour": 11,
"minute": 29
},
"occurrenceFilter": { "weekDays": [] },
"showLiveActivity": True,
"showAsAlarm": True
}
],
"habitStacks": [
{
"conditionHabitId": "<string>",
"timerDelaySecs": 123
}
]
},
"endCondition": {
"type": "date",
"date": "2023-12-25"
}
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
occurrence: {type: 'daily'},
startDate: '2023-12-25',
icon: '<string>',
colorHex: '<string>',
customUnitName: '<string>',
areaIds: ['<string>'],
timeOfDayIds: ['<string>'],
reminders: {
timeTriggers: [
{
time: {hour: 11, minute: 29},
occurrenceFilter: {weekDays: []},
showLiveActivity: true,
showAsAlarm: true
}
],
habitStacks: [{conditionHabitId: '<string>', timerDelaySecs: 123}]
},
endCondition: {type: 'date', date: '2023-12-25'}
})
};
fetch('https://api.habitify.me/v2/habits/{habitId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.habitify.me/v2/habits/{habitId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'occurrence' => [
'type' => 'daily'
],
'startDate' => '2023-12-25',
'icon' => '<string>',
'colorHex' => '<string>',
'customUnitName' => '<string>',
'areaIds' => [
'<string>'
],
'timeOfDayIds' => [
'<string>'
],
'reminders' => [
'timeTriggers' => [
[
'time' => [
'hour' => 11,
'minute' => 29
],
'occurrenceFilter' => [
'weekDays' => [
]
],
'showLiveActivity' => true,
'showAsAlarm' => true
]
],
'habitStacks' => [
[
'conditionHabitId' => '<string>',
'timerDelaySecs' => 123
]
]
],
'endCondition' => [
'type' => 'date',
'date' => '2023-12-25'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.habitify.me/v2/habits/{habitId}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"occurrence\": {\n \"type\": \"daily\"\n },\n \"startDate\": \"2023-12-25\",\n \"icon\": \"<string>\",\n \"colorHex\": \"<string>\",\n \"customUnitName\": \"<string>\",\n \"areaIds\": [\n \"<string>\"\n ],\n \"timeOfDayIds\": [\n \"<string>\"\n ],\n \"reminders\": {\n \"timeTriggers\": [\n {\n \"time\": {\n \"hour\": 11,\n \"minute\": 29\n },\n \"occurrenceFilter\": {\n \"weekDays\": []\n },\n \"showLiveActivity\": true,\n \"showAsAlarm\": true\n }\n ],\n \"habitStacks\": [\n {\n \"conditionHabitId\": \"<string>\",\n \"timerDelaySecs\": 123\n }\n ]\n },\n \"endCondition\": {\n \"type\": \"date\",\n \"date\": \"2023-12-25\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.habitify.me/v2/habits/{habitId}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"occurrence\": {\n \"type\": \"daily\"\n },\n \"startDate\": \"2023-12-25\",\n \"icon\": \"<string>\",\n \"colorHex\": \"<string>\",\n \"customUnitName\": \"<string>\",\n \"areaIds\": [\n \"<string>\"\n ],\n \"timeOfDayIds\": [\n \"<string>\"\n ],\n \"reminders\": {\n \"timeTriggers\": [\n {\n \"time\": {\n \"hour\": 11,\n \"minute\": 29\n },\n \"occurrenceFilter\": {\n \"weekDays\": []\n },\n \"showLiveActivity\": true,\n \"showAsAlarm\": true\n }\n ],\n \"habitStacks\": [\n {\n \"conditionHabitId\": \"<string>\",\n \"timerDelaySecs\": 123\n }\n ]\n },\n \"endCondition\": {\n \"type\": \"date\",\n \"date\": \"2023-12-25\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.habitify.me/v2/habits/{habitId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"occurrence\": {\n \"type\": \"daily\"\n },\n \"startDate\": \"2023-12-25\",\n \"icon\": \"<string>\",\n \"colorHex\": \"<string>\",\n \"customUnitName\": \"<string>\",\n \"areaIds\": [\n \"<string>\"\n ],\n \"timeOfDayIds\": [\n \"<string>\"\n ],\n \"reminders\": {\n \"timeTriggers\": [\n {\n \"time\": {\n \"hour\": 11,\n \"minute\": 29\n },\n \"occurrenceFilter\": {\n \"weekDays\": []\n },\n \"showLiveActivity\": true,\n \"showAsAlarm\": true\n }\n ],\n \"habitStacks\": [\n {\n \"conditionHabitId\": \"<string>\",\n \"timerDelaySecs\": 123\n }\n ]\n },\n \"endCondition\": {\n \"type\": \"date\",\n \"date\": \"2023-12-25\"\n }\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
API key generated from our app (Settings > API). Only one key can be active at a time.
Path Parameters
The unique identifier of the habit to update
Body
New display name for the habit
New description for the habit
Defines the recurrence schedule for a habit. A habit can occur daily, on specific days of the week, on specific days of the month, or at a fixed interval of days.
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
New start date for the habit (YYYY-MM-DD format)
New icon identifier
New hex color code
New custom unit name for measurable habits
Area IDs to assign the habit to (replaces existing assignments)
Time-of-day period IDs to assign the habit to (replaces existing assignments)
Goal to set for the habit
Show child attributes
Show child attributes
Reminders to set for the habit
Show child attributes
Show child attributes
Input payload for creating a date-based end condition.
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
Response
Habit updated successfully

