Developers · API v2.2

Fit2Trade API documentation.

Reference documentation for integrating with Fit2Trade user data, roles, course completions and authenticated user access.

Version 2.2Updated 18 September 2025
API access

API access must be enabled for the client account by Fit2Trade. Once enabled, an access token and refresh token are generated and supplied for API access.

01

Overview

Use the Fit2Trade API to access or modify data for an enabled client account. Each request requires the API v2 accept header and bearer-token authorisation.

Base URLs

Productionhttps://fit2trade.app
Testinghttps://f2tlab.com

Required request headers

HeaderValue
Acceptapplication/app.fit2trade.v2 Required · fixed value
AuthorizationBearer [Access Token] Required
Content-Typeapplication/json Used by JSON request endpoints
02

Responses and errors

Regardless of the HTTP return code, the response body uses a consistent Status, Error and Data structure. Check Status first to determine whether a request was processed successfully. On success, ErrorCode is 0 and Message is blank.

{
  "Status": "OK/ERROR",
  "Error": {
    "ErrorCode": 123,
    "Message": "error details"
  },
  "Data": {}
}

The server returns HTTP status 200 unless one of the following conditions occurs.

HTTP status codes

StatusDescription
403Token expired, token invalid, or required headers are missing.
400Wrong data format or too many rows.
500Unexpected error.

Error codes

ErrorCodeDescription
0No error
2000System error
2001Missing headers
2002Invalid token
2003Expired token
2004Client access revoked
2005Missing data
2006Wrong data format
2007Too many rows of data
2008Incorrect user data
PATCH/api2/reauthorize

Token refresh

Generate a new access token and refresh token. The access token returned on success is valid for 24 hours.

Headers

Acceptapplication/app.fit2trade.v2 Required
AuthorizationBearer [Access Token]
Content-Typeapplication/json

Request body

Supply a raw JSON object containing the required RefreshToken string.

{
  "RefreshToken": "[refresh-token]"
}

Successful response

{
  "Status": "OK",
  "Error": { "ErrorCode": 0, "Message": "" },
  "Data": {
    "Token": "[new-access-token]",
    "RefreshToken": "[new-refresh-token]"
  }
}
POST/api2/users

Create or update users

Create or modify users. The request body is a raw JSON array of objects; a single user must still be sent as a single-value array. The maximum request size is 100 users.

User properties

PropertyValue
FirstNameString. Required for a new user. For an existing user, a supplied value updates the database; if blank, the current value remains unchanged.
LastNameString. Same operation as FirstName.
EmailString. Required.
NewEmailString. Required only when changing a user's email. The change fails if a user with the new email already exists.
ExternalIDString. Used when IDs from the system accessing the API are required.
LearnerRoleString. Optional. If a matching role definition is found, content is assigned according to the role.
LocationOptional JSON object containing LocationID or ExternalID. If omitted, the user is created without a location and is prompted to select one on first login. If the object is present, one of the two IDs must be supplied or the location is ignored. External location IDs must be supplied before they are used through the API.
AdminRoleOptional JSON object. If omitted, no admin rights are granted. IsAdmin is required; ViewOnly is optional and defaults to false. A valid Location must also be specified or the AdminRole is ignored. Setting IsAdmin to false revokes admin rights for the specified location.

Sample request

[
  {
    "FirstName": "John",
    "LastName": "Smith",
    "Email": "john@fit2trade.com",
    "LearnerRole": "sales",
    "ExternalID": "HG76GHF"
  },
  {
    "FirstName": "Barbara",
    "LastName": "Jones",
    "Email": "barbara@fit2trade.com",
    "ExternalID": "LKHG5HK8",
    "Location": {
      "LocationID": null,
      "ExternalID": null
    },
    "LearnerRole": "admin",
    "AdminRole": {
      "IsAdmin": true,
      "ViewOnly": false,
      "Location": {
        "LocationID": null,
        "ExternalID": null
      }
    }
  }
]

Response

On success, Data contains a list of user IDs and email addresses. A UserID of 0 means that user was not successfully created or updated.

POST/api2/users/deactivate

Deactivate users

Archive users. Send a JSON array containing up to 100 users. Email is required and ExternalID is optional. Users identified by email are archived; email addresses not found are ignored.

[
  { "Email": "john@fit2trade.com" },
  { "Email": "barbara@fit2trade.com", "ExternalID": "LKHG5HK8" }
]

UserID = -1User not found

UserID = 0User successfully archived

UserID > 0User not archived

POST/api2/users/reactivate

Reactivate users

Unarchive users. Send a JSON array containing up to 100 users. Email is required and ExternalID is optional.

[
  { "Email": "john@fit2trade.com" },
  { "Email": "barbara@fit2trade.com", "ExternalID": "LKHG5HK8" }
]

UserID = 0User was not reactivated

UserID > 0User successfully reactivated

POST/api2/users/completions

Course completions

Get the list of courses completed by users. Send a JSON array containing up to 100 users; Email is required for each object.

[
  { "Email": "john@fit2trade.com" },
  { "Email": "barbara@fit2trade.com" }
]

Sample response

{
  "Error": { "ErrorCode": 0, "Message": "" },
  "Status": "OK",
  "Data": [
    {
      "UserID": 1,
      "Email": "john@fit2trade.com",
      "Completions": [
        {
          "CourseID": 130,
          "Course": "Word Skills",
          "CompletionDate": "2023-12-31T00:00:00",
          "CertExpiryDate": "2026-08-06T00:00:00"
        }
      ]
    }
  ]
}
POST/api2/users/credentials

User credentials

Get a login token for a user. This token is valid for 5 minutes. The documented flow can be used to publish a link that signs a user into Fit2Trade automatically, provided the user's password in both applications is the same.

  1. Call /api2/users/credentials to obtain the 5-minute login token.
  2. Use that token with /api2/users/login to obtain a new login token valid for 8 hours.
  3. Use [base_url]/api2/users/connect/[login_token] to access Fit2Trade without prompting the user to log in.

Request body

{
  "Email": "john@fit2trade.com"
}

Sample response

{
  "Error": { "ErrorCode": 0, "Message": "" },
  "Status": "OK",
  "Data": {
    "Email": "john@fit2trade.com",
    "LoginToken": "[5-minute-login-token]"
  }
}
POST/api2/users/login

Login user

Exchange the short-lived login token for a login token that is valid for 8 hours and can be used to create an access link to Fit2Trade without prompting the user to log in. The response also includes an Image property containing the Fit2Trade logo in SVG format.

Request body

PropertyValue
EmailString. Required.
LoginTokenString. Required.
PasswordString. Required.
{
  "Email": "john@fit2trade.com",
  "LoginToken": "[5-minute-login-token]",
  "Password": "[user-password]"
}

Sample response

{
  "Error": { "ErrorCode": 0, "Message": "" },
  "Status": "OK",
  "Data": {
    "Email": "john@fit2trade.com",
    "LoginToken": "[8-hour-login-token]",
    "Image": "<svg width="100%" height="100%"> … </svg>"
  }
}
GET/api2/users/connect/[login_token]

Access Fit2Trade

Use the 8-hour login token to access Fit2Trade without prompting the user to log in.

Headers

Acceptapplication/app.fit2trade.v2 Required
AuthorizationBearer [Access Token]

If successful, the user is taken to their landing page. If not, the user is presented with the login page.