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.requestBody

    stringread only

    The body of the request.

  • 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.

  • linkdata.relationships.resource

    individual

    What resource the request was for.

Example object

{
"data": {
"id": "b7ac5761-b9ce-47dc-a412-cae22d66f21e",
"type": "request-logs",
"attributes": {
"url": "/v1/accounts/<account>/licenses/actions/validate-key",
"method": "POST",
"status": "200",
"userAgent": "RestSharp/107.1.1.0",
"ip": "192.168.1.1",
"requestBody": "{\"meta\":{\"key\":\"0BB042-E1A90B-A5DC67-D651E0-73E6C5-V3\",\"scope\":{\"fingerprint\":\"AB:CD:EF:GH:IJ:KL:MN:OP\"}}}",
"responseSignature": "keyid=\"<account>\", algorithm=\"ed25519\", signature=\"HL8S3tQQQT//21Z/8WcvFgP/U0vQxPIj1e+8Q43vWaC4oDCpqyp+yR+jVLgbL6aEadgf6fmGu1gm++F+1R0ECA==\", headers=\"(request-target) host date digest\"",
"responseBody": "{\"data\":{\"id\":\"c460da8d-1b5a-44f7-8a74-9eec429876ec\",\"type\":\"licenses\",\"attributes\":{\"name\":\"Activation Example\",\"key\":\"0BB042-E1A90B-A5DC67-D651E0-73E6C5-V3\",\"expiry\":\"2030-01-01T00:00:00.000Z\",\"status\":\"ACTIVE\",\"uses\":0,\"suspended\":false,\"scheme\":null,\"encrypted\":false,\"strict\":false,\"floating\":false,\"protected\":true,\"version\":null,\"maxMachines\":1,\"maxProcesses\":null,\"maxCores\":null,\"maxUses\":null,\"requireHeartbeat\":false,\"requireCheckIn\":false,\"lastValidated\":\"2023-09-12T15:21:13.238Z\",\"lastCheckIn\":null,\"nextCheckIn\":null,\"lastCheckOut\":null,\"metadata\":{},\"created\":\"2020-09-16T14:06:04.012Z\",\"updated\":\"2023-09-12T15:21:13.255Z\"},\"relationships\":{\"account\":{\"links\":{\"related\":\"/v1/accounts/<account>\"},\"data\":{\"type\":\"accounts\",\"id\":\"<account>\"}},\"environment\":{\"links\":{\"related\":null},\"data\":null},\"product\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/product\"},\"data\":{\"type\":\"products\",\"id\":\"6b5bb5a3-0e32-4226-88fd-86a97ecd0678\"}},\"policy\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/policy\"},\"data\":{\"type\":\"policies\",\"id\":\"f331c902-561b-4d44-add9-ed938c272ca5\"}},\"group\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/group\"},\"data\":null},\"user\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/user\"},\"data\":null},\"machines\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/machines\"},\"meta\":{\"cores\":0,\"count\":14}},\"tokens\":\"[FILTERED]\",\"entitlements\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/entitlements\"}}},\"links\":{\"self\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec\"}},\"meta\":{\"ts\":\"2023-09-12T15:21:13.258Z\",\"valid\":true,\"detail\":\"is valid\",\"code\":\"VALID\",\"scope\":{\"fingerprint\":\"AB:CD:EF:GH:IJ:KL:MN:OP\"}}}",
"created": "2023-09-12T15:21:13.302Z",
"updated": "2023-09-12T15:21:13.311Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"environment": {
"links": {
"related": null
},
"data": null
},
"requestor": {
"data": null
},
"resource": {
"links": {
"related": "/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec"
},
"data": {
"type": "licenses",
"id": "c460da8d-1b5a-44f7-8a74-9eec429876ec"
}
}
},
"links": {
"self": "/v1/accounts/<account>/request-logs/b7ac5761-b9ce-47dc-a412-cae22d66f21e"
}
}
}

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": "b7ac5761-b9ce-47dc-a412-cae22d66f21e",
"type": "request-logs",
"attributes": {
"url": "/v1/accounts/<account>/licenses/actions/validate-key",
"method": "POST",
"status": "200",
"userAgent": "RestSharp/107.1.1.0",
"ip": "192.168.1.1",
"requestBody": "{\"meta\":{\"key\":\"0BB042-E1A90B-A5DC67-D651E0-73E6C5-V3\",\"scope\":{\"fingerprint\":\"AB:CD:EF:GH:IJ:KL:MN:OP\"}}}",
"responseSignature": "keyid=\"<account>\", algorithm=\"ed25519\", signature=\"HL8S3tQQQT//21Z/8WcvFgP/U0vQxPIj1e+8Q43vWaC4oDCpqyp+yR+jVLgbL6aEadgf6fmGu1gm++F+1R0ECA==\", headers=\"(request-target) host date digest\"",
"responseBody": "{\"data\":{\"id\":\"c460da8d-1b5a-44f7-8a74-9eec429876ec\",\"type\":\"licenses\",\"attributes\":{\"name\":\"Activation Example\",\"key\":\"0BB042-E1A90B-A5DC67-D651E0-73E6C5-V3\",\"expiry\":\"2030-01-01T00:00:00.000Z\",\"status\":\"ACTIVE\",\"uses\":0,\"suspended\":false,\"scheme\":null,\"encrypted\":false,\"strict\":false,\"floating\":false,\"protected\":true,\"version\":null,\"maxMachines\":1,\"maxProcesses\":null,\"maxCores\":null,\"maxUses\":null,\"requireHeartbeat\":false,\"requireCheckIn\":false,\"lastValidated\":\"2023-09-12T15:21:13.238Z\",\"lastCheckIn\":null,\"nextCheckIn\":null,\"lastCheckOut\":null,\"metadata\":{},\"created\":\"2020-09-16T14:06:04.012Z\",\"updated\":\"2023-09-12T15:21:13.255Z\"},\"relationships\":{\"account\":{\"links\":{\"related\":\"/v1/accounts/<account>\"},\"data\":{\"type\":\"accounts\",\"id\":\"<account>\"}},\"environment\":{\"links\":{\"related\":null},\"data\":null},\"product\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/product\"},\"data\":{\"type\":\"products\",\"id\":\"6b5bb5a3-0e32-4226-88fd-86a97ecd0678\"}},\"policy\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/policy\"},\"data\":{\"type\":\"policies\",\"id\":\"f331c902-561b-4d44-add9-ed938c272ca5\"}},\"group\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/group\"},\"data\":null},\"user\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/user\"},\"data\":null},\"machines\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/machines\"},\"meta\":{\"cores\":0,\"count\":14}},\"tokens\":\"[FILTERED]\",\"entitlements\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/entitlements\"}}},\"links\":{\"self\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec\"}},\"meta\":{\"ts\":\"2023-09-12T15:21:13.258Z\",\"valid\":true,\"detail\":\"is valid\",\"code\":\"VALID\",\"scope\":{\"fingerprint\":\"AB:CD:EF:GH:IJ:KL:MN:OP\"}}}",
"created": "2023-09-12T15:21:13.302Z",
"updated": "2023-09-12T15:21:13.311Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"environment": {
"links": {
"related": null
},
"data": null
},
"requestor": {
"data": null
},
"resource": {
"links": {
"related": "/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec"
},
"data": {
"type": "licenses",
"id": "c460da8d-1b5a-44f7-8a74-9eec429876ec"
}
}
},
"links": {
"self": "/v1/accounts/<account>/request-logs/b7ac5761-b9ce-47dc-a412-cae22d66f21e"
}
}
}

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
  • 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": "b7ac5761-b9ce-47dc-a412-cae22d66f21e",
"type": "request-logs",
"attributes": {
"url": "/v1/accounts/<account>/licenses/actions/validate-key",
"method": "POST",
"status": "200",
"userAgent": "RestSharp/107.1.1.0",
"ip": "192.168.1.1",
"requestBody": "{\"meta\":{\"key\":\"0BB042-E1A90B-A5DC67-D651E0-73E6C5-V3\",\"scope\":{\"fingerprint\":\"AB:CD:EF:GH:IJ:KL:MN:OP\"}}}",
"responseSignature": "keyid=\"<account>\", algorithm=\"ed25519\", signature=\"HL8S3tQQQT//21Z/8WcvFgP/U0vQxPIj1e+8Q43vWaC4oDCpqyp+yR+jVLgbL6aEadgf6fmGu1gm++F+1R0ECA==\", headers=\"(request-target) host date digest\"",
"responseBody": "{\"data\":{\"id\":\"c460da8d-1b5a-44f7-8a74-9eec429876ec\",\"type\":\"licenses\",\"attributes\":{\"name\":\"Activation Example\",\"key\":\"0BB042-E1A90B-A5DC67-D651E0-73E6C5-V3\",\"expiry\":\"2030-01-01T00:00:00.000Z\",\"status\":\"ACTIVE\",\"uses\":0,\"suspended\":false,\"scheme\":null,\"encrypted\":false,\"strict\":false,\"floating\":false,\"protected\":true,\"version\":null,\"maxMachines\":1,\"maxProcesses\":null,\"maxCores\":null,\"maxUses\":null,\"requireHeartbeat\":false,\"requireCheckIn\":false,\"lastValidated\":\"2023-09-12T15:21:13.238Z\",\"lastCheckIn\":null,\"nextCheckIn\":null,\"lastCheckOut\":null,\"metadata\":{},\"created\":\"2020-09-16T14:06:04.012Z\",\"updated\":\"2023-09-12T15:21:13.255Z\"},\"relationships\":{\"account\":{\"links\":{\"related\":\"/v1/accounts/<account>\"},\"data\":{\"type\":\"accounts\",\"id\":\"<account>\"}},\"environment\":{\"links\":{\"related\":null},\"data\":null},\"product\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/product\"},\"data\":{\"type\":\"products\",\"id\":\"6b5bb5a3-0e32-4226-88fd-86a97ecd0678\"}},\"policy\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/policy\"},\"data\":{\"type\":\"policies\",\"id\":\"f331c902-561b-4d44-add9-ed938c272ca5\"}},\"group\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/group\"},\"data\":null},\"user\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/user\"},\"data\":null},\"machines\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/machines\"},\"meta\":{\"cores\":0,\"count\":14}},\"tokens\":\"[FILTERED]\",\"entitlements\":{\"links\":{\"related\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec/entitlements\"}}},\"links\":{\"self\":\"/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec\"}},\"meta\":{\"ts\":\"2023-09-12T15:21:13.258Z\",\"valid\":true,\"detail\":\"is valid\",\"code\":\"VALID\",\"scope\":{\"fingerprint\":\"AB:CD:EF:GH:IJ:KL:MN:OP\"}}}",
"created": "2023-09-12T15:21:13.302Z",
"updated": "2023-09-12T15:21:13.311Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"environment": {
"links": {
"related": null
},
"data": null
},
"requestor": {
"data": null
},
"resource": {
"links": {
"related": "/v1/accounts/<account>/licenses/c460da8d-1b5a-44f7-8a74-9eec429876ec"
},
"data": {
"type": "licenses",
"id": "c460da8d-1b5a-44f7-8a74-9eec429876ec"
}
}
},
"links": {
"self": "/v1/accounts/<account>/request-logs/b7ac5761-b9ce-47dc-a412-cae22d66f21e"
}
},
...
]
}