Create an access token
1 min
POST
https://api.detected.app/api/v2/public/oauth/token
Body Parameters
- bodyCreateTokenRequest
- grant_typestring<app_credentials>requiredDescriptionAllowedapp_credentials
- client_idstringrequiredDescription
- client_secretstringrequiredDescription
- slugstringrequiredDescription
Responses
200
- object
- dataTokenResourceResponse
- token_typestring<Bearer>requiredDescriptionAllowedBearer
- expires_innumberrequiredDescription
- access_tokenstringrequiredDescription
Response Headers
- X-RateLimit-Limit
- X-RateLimit-Remaining
- x-ratelimit-reset
- retry-after
400
- object
- messagestringDescription
401
- object
- messagestringDescription
429
- object
- messagestringDescription
curl
curl --request POST \
--url https://api.detected.app/api/v2/public/oauth/token \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"grant_type": "",
"client_id": "",
"client_secret": "",
"slug": ""
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"grant_type": "",
"client_id": "",
"client_secret": "",
"slug": ""
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.detected.app/api/v2/public/oauth/token", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.detected.app/api/v2/public/oauth/token")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"grant_type": "",
"client_id": "",
"client_secret": "",
"slug": ""
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.detected.app/api/v2/public/oauth/token"
payload = json.dumps({
"grant_type": "",
"client_id": "",
"client_secret": "",
"slug": ""
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// OK
{
"data": {
"token_type": "",
"expires_in": 0,
"access_token": ""
}
}400
// Bad Request. The request could not be processed because it is invalid. The message field explains why.
{
"message": ""
}401
// Unauthorized. The access token is missing, invalid or has expired.
{
"message": ""
}429
// Too Many Requests. You have exceeded the rate limit. Wait for the number of seconds given in the Retry-After header before trying again.
{
"message": ""
}