Setup Customer account
You will be using the Alef Mobile Network API to carry out the tasks in this section. This is a basic config, Refer to the API reference documentation to learn more about the API and explore the full schema.
Prerequisties
The steps below can be followed after you have received your master API key from the Alef team. For Alef to provision this key, you will need to provide us with the following information:
- Customer Name
- Contract ID
- Admin contact (Name, email and phone)
- Main address
- Billing Entity or Reference (like the PO number)
- Billing address (if different)
- Billing contact (Name, email and phone) (if different)
The Admin contact will receive an email with the master API key when the account is provisoned.
Store the API key in a safe place. After using it to setup the Customer Admin account, it will be the backup access key.
Create Customer Admin user
At least one Customer Admin user needs to be created to use the Alef APIs. If desired multiple admin acounts can be created.
The Customer Admin needs to have the "role": "admin"
set in the credentials
section to be an admin user.
The password field needs to be a strong password:
- Minimal Length: 12
- Lowercase: min 1
- Uppercase: min 1
- Numbers: min 1
- Symbols: min 1
You will use the following POST
request body with the /accounts/v2/user
endpoint to create your customer Admin user.
Expand here to see the Customer Admin user POST
request body and response.
{
"contact": {
"name": "Jane Doe",
"email": "jane@doe.com",
"phone-number": "+1 1234567891"
},
"credentials": {
"username": "jane.doe",
"password": "<verysecretpassword>",
"role": "admin"
}
}
response
{
"account_id": "66992fb6310e8d77a42ed77a",
"contact": {
"name": "Jane Doe",
"email": "jane@doe.com",
"phone-number": "+1 1234567891"
},
"credentials": {
"username": "jane.doe",
"password": "<encrypted password>",
"role": "admin"
},
"_id": "669937eb310e8d77a42ed784",
"__v": 0
}
Use these account details to make all subsequent API calls using the JWT that is generated following the instructions below.
Login as Admin User
This API endpoint is used to login and and obtain the JWT token.
Expand here to see the Customer Admin user POST
login request body and response.
Payload:
curl -X 'POST' 'https://api.alefedge.com/accounts/v2/auth/login' \
-H 'Authorization: Bearer <JWT TOKEN>' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
{
"username": "jane.doe",
"password": "<verysecretpassword>",
"account_id": "66992fb6310e8d77a42ed77a"
}
Result:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5c<SHORTENED>Y6tQoNVX1BSOK8T4vg1Ns3jw"
}
The content of the "access_token"
is the JWT Token that needs to be used to authenticate your API calls.
The token has a 1 hour life time. After that you need to login and renew your token.
Validate Admin User
To see if you can succesfully login this API endpoint can be used.
Expand here to see the Admin validation GET
request and response.
curl -X 'GET' 'https://api.alefedge.com/accounts/v2/auth/profile'
-H 'Authorization: Bearer <JWT TOKEN>' \
-H 'accept: application/json' \
-H 'Content-Type: application/json'
response
{
"userid": "669937eb310e8d77a42ed784",
"username": "jane.doe",
"accountid": "66992fb6310e8d77a42ed77a",
"role": "admin",
"iat": 1721317844,
"exp": 1721321444
}