Supplements

This endpoint focuses on retrieving user supplement intake records. It supports filtering by specific supplement ID, startDate, and includes pagination capabilities to manage large data sets effectively.

Properties

  • Name
    user_id
    Type
    string
    Description

    UUID of the user. This must be a valid UUID that represents the user whose supplement intake data is being requested.


GET/api/v1/supplements/[user_id]

Get Supplement Intake Data

This endpoint allows you to retrieve supplement intake data for a specified user. By default, it returns data sorted in descending order.

Optional attributes

  • Name
    startDate
    Type
    string
    Description

    The start date to filter the supplement data. Must be in ISO 8601 format. Defaults to the earliest record if not provided.

  • Name
    supplementID
    Type
    string
    Description

    The ID of the supplement to filter by. If not provided, data for all supplements are returned.

  • Name
    sort
    Type
    string
    Description

    Specifies the sort order of the data, either asc for ascending or desc for descending. Defaults to descending if not provided.

  • Name
    page
    Type
    integer
    Description

    The page number of results to return. Must be an integer greater than 0. Defaults to 1.

  • Name
    pageSize
    Type
    integer
    Description

    The number of results per page. Must be an integer between 1 and 10,000. Defaults to 1,000.

Request

GET
/api/v1/supplements/[user_id]
curl -G "https://api.onetwentyone.ai/api/v1/supplements/123e4567-e89b-12d3-a456-426614174000" \
  -H "Authorization: Bearer {token}" \
  -d startDate="2022-01-01" \
  -d supplementID="326aa713-a248-4c98-9a40-a5f39b25ca94" \
  -d page=1 \
  -d pageSize=3

Response

{
  "pagination": {
    "current_page": 1,
    "has_more": false,
    "next_page": null,
    "prev_page": null
  },
  "limit": {
    "X-RateLimit-Limit": 10000,
    "X-RateLimit-Remaining": 9585,
    "X-RateLimit-Reset": 1716940800
  },
  "data": [
    {
      "id": "326aa713-a248-4c98-9a40-a5f39b25ca94",
      "details": {
        "brand": "Qunol",
        "servings": "100",
        "id": "326aa713-a248-4c98-9a40-a5f39b25ca94",
        "name": "Mega Ubiquinol CoQ10 100 mg",
        "upc": "8 98440 00106 6",
        "entry_date": "2022-07-21T00:00:00+00:00",
        "supplement_ingredient": [
          {
            "quantity": 6,
            "unit": "calories",
            "active": true,
            "ingredient_name": "calories",
            "order": 1
          },
          {
            "quantity": 6,
            "unit": "milligrams",
            "active": true,
            "ingredient_name": "vitamin c",
            "order": 2
          },
          {
            "quantity": 100,
            "unit": "milligrams",
            "active": true,
            "ingredient_name": "ubiquinol",
            "order": 3
          }
        ]
      },
      "logs": [
        {
          "id": "a1cc2ded-30eb-4b7b-85ba-e2875aeb7087",
          "created_at": "2022-05-28T13:49:53.672931+00:00",
          "user_id": "123e4567-e89b-12d3-a456-426614174000",
          "supplement_id": "326aa713-a248-4c98-9a40-a5f39b25ca94",
          "servings": 1
        },
        {
          "id": "30bd217a-9109-426a-bcaa-a0fd3c5227ab",
          "created_at": "2022-05-27T08:27:12.08465+00:00",
          "user_id": "123e4567-e89b-12d3-a456-426614174000",
          "supplement_id": "326aa713-a248-4c98-9a40-a5f39b25ca94",
          "servings": 1
        }

      ]
    }
  ]
}

Was this page helpful?