Profile
This resource serves as the primary means of identifying and storing nutrition data for your users. On this page, we'll dive into the different profile endpoints you can use to manage profiles programmatically. We'll look at how to query, create, update, and delete profiles.
The Profile model
The profile model contains an reference to your users.
Properties
- Name
_id- Type
- objectID
- Description
Unique identifier for the profile.
- Name
reference_id- Type
- objectID
- Description
Unique identifier for the profile provided by you.
- Name
is_active- Type
- boolean
- Description
Checks if the profile has logged into the
FoodDiaryduring the current month.
- Name
created_at- Type
- datetime
- Description
- Name
updated_at- Type
- datetime
- Description
List all profiles
This endpoint allows you to retrieve a paginated list of all your profiles.
- Name
starting_after- Type
- objectID
- Description
The last ID on the page you're currently on when you want to fetch the next page.
- Name
ending_before- Type
- objectID
- Description
The first ID on the page you're currently on when you want to fetch the previous page.
- Name
limit- Type
- integer
- Description
Limit the number of items returned.
Request
curl -G https://api.zenreal.app/v1/profiles \
-H "Authorization: Bearer {YOUR_API_KEY}" \
Response
{
"data": [
{
"_id": "hSIhXBhNe8X1d8Et",
"reference_id": "WAz8eIbvDR60rouK",
"is_active": true
},
{
// ...
}
]
}
Create a profile
This endpoint allows you to add a new profile to your profile list in Zenreal. To add a profile, you must provide a unique id.
Required attributes
- Name
reference_id- Type
- string
- Description
Provided unique reference for profile.
Request
curl https://api.zenreal.app/v1/profiles \
-H "Authorization: Bearer {YOUR_API_KEY}" \
-d reference_id="WAz8eIbvDR60rouK" \
Response
{
"_id": "hSIhXBhNe8X1d8Et",
"reference_id": "WAz8eIbvDR60rouK",
"is_active": false,
"created_at": 1719424008013,
"updated_at": 1719424008013
}
Retrieve a profile
This endpoint allows you to retrieve a user by providing their reference_id
Request
curl https://api.zenreal.app/v1/profiles/WAz8eIbvDR60rouK \
-H "Authorization: Bearer {YOUR_API_KEY}"
Response
{
"_id": "hSIhXBhNe8X1d8Et",
"reference_id": "WAz8eIbvDR60rouK",
"is_active": false,
"created_at": 1719424008013,
"updated_at": 1719424008013
}
Delete a profile
This endpoint allows you to delete profile from your profile list in Zenreal. Note: This will also delete all FoodDiary logs, Custom Food and Save Meals.
Request
curl -X DELETE https://api.zenreal.app/v1/profiles/WAz8eIbvDR60rouK \
-H "Authorization: Bearer {YOUR_API_KEY}"
Response
{
"_id": "hSIhXBhNe8X1d8Et",
"deleted": true
}