Select programming language for code examples

linkRequest logsBeta

Request logs are automatically populated as API requests are made to your Keygen account. Request logs can be used for monitoring and debugging purposes.

Request logs are available for all Keygen Cloud customers, as well as for all Keygen EE customers. Request logs are not available in Keygen CE. If you're running Keygen CE and would like to try request logs, reach out for a 30-day no-strings-attached trial of Keygen EE.

This feature is currently in beta. Please reach out to gain access to the beta program, or to report any feedback or issues. All functionality is subject to change until the beta designation is removed from the feature.

linkThe request log object

Below you will find the various attributes for the request log resource. Each API request will be tagged with a unique UUID which can be used to lookup a particular request log for debugging purposes.

By default, request logs are kept for a maximum of 30 days.

linkAttributes

  • linkdata.attributes.url

    stringread only

    The url that the request was for.

  • linkdata.attributes.method

    stringread only

    The HTTP method that the request used.

  • linkdata.attributes.status

    stringread only

    The HTTP status of the response.

  • linkdata.attributes.userAgent

    stringread only

    The user agent sent with the request.

  • linkdata.attributes.ip

    stringread only

    The IP address of the request.

  • linkdata.attributes.requestHeaders

    object<string, string>read only

    The headers of the request. This includes only a subset of headers.

  • linkdata.attributes.requestBody

    stringread only

    The body of the request.

  • linkdata.attributes.responseHeaders

    object<string, string>read only

    The headers of the response. This includes only a subset of headers.

  • linkdata.attributes.responseBody

    stringread only

    The body of the response.

  • linkdata.attributes.responseSignature

    stringread only

    The signature of the response.

  • linkdata.attributes.created

    timestamp (iso8601)read only

    When the request was made.

  • linkdata.attributes.updated

    timestamp (iso8601)read only

    When the request log was last updated.

linkRelationships

  • linkdata.relationships.account

    individual

    The account that the request was for.

  • linkdata.relationships.environment

    individualent onlyThese relationships are only available for accounts on an Ent tier.

    The environment that the request was for.

  • linkdata.relationships.requestor

    individual

    Who made the request.

Example object

{
"data": {
"id": "51bf85b8-85f1-4665-977d-69adb46915b5",
"type": "request-logs",
"attributes": {
"url": "/v1/accounts/<account>/machines",
"method": "POST",
"status": "422",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
"ip": "192.168.1.1",
"requestHeaders": {
"Host": "api.keygen.sh",
"Accept": "application/json",
"Content-Type": "application/json",
"Content-Length": "298"
},
"requestBody": "{\"data\":{\"type\":\"machine\",\"attributes\":{\"fingerprint\":\"0c:5a:23:ef:05:42:45:70:87:a2:c5:a0:b7:cb:d0:6a\",\"name\":\"Work Surface\",\"platform\":\"Windows 10\",\"metadata\":{\"browser\":\"chrome\",\"version\":\"125.0.0\"}},\"relationships\":{\"license\":{\"data\":{\"type\":\"license\",\"id\":\"1a8845c8-ff5d-4dab-a805-5b58efe0c9d2\"}}}}}",
"responseSignature": "keyid=\"<account>\", algorithm=\"ed25519\", signature=\"sgCO/65/JxiNdM68gNp/uUkNYf9UDpP262YSbzprXMNKoqHcgmqgzsOn+KsYrvGXgVMuxMKqEQu7FpNCK86QDQ==\", headers=\"(request-target) host date digest\"",
"responseHeaders": {
"Date": "Tue, 04 Jun 2024 16:18:36 GMT",
"Digest": "sha-256=jexOw5i/zQJbcv8WOVcHkOQ2lnRc1dJH+GoVNaR8G4U=",
"Keygen-Date": "Tue, 04 Jun 2024 16:18:36 GMT",
"Keygen-Mode": "multiplayer",
"Content-Type": "application/json; charset=utf-8",
"Keygen-Digest": "sha-256=jexOw5i/zQJbcv8WOVcHkOQ2lnRc1dJH+GoVNaR8G4U=",
"Keygen-Edition": "EE",
"Keygen-License": "id=\"645993cd-e5f4-40e4-8a43-b35cefd04a8d\", iss=\"2023-03-15 20:03:03 UTC\", exp=\"\"",
"Keygen-Version": "1.2",
"Keygen-Signature": "keyid=\"<account>\", algorithm=\"ed25519\", signature=\"sgCO/65/JxiNdM68gNp/uUkNYf9UDpP262YSbzprXMNKoqHcgmqgzsOn+KsYrvGXgVMuxMKqEQu7FpNCK86QDQ==\", headers=\"(request-target) host date digest\""
},
"responseBody": "{\"errors\":[{\"title\":\"Unprocessable resource\",\"detail\":\"machine count has exceeded maximum allowed for license (10)\",\"code\":\"MACHINE_LIMIT_EXCEEDED\",\"source\":{\"pointer\":\"/data\"},\"links\":{\"about\":\"https://keygen.sh/docs/api/machines/#machines-object\"}}],\"meta\":{\"id\":\"51bf85b8-85f1-4665-977d-69adb46915b5\"}}",
"created": "2024-06-04T16:18:36.789Z",
"updated": "2024-06-04T16:18:36.829Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"environment": {
"links": {
"related": null
},
"data": null
},
"requestor": {
"links": {
"related": "/v1/accounts/<account>/licenses/1a8845c8-ff5d-4dab-a805-5b58efe0c9d2"
},
"data": {
"type": "licenses",
"id": "1a8845c8-ff5d-4dab-a805-5b58efe0c9d2"
}
}
},
"links": {
"self": "/v1/accounts/<account>/request-logs/51bf85b8-85f1-4665-977d-69adb46915b5"
}
}
}

linkRetrieve a request log

Retrieves the details of an existing request log.

linkAuthentication

  • linkBearer

    optional

    An authentication token with privileges to read the request log: an admin or an environment.

linkURL Parameters

  • link<account>

    stringrequired

    The identifier (UUID) or slug of your Keygen account.

  • link<request>

    stringrequired

    The identifier (UUID) of the request log to be retrieved.

linkReturns

A 200 OK response will be returned along with an request log object.

Upon error, an errors object will be returned along with an HTTP status code indicating the type of error. When an error occurs, the data property will not be included.

Definition

https://api.keygen.sh/v1/accounts/<account>/request-logs/<request>

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/request-logs", {
method: "GET",
headers: {
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.get(
"https://api.keygen.sh/v1/accounts/<account>/request-logs",
headers={
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/request-logs",
headers: [
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
]
).responseJSON { response in
let json = JSON(data: response.data!)
}
using RestSharp;
 
var client = new RestClient("https://api.keygen.sh/v1/accounts/<account>");
var request = new RestRequest(
"request-logs",
Method.GET
);
 
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Accept", "application/vnd.api+json");
 
var response = client.Execute(request);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
 
val res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/request-logs")
.header("Authorization", "Bearer <token>")
.header("Accept", "application/vnd.api+json")
.asJson()
import com.mashape.unirest.http.exceptions.*;
import com.mashape.unirest.http.*;
 
HttpResponse<JsonNode> res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/request-logs")
.header("Authorization", "Bearer <token>")
.header("Accept", "application/vnd.api+json")
.asJson();
#include <iostream>
#include <string>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
 
using namespace std;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace utility;
 
http_client client("https://api.keygen.sh/v1/accounts/<account>");
http_request req;
 
req.headers().add("Authorization", "Bearer <token>");
req.headers().add("Accept", "application/json");
 
req.set_request_uri("/request-logs");
req.set_method(methods::GET);
 
client.request(req)
.then([](http_response res) {
auto data = res.extract_json().get();
})
.wait();
curl https://api.keygen.sh/v1/accounts/<account>/request-logs \
-H 'Authorization: Bearer <token>' \
-H 'Accept: application/vnd.api+json'

Example response / 200 OK

{
"data": {
"id": "51bf85b8-85f1-4665-977d-69adb46915b5",
"type": "request-logs",
"attributes": {
"url": "/v1/accounts/<account>/machines",
"method": "POST",
"status": "422",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
"ip": "192.168.1.1",
"requestHeaders": {
"Host": "api.keygen.sh",
"Accept": "application/json",
"Content-Type": "application/json",
"Content-Length": "298"
},
"requestBody": "{\"data\":{\"type\":\"machine\",\"attributes\":{\"fingerprint\":\"6a8e6304-9184-465a-9273-b7f9d4981f12\",\"name\":\"Demo Device 3e73f\",\"platform\":\"Windows 10\",\"metadata\":{\"browser\":\"chrome\",\"version\":\"125.0.0\"}},\"relationships\":{\"license\":{\"data\":{\"type\":\"license\",\"id\":\"1a8845c8-ff5d-4dab-a805-5b58efe0c9d2\"}}}}}",
"responseSignature": "keyid=\"<account>\", algorithm=\"ed25519\", signature=\"sgCO/65/JxiNdM68gNp/uUkNYf9UDpP262YSbzprXMNKoqHcgmqgzsOn+KsYrvGXgVMuxMKqEQu7FpNCK86QDQ==\", headers=\"(request-target) host date digest\"",
"responseHeaders": {
"Date": "Tue, 04 Jun 2024 16:18:36 GMT",
"Digest": "sha-256=jexOw5i/zQJbcv8WOVcHkOQ2lnRc1dJH+GoVNaR8G4U=",
"Keygen-Date": "Tue, 04 Jun 2024 16:18:36 GMT",
"Keygen-Mode": "multiplayer",
"Content-Type": "application/json; charset=utf-8",
"Keygen-Digest": "sha-256=jexOw5i/zQJbcv8WOVcHkOQ2lnRc1dJH+GoVNaR8G4U=",
"Keygen-Edition": "EE",
"Keygen-License": "id=\"645993cd-e5f4-40e4-8a43-b35cefd04a8d\", iss=\"2023-03-15 20:03:03 UTC\", exp=\"\"",
"Keygen-Version": "1.2",
"Keygen-Signature": "keyid=\"<account>\", algorithm=\"ed25519\", signature=\"sgCO/65/JxiNdM68gNp/uUkNYf9UDpP262YSbzprXMNKoqHcgmqgzsOn+KsYrvGXgVMuxMKqEQu7FpNCK86QDQ==\", headers=\"(request-target) host date digest\""
},
"responseBody": "{\"errors\":[{\"title\":\"Unprocessable resource\",\"detail\":\"machine count has exceeded maximum allowed for license (10)\",\"code\":\"MACHINE_LIMIT_EXCEEDED\",\"source\":{\"pointer\":\"/data\"},\"links\":{\"about\":\"https://keygen.sh/docs/api/machines/#machines-object\"}}],\"meta\":{\"id\":\"51bf85b8-85f1-4665-977d-69adb46915b5\"}}",
"created": "2024-06-04T16:18:36.789Z",
"updated": "2024-06-04T16:18:36.829Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"environment": {
"links": {
"related": null
},
"data": null
},
"requestor": {
"links": {
"related": "/v1/accounts/<account>/licenses/1a8845c8-ff5d-4dab-a805-5b58efe0c9d2"
},
"data": {
"type": "licenses",
"id": "1a8845c8-ff5d-4dab-a805-5b58efe0c9d2"
}
}
},
"links": {
"self": "/v1/accounts/<account>/request-logs/51bf85b8-85f1-4665-977d-69adb46915b5"
}
}
}

linkList all request logs

Returns a list of request logs. The request logs are returned sorted by creation date, with the most recent request logs appearing first.

When listing request logs, the requestBody and responseBody attributes will be set to null. To obtain the attribute values, retrieve the request log object by its ID.

linkAuthentication

  • linkBearer

    optional

    An authentication token with privileges to read the request logs: an admin or an environment.

linkURL Parameters

  • link<account>

    stringrequired

    The identifier (UUID) or slug of your Keygen account.

linkQuery Parameters

  • linkdate

    object<string, timestamp>

    Object containing start and end dates. Must be ISO8601 format.

    /v1/accounts/<account>/request-logs?date[start]=2023-09-12T00:00:00.002Z&date[end]=2023-09-12T23:59:59.992Z
  • linklimit

    integerdefault=10

    A limit on the number of request logs to be returned. Limit must be a number between 1 and 100.

    /v1/accounts/<account>/request-logs?limit=25
  • linkpage

    object<string, integer>

    Object containing page size and page number. Page size must be a number between 1 and 100.

    /v1/accounts/<account>/request-logs?page[size]=15&page[number]=2
  • linkrequestor

    object<string, string>

    The requestor to filter by. Type can be user, environment, product, or license.

    /v1/accounts/<account>/request-logs?requestor[type]=license&requestor[id]=1a8845c8-ff5d-4dab-a805-5b58efe0c9d2
  • linkevent

    string

    The event to filter by.

    /v1/accounts/<account>/request-logs?event=license.validation.failed
  • linkurl

    string

    The URL path to filter by.

    /v1/accounts/<account>/request-logs?url=/v1/accounts/<account>/licenses/actions/validate-key
  • linkip

    string

    The IP address to filter by.

    /v1/accounts/<account>/request-logs?ip=192.168.1.1
  • linkmethod

    string

    The HTTP method to filter by.

    /v1/accounts/<account>/request-logs?method=POST
  • linkstatus

    string

    The HTTP status to filter by.

    /v1/accounts/<account>/request-logs?status=400

linkReturns

A 200 OK response will be returned along with a list of request log objects.

Upon error, an errors object will be returned along with an HTTP status code indicating the type of error. When an error occurs, the data property will not be included.

Definition

https://api.keygen.sh/v1/accounts/<account>/request-logs

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/request-logs?limit=15", {
method: "GET",
headers: {
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.get(
"https://api.keygen.sh/v1/accounts/<account>/request-logs?limit=15",
headers={
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/request-logs?limit=15",
headers: [
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
]
).responseJSON { response in
let json = JSON(data: response.data!)
}
using RestSharp;
 
var client = new RestClient("https://api.keygen.sh/v1/accounts/<account>");
var request = new RestRequest("request-logs", Method.GET);
 
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Accept", "application/vnd.api+json");
 
request.AddParameter("limit", 15);
 
var response = client.Execute(request);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
 
val res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/request-logs")
.header("Authorization", "Bearer <token>")
.header("Accept", "application/vnd.api+json")
.queryString("limit", 15)
.asJson()
import com.mashape.unirest.http.exceptions.*;
import com.mashape.unirest.http.*;
 
HttpResponse<JsonNode> res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/request-logs")
.header("Authorization", "Bearer <token>")
.header("Accept", "application/vnd.api+json")
.queryString("limit", 15)
.asJson();
#include <iostream>
#include <string>
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
 
using namespace std;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace utility;
 
http_client client("https://api.keygen.sh/v1/accounts/<account>");
http_request req;
 
req.headers().add("Authorization", "Bearer <token>");
req.headers().add("Accept", "application/json");
 
uri_builder uri("/request-logs");
uri.append_query("limit", 15);
 
req.set_request_uri(uri.to_uri());
req.set_method(methods::GET);
 
client.request(req)
.then([](http_response res) {
auto data = res.extract_json().get();
})
.wait();
curl https://api.keygen.sh/v1/accounts/<account>/request-logs?limit=15 -g \
-H 'Authorization: Bearer <token>' \
-H 'Accept: application/vnd.api+json'

Example response / 200 OK

{
"data": [
{
"id": "51bf85b8-85f1-4665-977d-69adb46915b5",
"type": "request-logs",
"attributes": {
"url": "/v1/accounts/<account>/machines",
"method": "POST",
"status": "422",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
"ip": "192.168.1.1",
"requestHeaders": {
"Host": "api.keygen.sh",
"Accept": "application/json",
"Content-Type": "application/json",
"Content-Length": "298"
},
"requestBody": "{\"data\":{\"type\":\"machine\",\"attributes\":{\"fingerprint\":\"6a8e6304-9184-465a-9273-b7f9d4981f12\",\"name\":\"Demo Device 3e73f\",\"platform\":\"Windows 10\",\"metadata\":{\"browser\":\"chrome\",\"version\":\"125.0.0\"}},\"relationships\":{\"license\":{\"data\":{\"type\":\"license\",\"id\":\"1a8845c8-ff5d-4dab-a805-5b58efe0c9d2\"}}}}}",
"responseSignature": "keyid=\"<account>\", algorithm=\"ed25519\", signature=\"sgCO/65/JxiNdM68gNp/uUkNYf9UDpP262YSbzprXMNKoqHcgmqgzsOn+KsYrvGXgVMuxMKqEQu7FpNCK86QDQ==\", headers=\"(request-target) host date digest\"",
"responseHeaders": {
"Date": "Tue, 04 Jun 2024 16:18:36 GMT",
"Digest": "sha-256=jexOw5i/zQJbcv8WOVcHkOQ2lnRc1dJH+GoVNaR8G4U=",
"Keygen-Date": "Tue, 04 Jun 2024 16:18:36 GMT",
"Keygen-Mode": "multiplayer",
"Content-Type": "application/json; charset=utf-8",
"Keygen-Digest": "sha-256=jexOw5i/zQJbcv8WOVcHkOQ2lnRc1dJH+GoVNaR8G4U=",
"Keygen-Edition": "EE",
"Keygen-License": "id=\"645993cd-e5f4-40e4-8a43-b35cefd04a8d\", iss=\"2023-03-15 20:03:03 UTC\", exp=\"\"",
"Keygen-Version": "1.2",
"Keygen-Signature": "keyid=\"<account>\", algorithm=\"ed25519\", signature=\"sgCO/65/JxiNdM68gNp/uUkNYf9UDpP262YSbzprXMNKoqHcgmqgzsOn+KsYrvGXgVMuxMKqEQu7FpNCK86QDQ==\", headers=\"(request-target) host date digest\""
},
"responseBody": "{\"errors\":[{\"title\":\"Unprocessable resource\",\"detail\":\"machine count has exceeded maximum allowed for license (10)\",\"code\":\"MACHINE_LIMIT_EXCEEDED\",\"source\":{\"pointer\":\"/data\"},\"links\":{\"about\":\"https://keygen.sh/docs/api/machines/#machines-object\"}}],\"meta\":{\"id\":\"51bf85b8-85f1-4665-977d-69adb46915b5\"}}",
"created": "2024-06-04T16:18:36.789Z",
"updated": "2024-06-04T16:18:36.829Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"environment": {
"links": {
"related": null
},
"data": null
},
"requestor": {
"links": {
"related": "/v1/accounts/<account>/licenses/1a8845c8-ff5d-4dab-a805-5b58efe0c9d2"
},
"data": {
"type": "licenses",
"id": "1a8845c8-ff5d-4dab-a805-5b58efe0c9d2"
}
}
},
"links": {
"self": "/v1/accounts/<account>/request-logs/51bf85b8-85f1-4665-977d-69adb46915b5"
}
},
...
]
}