Fit2Trade API Doc.
Welcome to the Fit2Trade API. Our powerful API enables seamless integration with HR and payroll platforms, allowing you to manage user data, roles, and course completions with ease. With this API, you can securely access, modify, and manage your Fit2Trade account data.
Overview
This documentation gives you the tools to start building integrations with Fit2Trade quickly and securely. For more detailed use cases and testing environments, feel free to explore our sandbox or reach out to our support team.
Base URL
Production: | https://fit2trade.app |
Testing: | https://f2tlab.com |
Authentication
To access the Fit2Trade API, you will need an access token, which will be provided after API access has been enabled for your account. Ensure each API request includes the following headers:
Accept: | application/app.fit2trade.v2 |
Authorization: | Bearer [Access Token] |
Tokens are valid for 24 hours and can be refreshed using the Token Refresh endpoint.
Common Response Structure
Every response from the API follows a standardized structure to ensure consistency. Even when errors occur, the structure remains the same:
json
{
“Status”: “OK/ERROR”,
“Error”: {
“ErrorCode”: 123,
“Message”: “Error details”
},
“Data”: {}
}
Response Codes:
- 200: Request was successful.
- 400: Incorrect data format or too many rows.
- 403: Token is expired or invalid.
- 500: Unexpected server error.
API Endpoints
1. Token Refresh
Obtain a new access token and refresh token.
- Endpoint:
/api2/reauthorize
- Method: PATCH
Headers:
Accept: application/app.fit2trade.v2
Authorization: Bearer [Access Token]
Content-Type: application/json
Request Body:
json
{
“RefreshToken”: “your-refresh-token-here”
}
Response:
json
{
“Status”: “OK”,
“Data”: {
“Token”: “new-access-token”,
“RefreshToken”: “new-refresh-token”
}
}
2. Create or Update Users
Create or update user profiles in bulk.
- Endpoint:
/api2/users
- Method: POST
Headers:
Accept: application/app.fit2trade.v2
Authorization: Bearer [Access Token]
Content-Type: application/json
Request Body:
json
[
{
“FirstName”: “John”,
“LastName”: “Doe”,
“Email”: “[email protected]”,
“LearnerRole”: “sales”,
“Location”: {
“LocationID”: null,
“ExternalID”: null
}
}
]
Response:
json
{
“Status”: “OK”,
“Data”: [
{
“UserID”: 123456,
“Email”: “[email protected]”
}
]
}
3. Deactivate Users
Archive users from your account.
- Endpoint:
/api2/users/deactivate
- Method: POST
Request Body:
json
[
{
“Email”: “[email protected]”
}
]
Response:
json
{
“Status”: “OK”,
“Data”: [
{
“UserID”: 0,
“Email”: “[email protected]”
}
]
}
4. Reactivate Users
Restore archived users to an active state.
- Endpoint:
/api2/users/reactivate
- Method: POST
Request Body:
json
[
{ “Email”: “[email protected]” },
{ “Email”: “[email protected]” }
]
Response:
json
{
“Status”: “OK”,
“Data”: [
{ “UserID”: 123456, “Email”: “[email protected]” },
{ “UserID”: 0, “Email”: “[email protected]” }
]
}
5. Course Completions
Retrieve the list of completed courses for users.
- Endpoint:
/api2/users/completions
- Method: POST
Request Body:
json
[
{
“Email”: “[email protected]”
}
]
Response:
json
{
“Status”: “OK”,
“Data”: [
{
“UserID”: 123456,
“Completions”: [
{
“CourseID”: 130,
“Course”: “Word Skills”,
“CompletionDate”: “2023-12-31”,
“CertExpiryDate”: “2026-08-06”
}
]
}
]
}
6. User Login
Generate a token that allows a user to log in without needing to input their credentials.
- Step 1: Request login token
- Endpoint:
/api2/users/credentials
- Method: POST
- Endpoint:
- Step 2: Use the login token to log in
- Endpoint:
/api2/users/login
- Method: POST
- Endpoint:
Request Body:
json
{ “Email”: “[email protected]”, “LoginToken”: “your-login-token”, “Password”: “user-password” }
Response:
json
{
“Status”: “OK”,
“Data”: {
“LoginToken”: “new-token”,
“Image”: “<svg>Fit2Trade Logo</svg>”
}
}
API Error Handling
If the request encounters an error, the API will return a response indicating the error:
json
Error Code | Description |
0 | No error |
2000 | System error |
2001 | Missing headers |
2002 | Invalid token |
2003 | Expired token |
2004 | Client access revoked |
2005 | Missing data |
2006 | Wrong data format |
2007 | Too many rows of data |
2008 | Incorrect user data |