---
title: "Create habit log"
method: POST
path: "/api/v5/habits/habit-logs/"
tags: ["Habit Logs"]
---

# Create habit log

`POST /api/v5/habits/habit-logs/`

## Request

- Base URL: `https://api.pavlok.com`
- URL: `https://api.pavlok.com/api/v5/habits/habit-logs/`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/pavlok/apis/pavlok-api-v5/docs/api/v5/habits/habit-logs/post.ts> (a function with typed inputs; its response is checked against the schema)

Create habit log. Add this value to the corresponding goal if it exists, if it doesn't exist, it creates a new one.

## Request body

- BodyHabitLogsCreateApiV5HabitsHabitLogsPost
  - `habit_log` HabitLogInCreate, required
    - `userHabitId` integer, required
    - `value` number, required
    - `timestamp` string, date-time, required
    - `meta` object

## Response `201`

Successful Response

- HabitLogInResponse
  - `habitLog` HabitLog, required
    - `createdAt` string, date-time
    - `updatedAt` string, date-time
    - `deletedAt` string, date-time
    - `id` integer, required
    - `userId` integer, required
    - `habitId` integer, required
    - `value` number, required
    - `timestamp` string, date-time, required
    - `source` 'manual' | 'device', required: An enumeration.
    - `meta` object

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/pavlok/apis/pavlok-api-v5.md) - [All operations](https://skmtc.dev/pavlok/apis/pavlok-api-v5/llms.txt) - [OpenAPI document](https://skmtc.dev/pavlok/apis/pavlok-api-v5/revisions/3d192098b1ac?raw)
