Create User
You can create a user using our API. In order to create an account, you need to provide the following information:
Request
| Field | Type | Description | Required | Format |
|---|---|---|---|---|
email | string | The email address of the user (unique ID). | Yes | |
firstname | string | The firstname of the user. | Yes | |
lastname | string | The lastname of the user. | Yes | |
phonenumber | string | The phone number of the user. | Yes | |
dateOfBirth | date | The date of birth of the user. | Yes | YYYY-MM-DD |
gender | string | The gender at birth of the user. | Yes | male / female |
height | string | The height in ft and inches of the user. | Yes | |
weight | string | The weight in lbs of the user. | Yes | |
pregnant | boolean | Is the user pregnent? | Yes | true/false |
metadata | object | Additional information about the user. | No | {key: value} |
Payload example
const payload = {
email: 'jane@doe.com',
firstname: 'jane',
lastname: 'doe',
phonenumber: '1234567890',
dateOfBirth: '1990-12-23',
gender: 'female',
height: '5ft 6in',
weight: 130,
pregnant: false,
metadata: {
key: 'value',
foodRestricition: 'vegan',
...
},
}
Response
Response is always in JSON format.
{
"message": "User created successfully",
"email": "jane@doe.com",
"identifier": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
}
Full example of a call made with axios
const axios = require('axios');
const res = await axios({
url: 'https://partners.ftmtapi.com/users/create',
method: 'post',
data: {
email: 'jane@doe.com',
firstname: 'jane',
lastname: 'doe',
phonenumber: '1234567890',
dateOfBirth: '1990-12-23',
gender: 'female',
height: '5ft 6in',
weight: 130,
pregnant: false,
},
headers: {
Authorization: 'Bearer <YOUR_API_KEY>',
'Fitmate-Version': '2023-08-01',
}
});
Errors
The API offers some check and returns errors in the following scenario
| Error code | Body Response |
|---|---|
409 | Email already exists |
400 | Invalid email address |
409 | Phone number already exists |
400 | Invalid phone number |
We will update this list as we grow our API.
Emails trigger
Once an account is created via the API, an email is automatically sent to the customer with a magic link to log into our App.
We may allow in the future to turn off this email.