Crewmojo API

The Crewmojo API is a RESTful based API that allows uploading of employee data as well as accessing reports. The OAuth2 authorisation framework is used to grant access to the Crewmojo API.

Please speak to us if you are interested in enabling this feature.

Once we have configured your API access, your Crewmojo Admin users will have access to the Client ID and Secret Key within Crewmojo.

To get the Client ID and Secret Key

  • Log on to Crewmojo web app

  • Go to Company Settings (under hamburger menu in top left hand corner)

  • Click on the 'Integrations' Icon:

  • Locate the API Authentication card:

  • Copy the Client ID, then view the Secret Key by clicking the 'eye' icon and copy that. Note that each access to the Secret Key is logged.

To access a Crewmojo API endpoint you will firstly use the Client ID and Secret Key to get a short-lived Access Token. The Access Token is valid for 30 minutes after which time you will need to retrieve another Access Token.

Each time you request a new Access Token, all previous Access Tokens are invalidated.

A valid access methodology is to request a new Access Token before each API call to Crewmojo.

Request an Access Token

Endpoints:

EnvironmentURL

Test

https://api.test.crewmojo.com/v1/oauth/token

Production

https://api.crewmojo.com/v1/oauth/token

Request Type:

POST

Content Type:

application/x-www-form-urlencoded

Request Body:

ValueType

grant_type

string, must be client_credentials

client_id

string, retrieved from Crewmojo Admin (above)

client_secret

string, retrieved from Crewmojo Admin (above)


curl -X POST 'https://api.crewmojo.com/v1/oauth/token' \
-H 'accept: application/json' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d '{"grant_type":"client_credentials","client_id":"ccccc","client_secret":"ssss"}'

Response:

CodeDescription / Example

200

Success

Content-Type: application/json

{
  "access_token": "aaaaaaaaaaaaaaa",
  "token_type": "Bearer",
  "expires_in": 1800
}

400

Invalid Data error

Content-Type: application/json

{
  "success": "false",
  "httpErrorCode": 400,
  "errorMessage": "Invalid data received"
}

401

Unauthorized error

Content-Type: application/json

{
  "success": "false",
  "httpErrorCode": 401,
  "errorMessage": "Unauthorized"
}

500

Internal Server Error

Content-Type: application/json

{
  "success": "false",
  "httpErrorCode": 500,
  "errorMessage": "Error generating access token"
}

Last updated