Send ekey
https://euapi.ttlock.com/v3/key/send
The ekey receiver can login TTLock APP to get the ekey send by lock administrator.
If the developer want to develop your own APP based on our APP SDK,the ekey can be requested by cloud API: Get the eKey list of an account with access token get by receiverUsername and it's passowrd.
receiverUsername should be account registered in TTLock APP or user registered by cloud API: User register.
If receiverUsername is a mobile phone number or email account which is not registered yet, you can request with parameter createUser=1, the cloud will automatically create an user account for it, the default password of the account is the last six char of receiverUsername , for example: receiverUsername=+158876191905, it's default password will be 191905.
A user account can only have one ekey for a lock, so if you send ekey to a user already have this lock's ekey, the old ekey will be deleted.
Send ekey to oneself or top administrator is forbidden.
1 Request example
POST, ContentType:application/x-www-form-urlencoded
curl --location -g --request POST 'https://euapi.ttlock.com/v3/key/send' \
--data-urlencode 'clientId=4773aa036f7f49c68d876bb4be85c80c' \
--data-urlencode 'accessToken=dfd5489d0cee31f0bdfaf59d0d42d71f' \
--data-urlencode 'lockId=163377' \
--data-urlencode 'receiverUsername=18876191905' \
--data-urlencode 'keyName=Ekey for jack' \
--data-urlencode 'startDate=1625025703000' \
--data-urlencode 'endDate=1635025703000' \
--data-urlencode 'createUser=1' \
--data-urlencode 'remarks=Have a nice day.' \
--data-urlencode 'date=1625025703000'2 Request parameters
| Name | Type | Required | Description |
|---|---|---|---|
| clientId | String | Y | client_id from Create application |
| accessToken | String | Y | Access token,refer to: Get access token |
| lockId | Int | Y | Lock ID, generated by Lock init |
| receiverUsername | String | Y | The receiver's username |
| keyName | String | Y | Key name |
| startDate | Long | Y | The time when it becomes valid (timestamp in millisecond) |
| endDate | Long | Y | The time when it is expired (timestamp in millisecond) |
| remarks | String | N | Comment |
| remoteEnable | Int | N | Is remote unlock enabled: 1-yes, 2-no |
| keyRight | Int | N | Is an authorized ekey: 1-yes, 0-no,the default value is 0 |
| createUser | Int | N | Auto create TTLock account if receiverUsername is not a registered TTLock account: 1-yes, 2-no (default), this parameter take effect only when receiverUsername is a mobile number or email, the created account's password is the last six characters of the username. |
| date | Long | Y | Current time (timestamp in millisecond) |
3 Response and example
| Parameter | Type | Description |
|---|---|---|
| keyId | Int | Ekey ID |
{
"keyId": 56323
}