Skip to main content
PATCH
/
v1
/
dev
/
user
/
goals
/
{goal_id}
Update Goal
curl --request PATCH \
  --url https://api.omi.me/v1/dev/user/goals/{goal_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "current_value": 123,
  "desired_outcome": "<string>",
  "horizon_at": "2023-11-07T05:31:56Z",
  "max_value": 123,
  "min_value": 123,
  "success_criteria": [
    "<string>"
  ],
  "target_value": 123,
  "title": "<string>",
  "unit": "<string>",
  "why_it_matters": "<string>"
}
'
import requests

url = "https://api.omi.me/v1/dev/user/goals/{goal_id}"

payload = {
"current_value": 123,
"desired_outcome": "<string>",
"horizon_at": "2023-11-07T05:31:56Z",
"max_value": 123,
"min_value": 123,
"success_criteria": ["<string>"],
"target_value": 123,
"title": "<string>",
"unit": "<string>",
"why_it_matters": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
current_value: 123,
desired_outcome: '<string>',
horizon_at: '2023-11-07T05:31:56Z',
max_value: 123,
min_value: 123,
success_criteria: ['<string>'],
target_value: 123,
title: '<string>',
unit: '<string>',
why_it_matters: '<string>'
})
};

fetch('https://api.omi.me/v1/dev/user/goals/{goal_id}', 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.omi.me/v1/dev/user/goals/{goal_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'current_value' => 123,
'desired_outcome' => '<string>',
'horizon_at' => '2023-11-07T05:31:56Z',
'max_value' => 123,
'min_value' => 123,
'success_criteria' => [
'<string>'
],
'target_value' => 123,
'title' => '<string>',
'unit' => '<string>',
'why_it_matters' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$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.omi.me/v1/dev/user/goals/{goal_id}"

payload := strings.NewReader("{\n \"current_value\": 123,\n \"desired_outcome\": \"<string>\",\n \"horizon_at\": \"2023-11-07T05:31:56Z\",\n \"max_value\": 123,\n \"min_value\": 123,\n \"success_criteria\": [\n \"<string>\"\n ],\n \"target_value\": 123,\n \"title\": \"<string>\",\n \"unit\": \"<string>\",\n \"why_it_matters\": \"<string>\"\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
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.patch("https://api.omi.me/v1/dev/user/goals/{goal_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"current_value\": 123,\n \"desired_outcome\": \"<string>\",\n \"horizon_at\": \"2023-11-07T05:31:56Z\",\n \"max_value\": 123,\n \"min_value\": 123,\n \"success_criteria\": [\n \"<string>\"\n ],\n \"target_value\": 123,\n \"title\": \"<string>\",\n \"unit\": \"<string>\",\n \"why_it_matters\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.omi.me/v1/dev/user/goals/{goal_id}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"current_value\": 123,\n \"desired_outcome\": \"<string>\",\n \"horizon_at\": \"2023-11-07T05:31:56Z\",\n \"max_value\": 123,\n \"min_value\": 123,\n \"success_criteria\": [\n \"<string>\"\n ],\n \"target_value\": 123,\n \"title\": \"<string>\",\n \"unit\": \"<string>\",\n \"why_it_matters\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "created_at": "2023-11-07T05:31:56Z",
  "current_value": 123,
  "desired_outcome": "<string>",
  "goal_id": "<string>",
  "goal_type": "<string>",
  "id": "<string>",
  "is_active": true,
  "max_value": 123,
  "min_value": 123,
  "source": "<string>",
  "status": "<string>",
  "target_value": 123,
  "title": "<string>",
  "updated_at": "2023-11-07T05:31:56Z",
  "focus_rank": 123,
  "horizon_at": "2023-11-07T05:31:56Z",
  "metric": {
    "current": 123,
    "target": 123,
    "max": 123,
    "min": 123,
    "unit": "<string>"
  },
  "success_criteria": [
    "<string>"
  ],
  "unit": "<string>",
  "why_it_matters": "<string>"
}
{
"detail": "<string>"
}
{
"detail": "<string>"
}
{
"detail": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Send Authorization: Bearer <omi_developer_api_key>.

Path Parameters

goal_id
string
required

Body

application/json
current_value
number | null

New progress value

desired_outcome
string | null
Maximum string length: 2000
horizon_at
string<date-time> | null
max_value
number | null

New maximum value

min_value
number | null

New minimum value

success_criteria
string[] | null
Maximum array length: 20
target_value
number | null

New target value

title
string | null

New title

Required string length: 1 - 500
unit
string | null

New unit label

why_it_matters
string | null
Maximum string length: 2000

Response

Successful Response

created_at
string<date-time>
required
current_value
number
required
desired_outcome
string
required
goal_id
string
required
goal_type
string
required
id
string
required
is_active
boolean
required
max_value
number
required
min_value
number
required
source
string
required
status
string
required
target_value
number
required
title
string
required
updated_at
string<date-time>
required
focus_rank
integer | null
horizon_at
string<date-time> | null
metric
GoalMetric · object | null
success_criteria
string[]
unit
string | null
why_it_matters
string | null