Archive goal
curl --request POST \
--url https://vitalog-api.example.com/v1/goals/{id}/archive \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"expected_version": 123
}
'import requests
url = "https://vitalog-api.example.com/v1/goals/{id}/archive"
payload = { "expected_version": 123 }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({expected_version: 123})
};
fetch('https://vitalog-api.example.com/v1/goals/{id}/archive', 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://vitalog-api.example.com/v1/goals/{id}/archive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expected_version' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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://vitalog-api.example.com/v1/goals/{id}/archive"
payload := strings.NewReader("{\n \"expected_version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.post("https://vitalog-api.example.com/v1/goals/{id}/archive")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expected_version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vitalog-api.example.com/v1/goals/{id}/archive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expected_version\": 123\n}"
response = http.request(request)
puts response.read_body{
"catalog_version": "1.0.4",
"goal": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metric": "measurement:weight",
"version": 123,
"period": "daily",
"direction": "maximum",
"target": 123,
"unit": "<string>",
"baseline": 500000000000,
"status": "active",
"effective_on": "2023-12-25",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"committed_version": 123,
"idempotent_replay": true
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}Archive goal
Archive a goal from today with an expected version. Preserve history and previous-day progress. Reactivate with health_set_goal.
POST
/
v1
/
goals
/
{id}
/
archive
Archive goal
curl --request POST \
--url https://vitalog-api.example.com/v1/goals/{id}/archive \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"expected_version": 123
}
'import requests
url = "https://vitalog-api.example.com/v1/goals/{id}/archive"
payload = { "expected_version": 123 }
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({expected_version: 123})
};
fetch('https://vitalog-api.example.com/v1/goals/{id}/archive', 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://vitalog-api.example.com/v1/goals/{id}/archive",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'expected_version' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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://vitalog-api.example.com/v1/goals/{id}/archive"
payload := strings.NewReader("{\n \"expected_version\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.post("https://vitalog-api.example.com/v1/goals/{id}/archive")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expected_version\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vitalog-api.example.com/v1/goals/{id}/archive")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"expected_version\": 123\n}"
response = http.request(request)
puts response.read_body{
"catalog_version": "1.0.4",
"goal": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"metric": "measurement:weight",
"version": 123,
"period": "daily",
"direction": "maximum",
"target": 123,
"unit": "<string>",
"baseline": 500000000000,
"status": "active",
"effective_on": "2023-12-25",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"committed_version": 123,
"idempotent_replay": true
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}{
"code": "VALIDATION_ERROR",
"message": "<string>",
"catalog_version": "<string>",
"issues": [
{
"path": "<string>",
"reason": "<string>",
"message": "<string>",
"suggested_keys": [
"<string>"
],
"discovery": {}
}
],
"existing_id": "<string>",
"current_version": 123,
"current_catalog_version": "<string>"
}Authorizations
staticKeyapiKey
Environment AUTH_KEY. Full ledger access and primary API-key administration. Not OAuth or JWT.
Headers
Required string length:
1 - 128Pattern:
^[A-Za-z0-9][A-Za-z0-9._:-]*$Path Parameters
Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Body
application/json
Required range:
x <= 2147483647Was this page helpful?
