> For the complete documentation index, see [llms.txt](https://docs.january.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.january.ai/client-sdks/ios-sdk/reference/water-and-weight-logs-api.md).

# Water and weight logs API

## Operations

```swift
// JanuaryClient.waterLogs
public func create(_ request: CreateWaterLogRequest) async throws -> WaterLog
public func list(_ request: ListWaterLogsRequest) async throws -> ListWaterLogsResponse
public func delete(_ request: DeleteWaterLogRequest) async throws -> DeleteWaterLogResponse

// JanuaryClient.weightLogs
public func create(_ request: CreateWeightLogRequest) async throws -> WeightLog
public func list(_ request: ListWeightLogsRequest) async throws -> ListWeightLogsResponse
```

## Requests and defaults

```swift
public struct CreateWaterLogRequest: Hashable, Sendable {
    public init(amount: WaterAmount, consumedAtUTC: String? = nil, user: PartnerUserContext)
}

public struct ListWaterLogsRequest: Hashable, Sendable {
    public init(start: String, end: String, unit: VolumeUnit = .fluidOunces, user: PartnerUserContext)
}

public struct DeleteWaterLogRequest: Hashable, Sendable {
    public init(id: String, user: PartnerUserContext)
}

public struct CreateWeightLogRequest: Hashable, Sendable {
    public init(weight: Weight, measuredAtUTC: String? = nil, user: PartnerUserContext)
}

public struct ListWeightLogsRequest: Hashable, Sendable {
    public init(start: String, end: String, user: PartnerUserContext)
}
```

Amount, weight, and date limits are in [Validation limits](/client-sdks/ios-sdk/reference/validation.md) and the [Water and weight logs](/client-sdks/ios-sdk/guides/water-and-weight-logs.md) guide.

## Configured-client operations

```swift
// JanuaryClient.waterLogs
public func create(amount: WaterAmount, consumedAtUTC: String? = nil) async throws -> WaterLog
public func list(start: String, end: String, unit: VolumeUnit = .fluidOunces) async throws -> ListWaterLogsResponse
public func delete(id: String) async throws -> DeleteWaterLogResponse

// JanuaryClient.weightLogs
public func create(weight: Weight, measuredAtUTC: String? = nil) async throws -> WeightLog
public func list(start: String, end: String) async throws -> ListWeightLogsResponse
```

These methods use the client's end-user ID and timezone. The request-value forms above do too: the client's values replace the request's `user`.

## Responses

`WaterLog` contains `id`, the `amount` (`WaterAmount`: `value` and `VolumeUnit`) as logged, and `consumedAtUTC`. `ListWaterLogsResponse.items` is `[DailyWaterTotal]`: a local `date` and a `total` (`Volume`, rounded to one decimal place) in the requested unit, oldest first. Delete returns nothing.

`WeightLog` contains the `weight` (`Weight`: `value` and `WeightUnit`) as logged and `measuredAtUTC`. `ListWeightLogsResponse.items` is `[DailyWeight]`: a local `date` and that day's latest `weight`, in the unit it was logged in, oldest first.

Timestamps in responses are ISO 8601 in UTC with milliseconds. Dates are `yyyy-MM-dd` in the request's timezone.

## Errors

Create checks the amount or weight range and an optional ISO 8601 timestamp before sending. Operations map declared 400, 401, 403, and 429 responses plus other HTTP, transport, and decoding failures to `JanuaryError`. A response that carries an unknown unit is reported as a `.decoding` error. The API's `daily_water_limit_exceeded` and `date_range_too_large` codes arrive as `.validation` errors with `code` set.
