Skip to main content

Tracking activities

This endpoint tracks an activity for a given habit.

HTTP Request

POST https://api.lunatask.app/v1/habits/<id>/track

URL Parameters

ParameterDescription
idThe ID of the habit (UUID, can be found in our apps in the habit settings)

Body Parameters

ParameterDescription
performed_onISO-8601 formatted date when the activity was performed (required)

Example in Ruby

require 'rest-client'

access_token = 'xxx'

RestClient.post(
'https://api.lunatask.app/v1/habits/25b8ad7e-a89b-4f05-8173-83fcd2e21ae2/track',
{ performed_on: '2024-08-26' }.to_json,
{ Authorization: "bearer #{access_token}", "Content-Type": 'application/json' }
)

Response

The above command returns JSON structured like this:

{
"status": "ok"
}

In case of missing or malformed date provided:

{
"status": "error",
"message": "performed_on date missing or is not a valid ISO-8601 formatted date"
}