curl --request GET \
--url https://api.datalyr.com/v1/keys/requests/{requestId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/keys/requests/{requestId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.datalyr.com/v1/keys/requests/{requestId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datalyr.com/v1/keys/requests/{requestId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.datalyr.com/v1/keys/requests/{requestId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.datalyr.com/v1/keys/requests/{requestId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/keys/requests/{requestId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "pending",
"scopes": [
"<string>"
],
"expires_at": "2023-11-07T05:31:56Z",
"decided_at": "2023-11-07T05:31:56Z",
"key": "<string>",
"key_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key_prefix": "<string>",
"approved_by_role": "owner"
}{
"error": "<string>"
}{
"error": "<string>"
}Poll a key request
The request’s state. Send the same credential that filed it; any other caller gets 404.
The key appears once. The first poll after a person approves mints the key and returns it in key, with status: consumed. Every later poll returns key_id and key_prefix without it. A lost response cannot be replayed: revoke the unused key in Settings and file a new request.
Poll interval. A pending answer carries Retry-After: 5. Polls spend the caller’s normal read budget.
curl --request GET \
--url https://api.datalyr.com/v1/keys/requests/{requestId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.datalyr.com/v1/keys/requests/{requestId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.datalyr.com/v1/keys/requests/{requestId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datalyr.com/v1/keys/requests/{requestId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.datalyr.com/v1/keys/requests/{requestId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.datalyr.com/v1/keys/requests/{requestId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datalyr.com/v1/keys/requests/{requestId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"status": "pending",
"scopes": [
"<string>"
],
"expires_at": "2023-11-07T05:31:56Z",
"decided_at": "2023-11-07T05:31:56Z",
"key": "<string>",
"key_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"key_prefix": "<string>",
"approved_by_role": "owner"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The request_id returned by POST /keys/requests or POST /signup.
Response
Successful response.
pending, denied, expired, consumed The request expiry while pending. The key expiry once consumed, or null for a key that does not expire.
Present when status is denied.
The plaintext dk_agent_ key. Present only in the first response after approval. We never store it and never return it again.
Present when status is consumed.
Present when status is consumed.
Present with key.
owner, admin Was this page helpful?