Skip to content

Set Goal

PUT
/users/{user_id}/goals/{slug}
curl --request PUT \
--url https://example.com/users/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/goals/example \
--header 'Content-Type: application/json' \
--data '{ "active": true, "direction": "example", "target": 1 }'

Upsert one metric’s standing daily goal (target + direction + active).

user_id
required
User Id
string format: uuid
slug
required
Slug
string
Media typeapplication/json
MetricGoalUpdate

Upsert one metric’s goal. target must be positive; direction from the fixed set.

object
active
Active
boolean
default: true
direction
required
Direction
string
target
required
Target
number

Successful Response

Media typeapplication/json
GoalMetricRead

One goalable metric as the goals UI needs it. When target is None the metric has no goal yet (a candidate the editor can offer); otherwise it’s the user’s active/paused goal. The live actual is read on the client from the day summary (value_field, or metrics[slug] when that’s null) — never here.

object
active
required
Active
boolean
category
required
Category
string
direction
required
Direction
string
is_set
required
Is Set
boolean
label
required
Label
string
slug
required
Slug
string
target
required
Any of:
number
unit
required
Unit
string
value_field
required
Any of:
string
Examplegenerated
{
"active": true,
"category": "example",
"direction": "example",
"is_set": true,
"label": "example",
"slug": "example",
"target": 1,
"unit": "example",
"value_field": "example"
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}