Auth API Documentation
Auth API Documentation
May 2018
Getting Started
In order to get access to Mortech APIs you will need to get a Partner ID, API key, and a private
key. Contact your Customer Success Manager to get setup started.
1. Mortech will generate a Partner account within our system and needs the email address of
whomever will be receiving the Partner ID, API key, and private key
2. The Partner will receive an email with a link where they can receive their Partner ID, API key,
and private key .pem file.
3. Follow the link provided in the email to download the private key file. This is needed to sign
the JWT authorization token.
a. Mortech provides a Private Key during the provisioning process. Mortech keeps the
Public Key equivalent for validating the signatures. The Private Key is generated from the
Client’s browser and is never transmitted on the internet. Therefore Mortech never has
a copy of the Private Key. It is the responsibility of the Partner to keep the Private Key
secure.
HTTPS Request
Headers:
authorizationtoken:Bearer
<signed JWT>
REQUESTING
x-api-key: <partner api key>
ACCESS TOKEN
HTTPS Request
Headers:
authorizationtoken: <accesstoken from auth API response>
EXAMPLE API
X-api-key: <partner api key>
REQUEST
Mortech requires these two items to be in the header. They are not optional and they are fixed
values. Do not use an `alg` or `typ` different from what is below.
Header JSON
{
"alg": "RS256",
"typ": "JWT"
}
• `customerId` which is the ID of the customer the Partner is making requests on behalf of.
• `iat` which is the ‘Issued-At Time’ timestamp at which the JWT is created. This value must
be within 5 minutes of the system time of Mortech’s APIs to be considered valid.
Payload JSON
{
"partnerId": "350",
"customerId": "30bank01",
"iat": 1495634289
}
Resulting JWT
The header and payload portions of the JWT are base64 encoded and the signature is encrypted.
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwYXJ0bmVySWQiOiI0MjIiLCJjdX0b21l
cklkIjoiMzBqdXN0aW4wMSIsImlhdCI6MTQ5NTYzNDI4OX0.MTv1YoxMha8EmJHSHCIaqga6l
FAnUdXj6qZR-qZqwaQ
API Key
All requests to Mortech API’s require an API Key which is provided during the provisioning
process (See Getting Started). It should be passed in the header as `x-api-key` (See the
example below).
Authorization Token
All requests to Mortech APIs require an `authorizationtoken` Header. The
`authorizationtoken` header for the auth API will be a JWT generated and signed using the
partners private key. The value for the `authorizationtoken` header will be a bearer token
with a space between the word `Bearer` and the signed JWT.
Authorization URL
https://api.mortech-inc.com/auth
x-api-key: "OPLcE7uALa7...6eXaKS6ZhK4"
Result (200)
{
"accesstoken":"85f900a7dce3...af9f59a8c1afb"
}
200 The request was successful and the JSON response body will contain an
`accesstoken`.
Unsuccessful Meaning
response codes
400 There was an issue with the request. Usually a bad input parameter.
401 The supplied `authorizationtoken` is invalid.
403 The supplied `authorizationtoken` is expired. The Partner should
sign a new JWT and request a new token from the /auth API.
500 The service is experiencing problems. This error should be reported to
Mortech.