The recommended way to authorize user requests is with an API key. For other requests, like accessing packages and transfers, the MASV API requires web tokens .
API keys simplify integration with the MASV API in these ways:
The username and password do not need to be hardcoded or stored.
The key does not require a refresh after expiration every few days.
An API key, while active, does not require the user to periodically answer multi-factor authentication (MFA) challenges.
An API key gives your application the same permissions as the MASV user from which it was created. Users with these roles can create API keys:
Owner
Admin
Integration Manager
Admins and Integration Managers can manage only the API keys they create; Owners have full access to manage all API keys for the Team. To learn more about user roles and permissions, see the MASV access policy .
You can create and manage API keys with the MASV Web App . Authorized users can create API keys for any Team that they belong to.
Your application can also create API keys programmatically:
Method Route POST/teams/{team_id}/api_keys
Name Type Required Description X-User-TokenString Yes JSON Web Token. See Web Tokens . Content-TypeString Yes Must be application/json
Name Type Required Description team_idString Yes The Team ID to bind the API key to. Retrieved from authorization .
Name Type Required Description nameString No Name of the key to create descriptionString No Description for the key expiryString No Date-time expiry for the key. Default: 0001-01-01T00:00:00.000Z. Format: ISO 8601 stateString Yes State of the API key. Accepted values: active / inactive
curl -d ' {"name": "$NAME", "description": "$DESCRIPTION", "expiry": "$EXPIRY", "state": "$STATE"} ' \
-H " X-User-Token: $USER_TOKEN " \
-H " Content-Type: application/json " \
-X POST https://api.massive.app/v1/teams/ $TEAM_ID /api_keys
After a successful request, this endpoint returns 201 Created:
"created_at" : " 2021-04-19T16:57:32.683Z " ,
"description" : " This is a sample API key description " ,
"expiry" : " 2021-04-24T16:57:32.547Z " ,
"id" : " 01F3NH1NRBQWRN7HQDJ2SYGBDH " ,
"key" : " <api-key-value-here> " ,
"last_request_at" : " 0001-01-01T00:00:00.000Z " ,
"name" : " Sample API key " ,
"updated_at" : " 2021-04-19T16:57:32.683Z "
Property Description created_atThe datetime that the key was created descriptionThe key description expiryThe datetime the key will expire idThe created API key ID keyThe actual API key to be used in requests to the MASV API last_request_atThe last time the key was used nameThe name of the key stateState of the API key. Possible values: active, inactive, suspended updated_atLast time key information was updated
Note
If the Team’s account becomes inactive due to non-payment, then the Team’s API keys will be suspended until the account billing is reactivated. Attempting to use a suspended key will return error 402 unauthorized. MASV also suspends API keys when a Trial account ends. For details, see pricing .
Users can update API keys for any Team, subject to their role .
Method Route PUT/api_keys/{api_key_id}
Name Type Required Description X-User-TokenString Yes User JSON Web Token Content-TypeString Yes Must be application/json
Name Type Required Description api_key_idString Yes The API key to update. Use the id property, not the key property.
Name Type Required Description nameString No Name of the key descriptionString No Description for the key expiryString No Date-time expiry. Default: 0001-01-01T00:00:00.000Z. Format: ISO 8601 stateString Yes State of the API key. Accepted values: active / inactive
curl -d ' {"name": "$NAME", "description": "$DESCRIPTION", "expiry": "$EXPIRY", "state": "$STATE"} ' \
-H " X-User-Token: $USER_TOKEN " \
-H " Content-Type: application/json " \
-X PUT https://api.massive.app/v1/api_keys/ $API_KEY_ID
After a successful request, this endpoint returns 200 OK:
"created_at" : " 2021-04-19T16:57:32.683Z " ,
"description" : " This is a sample API key description " ,
"expiry" : " 2021-04-24T16:57:32.547Z " ,
"id" : " 01F3NH1NRBQWRN7HQDJ2SYGBDH " ,
"last_request_at" : " 0001-01-01T00:00:00.000Z " ,
"name" : " Sample API key " ,
"updated_at" : " 2021-04-19T16:57:32.683Z "
Authorized users can modify the state of API keys, subject to their role . This is a helper method to quickly toggle a key’s state without fetching and passing the full object.
Method Route PUT/api_keys/{api_key_id}/{action}
Name Type Required Description X-User-TokenString Yes User JSON Web Token Content-TypeString Yes Must be application/json
Name Type Required Description api_key_idString Yes The API key to update. Use the id property, not the key property. actionString Yes State to set. Accepted values: active / inactive
curl -H " X-User-Token: $USER_TOKEN " \
-H " Content-Type: application/json " \
-X PUT https://api.massive.app/v1/api_keys/ $API_KEY_ID / $ACTION
After a successful request, this endpoint returns 204 No Content with an empty body.
If the key state is suspended, it cannot be activated or deactivated.
Authorized users can delete API keys, subject to their role .
Method Route DELETE/api_keys/{api_key_id}
Name Type Required Description X-User-TokenString Yes User JSON Web Token Content-TypeString Yes Must be application/json
Name Type Required Description api_key_idString Yes The API key to delete. Use the id property, not the key property.
curl -H " X-User-Token: $USER_TOKEN " \
-H " Content-Type: application/json " \
-X DELETE https://api.massive.app/v1/api_keys/ $API_KEY_ID
After a successful request, this endpoint returns 204 No Content with an empty body.
The Team Owner can retrieve a list of all API keys that belong to a given Team.
Method Route GET/teams/{team_id}/api_keys
Name Type Required Description X-User-TokenString Yes User JSON Web Token Content-TypeString Yes Must be application/json
Name Type Required Description team_idString Yes The Team ID to request API keys from
curl -H " X-User-Token: $USER_TOKEN " \
-H " Content-Type: application/json " \
-X GET https://api.massive.app/v1/teams/ $TEAM_ID /api_keys
After a successful request, this endpoint returns 200 OK:
"created_at" : " 2021-04-16T20:42:37.659Z " ,
"description" : " This is a sample key " ,
"expiry" : " 2021-04-20T20:42:37.000Z " ,
"id" : " 01F3E6QN6V9TYCSRCEXB5B9JWR " ,
"last_request_at" : " 0001-01-01T00:00:00.000Z " ,
"updated_at" : " 2021-04-19T10:42:58.221Z "
API keys can be supplied in the X-API-KEY header on endpoint methods that typically require the user authorization token X-User-Token.
For full package documentation, see Packages .
Method Route GET/teams/{team_id}/packages
curl -H " X-API-KEY: $API_KEY " \
-H " Content-Type: application/json " \
-X GET https://api.massive.app/v1/teams/ $TEAM_ID /packages
The following endpoints require X-User-Token :
Method Route GET/teams/{team_id}/api_keysPUT/api_keys/{api_key_id}DELETE/api_keys/{api_key_id}POST/teams/{team_id}/api_keysPUT/users/{user_id}POST/users/{user_id}/passwordPUT/users/{user_id}/email