# Certificate Request Tokens
Certificate Request Tokens are used to associate devices with ControlByWeb.Cloud accounts. Certificate Request Tokens are assocaited with one account only. They expire after 12 hours and can be used to associate multiple devices to an account until the token expires.
# get tokens
# GET /v1/accounts/{AccountId}/tokens
Retrieve all of the Certificate Request Tokens associated with a given AccountId. Can only get Certificate Request Tokens for your account and child accounts.
# Parameters
Name | Type | Description |
---|---|---|
AccountId | int | Id of account requesting to get auth Tokens |
# Example
curl -X GET "https://api.controlbyweb.cloud/api/v1/accounts/{AccountId}/tokens" \
-H "Authorization: Bearer {authToken}"
# Response
{
"6": {
"token": "Vpb4pp238BDfaE9QCHZBuYJJk94kTyZz",
"expires": "2020-09-15T04:18:32.000000Z",
"created_at": "2020-09-14T16:18:32.000000Z"
}
}
# create token
Generates a Cerificate Request Token for the account with the AccountId and returns it. Can only create Certificate Request Tokens for your account and child accounts.
# POST /v1/accounts/{AccountId}/tokens/create
# Parameters
Name | Type | Description |
---|---|---|
AccountId | int | Id of account requesting to make an auth Token |
# Example
curl -X GET "https://api.controlbyweb.cloud/api/v1/accounts/{AccountId}/tokens/create" \
-H "Authorization: Bearer {authToken}"
# Response
{
"token": "Vpb4pp238BDfaE9QCHZBuYJJk94kTyZz",
"expires": "2020-09-15T04:18:32.000000Z",
"created_at": "2020-09-14T16:18:32.000000Z"
}
# delete token
Deletes the token provided on the account with the given AccountId. This will imediatly make that Certificate Request Token invalid. Can only delete Certificate Request Tokens for your account and child accounts.
# DELETE /v1/accounts/{AccountId}/tokens/{Token}
# Parameters
Name | Type | Description |
---|---|---|
AccountId | int | Id of account requesting to delete an auth Token |
Token | string | token string that is to be deleted |
# Example
curl -X DELETE "https://api.controlbyweb.cloud/api/v1/accounts/{AccountId}/tokens/{Token}" \
-H "Authorization: Bearer {authToken}"
# Response
{
"message": "success"
}
#
← Devices