Get an access token
curl --request POST \
--url https://partners-api.sandbox.securitize.io/oauth2/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=your-client-id \
--data client_secret=your-client-secretconst options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: 'your-client-id',
client_secret: 'your-client-secret'
})
};
fetch('https://partners-api.sandbox.securitize.io/oauth2/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://partners-api.sandbox.securitize.io/oauth2/token"
payload = {
"grant_type": "client_credentials",
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text){
"token_type": "bearer",
"access_token": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6",
"expires_in": 7200
}{
"error_description": "Invalid client authentication",
"error": "invalid_client"
}Authentication
Get an access token
Exchanges the client id and secret Securitize issued you for a bearer token, with the OAuth 2.0 client credentials grant. Send the token in the Authorization: Bearer header of every other operation.
The token endpoint sits at the host root, not under the base URL. The token lasts 2 hours (expires_in, in seconds): cache it and get a new one shortly before it expires, or on the first 401. No scope is needed.
To try the other operations here, run this one with your sandbox credentials and client_credentials as grant_type, and paste the access_token into their authorization field.
POST
/
oauth2
/
token
Get an access token
curl --request POST \
--url https://partners-api.sandbox.securitize.io/oauth2/token \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data client_id=your-client-id \
--data client_secret=your-client-secretconst options = {
method: 'POST',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: new URLSearchParams({
grant_type: 'client_credentials',
client_id: 'your-client-id',
client_secret: 'your-client-secret'
})
};
fetch('https://partners-api.sandbox.securitize.io/oauth2/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://partners-api.sandbox.securitize.io/oauth2/token"
payload = {
"grant_type": "client_credentials",
"client_id": "your-client-id",
"client_secret": "your-client-secret"
}
headers = {"Content-Type": "application/x-www-form-urlencoded"}
response = requests.post(url, data=payload, headers=headers)
print(response.text){
"token_type": "bearer",
"access_token": "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6",
"expires_in": 7200
}{
"error_description": "Invalid client authentication",
"error": "invalid_client"
}Body
application/x-www-form-urlencoded
The OAuth 2.0 client credentials grant, as application/x-www-form-urlencoded.