Skip to content

Dailies

dailies


POST /api/v1/dailies/{measure}

Upsert Daily

Description

Record one daily value. The scope follows the measure: reproductive_health:write for the menstrual cycle day, wellness:write for every other measure.

Input parameters

Parameter In Type Default Nullable Description
HTTPBearer header string N/A No JWT Bearer token
measure path No
refreshed-token header No
token cookie string No

Request body

{
    "date": "2022-04-13",
    "value": 10.12,
    "platform": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "date": {
            "type": "string",
            "format": "date",
            "title": "Date"
        },
        "value": {
            "type": "number",
            "title": "Value"
        },
        "platform": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Platform",
            "description": "Where the data came from, for example `garmin_connect` or `strava`, when the data was obtained from another platform. Accepted with a token issued to your app or to one of SweatStack's own clients (the CLI and the Python library's sign-in); a session or an API key may not name one. Stored and echoed as the canonical name."
        }
    },
    "type": "object",
    "required": [
        "date",
        "value"
    ],
    "title": "DailyCreate"
}

Responses

{
    "date": "2022-04-13",
    "value": null,
    "status": "stored",
    "writer": null,
    "application_id": null,
    "platform": null,
    "attribution": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "date": {
            "type": "string",
            "format": "date",
            "title": "Date"
        },
        "value": {
            "anyOf": [
                {
                    "type": "number"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Value"
        },
        "status": {
            "$ref": "#/components/schemas/DailyStatus"
        },
        "writer": {
            "anyOf": [
                {
                    "$ref": "#/components/schemas/WriterKind"
                },
                {
                    "type": "null"
                }
            ],
            "description": "Who wrote it: `athlete` (the person, their coach, or SweatStack's own CLI and library), `application` (an app; see `application_id`) or `sweatstack` (SweatStack's own sync of a connected platform; see `platform`). Set on a stored day only."
        },
        "application_id": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Application Id",
            "description": "The app that wrote it, with writer `application`; null when the app was deleted."
        },
        "platform": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Platform",
            "description": "The platform the data came from (`garmin_connect`, `strava`, ...), or null when it came from no platform: a value the person entered, a file they uploaded, a value an app computed."
        },
        "attribution": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Attribution",
            "description": "Which platform the data came from, as one line to show next to it, for example \"Garmin\"; null when it came from no platform. Garmin requires this line wherever its data is displayed.",
            "readOnly": true
        }
    },
    "type": "object",
    "required": [
        "date",
        "value",
        "status"
    ],
    "title": "DailyResponse"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

GET /api/v1/dailies/{measure}

List Dailies

Description

The stored values of one measure between two dates. The scope follows the measure: reproductive_health:read for the menstrual cycle day, wellness:read for every other measure. History is capped by the app's plan, like activities.

Input parameters

Parameter In Type Default Nullable Description
HTTPBearer header string N/A No JWT Bearer token
end query string No
interpolate query boolean False No
measure path No
refreshed-token header No
start query string No
token cookie string No

Responses

[
    {
        "date": "2022-04-13",
        "value": null,
        "status": "stored",
        "writer": null,
        "application_id": null,
        "platform": null,
        "attribution": null
    }
]
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "type": "array",
    "items": {
        "$ref": "#/components/schemas/DailyResponse"
    },
    "title": "Response List Dailies Api V1 Dailies  Measure  Get"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

DELETE /api/v1/dailies/{measure}

Delete Daily

Description

Delete one daily value. The scope follows the measure, as for recording one.

Input parameters

Parameter In Type Default Nullable Description
HTTPBearer header string N/A No JWT Bearer token
date query string No
measure path No
refreshed-token header No
token cookie string No

Responses

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

POST /api/v1/dailies/{measure}/batch

Write Dailies (beta)

Description

Beta. This endpoint is in beta and is subject to breaking changes. If you plan to use it in production, email [email protected] before you integrate, so we can tell you about changes in advance and help you migrate.

Record up to 1,000 values of one measure in one request, all or nothing: a value out of the measure's range or a date sent twice is a 422 that lists every such value by its index, and nothing is written. A stored value is never replaced (existing: keep); each result says what the day holds afterwards. The scope follows the measure, as for recording one.

Input parameters

Parameter In Type Default Nullable Description
HTTPBearer header string N/A No JWT Bearer token
measure path No
refreshed-token header No
token cookie string No

Request body

{
    "values": [
        {
            "date": "2022-04-13",
            "value": 10.12
        }
    ],
    "existing": "string",
    "platform": null
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the request body
{
    "properties": {
        "values": {
            "items": {
                "$ref": "#/components/schemas/DailyValue"
            },
            "type": "array",
            "maxItems": 1000,
            "minItems": 1,
            "title": "Values",
            "description": "1 to 1,000 values, each date once."
        },
        "existing": {
            "type": "string",
            "const": "keep",
            "title": "Existing",
            "description": "What to do with a day that already holds another value. Required. `keep` leaves it as it is, whoever wrote it, including a day older than your app can read."
        },
        "platform": {
            "anyOf": [
                {
                    "type": "string"
                },
                {
                    "type": "null"
                }
            ],
            "title": "Platform",
            "description": "Where the data came from, for example `garmin_connect` or `strava`, when the data was obtained from another platform. Accepted with a token issued to your app or to one of SweatStack's own clients (the CLI and the Python library's sign-in); a session or an API key may not name one. Stored and echoed as the canonical name. Applies to every value in the batch."
        }
    },
    "type": "object",
    "required": [
        "values",
        "existing"
    ],
    "title": "DailyBatchCreate",
    "description": "Values of one measure, written all or nothing."
}

Responses

{
    "results": [
        {
            "date": "2022-04-13",
            "outcome": "written"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "results": {
            "items": {
                "$ref": "#/components/schemas/DailyWriteResult"
            },
            "type": "array",
            "title": "Results",
            "description": "One per value sent, in the same order."
        }
    },
    "type": "object",
    "required": [
        "results"
    ],
    "title": "DailyBatchResponse"
}

{
    "detail": [
        {
            "loc": [
                null
            ],
            "msg": "string",
            "type": "string"
        }
    ]
}
⚠️ This example has been generated automatically from the schema and it is not accurate. Refer to the schema for more information.

Schema of the response body
{
    "properties": {
        "detail": {
            "items": {
                "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
        }
    },
    "type": "object",
    "title": "HTTPValidationError"
}

Schemas

DailyBatchCreate

Name Type Description
existing string What to do with a day that already holds another value. Required. `keep` leaves it as it is, whoever wrote it, including a day older than your app can read.
platform Where the data came from, for example `garmin_connect` or `strava`, when the data was obtained from another platform. Accepted with a token issued to your app or to one of SweatStack's own clients (the CLI and the Python library's sign-in); a session or an API key may not name one. Stored and echoed as the canonical name. Applies to every value in the batch.
values Array<DailyValue> 1 to 1,000 values, each date once.

DailyBatchResponse

Name Type Description
results Array<DailyWriteResult> One per value sent, in the same order.

DailyCreate

Name Type Description
date string(date)
platform Where the data came from, for example `garmin_connect` or `strava`, when the data was obtained from another platform. Accepted with a token issued to your app or to one of SweatStack's own clients (the CLI and the Python library's sign-in); a session or an API key may not name one. Stored and echoed as the canonical name.
value number

DailyMeasure

Type: string

DailyResponse

Name Type Description
application_id The app that wrote it, with writer `application`; null when the app was deleted.
attribution Which platform the data came from, as one line to show next to it, for example "Garmin"; null when it came from no platform. Garmin requires this line wherever its data is displayed.
date string(date)
platform The platform the data came from (`garmin_connect`, `strava`, ...), or null when it came from no platform: a value the person entered, a file they uploaded, a value an app computed.
status DailyStatus
value
writer Who wrote it: `athlete` (the person, their coach, or SweatStack's own CLI and library), `application` (an app; see `application_id`) or `sweatstack` (SweatStack's own sync of a connected platform; see `platform`). Set on a stored day only.

DailyStatus

Type: string

DailyValue

Name Type Description
date string(date)
value number

DailyWriteOutcome

Type: string

DailyWriteResult

Name Type Description
date string(date)
outcome DailyWriteOutcome `written`: the day was empty and holds your value now. `unchanged`: it already held this value, so nothing was written. `kept`: it holds another value, which stays.

HTTPValidationError

Name Type Description
detail Array<ValidationError>

ValidationError

Name Type Description
loc Array<>
msg string
type string

WriterKind

Type: string

Security schemes

Name Type Scheme Description
HTTPBearer http bearer
HTTPBasic http basic