New Invite
Request URL
POST /invite/new
Description
This API is used by an account holder to share his/her own account with another user. The response contains an invite object that can be shared with another user, enabling that user to access the account.
The optional role
property specifies the role the invited user will have for this account. The optional firstName
and lastName
properties give the name of the invitee. The AFiAccountId
and AFiCardId
specify the account/card that is to be shared.
Schema
Property table for invite/new
Property | Description | Required | Schema |
---|---|---|---|
AFiAccountId | ampliFi ID for the account | Yes | { "type": "string" } |
AFiCardId | ampliFi ID for the card | No | { "type": "string", "nullable": true } |
role | Role for invitee when accessing the account | No | { "type": "string", "nullable": true } |
firstName | First name | No | { "type": "string", "nullable": true } |
lastName | Last name | No | { "type": "string", "nullable": true } |
Request Body
{
"AFiAccountId": "qwegal8kgtmysmels",
"AFiCardId": "qwegal8kgtmysmels",
"role": "test",
"firstName": "Suzy",
"lastName": "Queue"
}
Snippet Examples
javascript
const axios = require('axios');
const data = {
"AFiAccountId": "qwegal8kgtmysmels",
"AFiCardId": "qwegal8kgtmysmels",
"role": "test",
"firstName": "Suzy",
"lastName": "Queue"
};
const config = {
method: 'POST',
url: '${AMPLIFI_BASE_URL}/invite/new',
headers: {
'Content-Type': "application/json",
'token': "A long random string token received from /token request"
},
data
};
let result;
try {
result = await axios.request(config);
if (result.status === 200) {
console.log(JSON.stringify(result.data));
}
} catch (err) {
console.log({
errCode: err.code,
responseStatus: err.response && err.response.status,
data: err.response && JSON.stringify(err.response.data)
});
}
cURL
curl --location "AMPLIFI_BASE_URL/invite/new" --data "{ \"AFiAccountId\":\"qwegal8kgtmysmels\", \"AFiCardId\":\"qwegal8kgtmysmels\", \"role\":\"test\", \"firstName\":\"Suzy\", \"lastName\":\"Queue\"}" --header "Content-Type: application/json" --header "token: A long random string token received from /token request"
Successful Response Examples
200 INVITE/NEW SUCCESSFUL RESPONSE CREATING AN INVITE
HEADERS
Header | Value |
---|---|
Content-Type | application/json |
token | A long random string token received from /token request |
REQUEST BODY
{
"AFiAccountId": "qwegalq11xn6prxjp",
"AFiCardId": "qwegalq11xn6prxjp",
"role": "test",
"firstName": "Suzy",
"lastName": "Queue"
}
RESPONSE BODY
{
"success": true,
"invite": {
"AFiInviteId": "qwekavyuhdturheezbubxgyyrogxkscffnctsvbeuux",
"AFiUserId": "qweaurl8kgtlv9pc",
"AFiAccountId": "qwegalq11xn6prxjp",
"AFiCardId": "qwegalq11xn6prxjp",
"role": "test",
"linklink": "AAYTXZOUQ",
"firstName": "Suzy",
"lastName": "Queue",
"dtsCreated": "2023-12-15T12:19:25.561Z",
"dtsExpiry": "2023-12-17T12:19:25.562Z",
"isActive": true,
"_id": "657c444dfb05160548de3802"
}
}