Select programming language for code examples

linkComponents

Utilizing components, you can manage hardware components for machines. For example, you could fingerprint and track hardware (and even non-hardware) components such as CPU serial number, motherboard serial number, hard-drive ID, GPU GUID, MAC address, or even non-hardware components such as IP address.

This allows you to offer a more sophisticated fingerprinting strategy for machines, where a certain percentage of these components must be valid in order to pass license validation, configuable through the policy's component matching strategy.

This can help reduce problems related to cloning, e.g. a series of machines all have the same device GUID due to a misconfigured or erroneous cloning procedure, by also checking hardware components in addition to the original device GUID.

It can also reduce superfluous activations due to a more typical machine fingerprint changing due to a machine's underlying hardware being upgraded.

linkThe component object

Below you will find the various attributes for the component resource, as well as the component resource's relationships. Components can be used to track and manage a machine's hardware components.

linkAttributes

  • linkdata.attributes.fingerprint

    string

    The unique fingerprint of the component, e.g. a motherboard serial number. This can be an arbitrary string, but must be unique within the scope of the machine it belongs to or according to the policy's component uniqueness strategy.

  • linkdata.attributes.name

    string

    The human readable-name of the component.

  • linkdata.attributes.metadata

    object<string, any>

    Object containing component metadata.

  • linkdata.attributes.created

    timestamp (iso8601)read only

    When the component was created.

  • linkdata.attributes.updated

    timestamp (iso8601)read only

    When the component was last updated.

linkRelationships

  • linkdata.relationships.account

    individual

    The account that the component belongs to.

  • linkdata.relationships.environment

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

    The environment that the component belongs to.

  • linkdata.relationships.product

    individual

    The product that the component is associated with.

  • linkdata.relationships.license

    individual

    The license that the component is associated with.

  • linkdata.relationships.machine

    individual

    The machine that the component is for.

Example object

{
"data": {
"id": "cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
"type": "components",
"attributes": {
"fingerprint": "7FC5BC17B8944F078539BC7F933F63DA",
"name": "MOBO",
"created": "2022-04-18T16:39:28.410Z",
"updated": "2022-04-18T16:39:28.410Z",
"metadata": {}
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"product": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/product"
},
"data": {
"type": "products",
"id": "e0856109-ad5f-4141-b4ee-01951346f957"
}
},
"license": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/license"
},
"data": {
"type": "licenses",
"id": "defd49e7-f850-4acb-bb2d-fcd5693f22ce"
}
},
"machine": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/machine"
},
"data": {
"type": "machines",
"id": "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
}
}
},
"links": {
"self": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88"
}
}
}

linkAdd a component

Adds a new component resource for a machine.

linkAuthentication

  • linkBearer

    required

    An authentication token with privileges to create the resource: either an admin, the product it belongs to, the license it belongs to (via license key or a license token), or the user it belongs to (unless the license is protected).

linkURL Parameters

  • link<account>

    stringrequired

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

linkAttributes

  • linkdata.attributes.fingerprint

    stringrequired

    The unique fingerprint of the component, e.g. a motherboard serial number. This can be an arbitrary string, but must be unique within the scope of the machine it belongs to or according to the policy's component uniqueness strategy.

  • linkdata.attributes.name

    stringrequired

    The human readable-name of the component.

  • linkdata.attributes.metadata

    object<string, any>optional

    Object containing component metadata.

linkRelationships

linkReturns

A 201 Created response will be returned along with the new component 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>/components

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/components", {
method: "POST",
headers: {
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
},
body: JSON.stringify({
"data": {
"type": "components",
"attributes": {
"fingerprint": "7FC5BC17B8944F078539BC7F933F63DA",
"name": "GPU"
},
"relationships": {
"machine": {
"data": {
"type": "machines",
"id": "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
}
}
}
}
})
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.post(
"https://api.keygen.sh/v1/accounts/<account>/components",
headers={
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
},
data=json.dumps({
"data": {
"type": "components",
"attributes": {
"fingerprint": "7FC5BC17B8944F078539BC7F933F63DA",
"name": "GPU"
},
"relationships": {
"machine": {
"data": {
"type": "machines",
"id": "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
}
}
}
}
})
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/components",
method: .post,
headers: [
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
],
parameters: [
"data": [
"type": "components",
"attributes": [
"fingerprint": "7FC5BC17B8944F078539BC7F933F63DA",
"name": "GPU"
],
"relationships": [
"machine": [
"data": [
"type": "machines",
"id": "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
]
]
]
]
],
encoding: JSONEncoding.default
).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("components", Method.POST);
 
request.AddHeader("Content-Type", "application/vnd.api+json");
request.AddHeader("Accept", "application/vnd.api+json");
request.AddHeader("Authorization", "Bearer <token>");
 
request.AddJsonBody(new {
data = new {
type = "components",
attributes = new {
fingerprint = "7FC5BC17B8944F078539BC7F933F63DA",
name = "GPU"
},
relationships = new {
machine = new {
data = new {
type = "machines",
id = "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
}
}
}
}
});
 
var response = client.Execute(request);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
import org.json.*
 
val body = JSONObject(mapOf(
"data" to mapOf(
"type" to "components",
"attributes" to mapOf(
"fingerprint" to "7FC5BC17B8944F078539BC7F933F63DA",
"name" to "GPU"
),
"relationships" to mapOf(
"machine" to mapOf(
"data" to mapOf(
"type" to "machines",
"id" to "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
)
)
)
)
))
 
val res = Unirest.post("https://api.keygen.sh/v1/accounts/<account>/components")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.api+json")
.header("Accept", "application/vnd.api+json")
.body(body)
.asJson()
import com.mashape.unirest.http.exceptions.*;
import com.mashape.unirest.http.*;
import org.json.*;
 
import static java.util.Map.ofEntries;
import static java.util.Map.entry;
 
JSONObject body = new JSONObject(ofEntries(
entry("data", ofEntries(
entry("type", "components"),
entry("attributes", ofEntries(
entry("fingerprint", "7FC5BC17B8944F078539BC7F933F63DA"),
entry("name", "GPU")
)),
entry("relationships", ofEntries(
entry("machine", ofEntries(
entry("data", ofEntries(
entry("type", "machines"),
entry("id", "79c95ba5-a7bc-474e-ad1b-af12f7736efd")
))
))
))
))
));
 
HttpResponse<JsonNode> res = Unirest.post("https://api.keygen.sh/v1/accounts/<account>/components")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.api+json")
.header("Accept", "application/vnd.api+json")
.body(body)
.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 web::json;
using namespace utility;
 
http_client client("https://api.keygen.sh/v1/accounts/<account>");
http_request req;
 
value attrs;
attrs["fingerprint"] = value::string("7FC5BC17B8944F078539BC7F933F63DA");
attrs["name"] = value::string("GPU");
 
value machine_;
machine_["type"] = value::string("machines");
machine_["id"] = value::string("79c95ba5-a7bc-474e-ad1b-af12f7736efd");
 
value machine;
machine["data"] = machine_;
 
value rels;
rels["machine"] = machine;
 
value data;
data["type"] = value::string("components");
data["attributes"] = attrs;
data["relationships"] = rels;
 
value body;
body["data"] = data;
 
req.headers().add("Authorization", "Bearer <token>");
req.headers().add("Content-Type", "application/vnd.api+json");
req.headers().add("Accept", "application/json");
 
req.set_request_uri("/components");
req.set_method(methods::POST);
req.set_body(body.serialize());
 
client.request(req)
.then([](http_response res)
{
auto data = res.extract_json().get();
})
.wait();
curl -X POST https://api.keygen.sh/v1/accounts/<account>/components \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer <token>' \
-d '{
"data": {
"type": "components",
"attributes": {
"fingerprint": "7FC5BC17B8944F078539BC7F933F63DA",
"name": "GPU"
},
"relationships": {
"machine": {
"data": {
"type": "machines",
"id": "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
}
}
}
}
}'

Example response / 201 Created

{
"data": {
"id": "cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
"type": "components",
"attributes": {
"fingerprint": "7FC5BC17B8944F078539BC7F933F63DA",
"name": "GPU",
"created": "2022-04-18T16:39:28.410Z",
"updated": "2022-04-18T16:39:28.410Z",
"metadata": {}
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"product": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/product"
},
"data": {
"type": "products",
"id": "e0856109-ad5f-4141-b4ee-01951346f957"
}
},
"license": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/license"
},
"data": {
"type": "licenses",
"id": "defd49e7-f850-4acb-bb2d-fcd5693f22ce"
}
},
"machine": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/machine"
},
"data": {
"type": "machines",
"id": "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
}
}
},
"links": {
"self": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88"
}
}
}

linkRetrieve a component

Retrieves the details of an existing component.

linkAuthentication

  • linkBearer

    required

    An authentication token with privileges to view the resource: either an admin, a product which the owning machine belongs to, the license it belongs to (via license key or a license token), or the user it belongs to.

linkURL Parameters

  • link<account>

    stringrequired

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

  • link<id>

    stringrequired

    The identifier (UUID) of the component to be retrieved.

linkReturns

A 200 OK response will be returned along with a component 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>/components/<id>

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88", {
method: "GET",
headers: {
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
}
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.get(
"https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
headers={
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
headers: [
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
]
).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(
"components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
Method.GET
);
 
request.AddHeader("Accept", "application/vnd.api+json");
request.AddHeader("Authorization", "Bearer <token>");
 
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>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88")
.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>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88")
.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("/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88");
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>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88 \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer <token>'

Example response / 200 OK

{
"data": {
"id": "cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
"type": "components",
"attributes": {
"fingerprint": "7FC5BC17B8944F078539BC7F933F63DA",
"name": "Motherboard",
"created": "2022-04-18T16:39:28.410Z",
"updated": "2022-04-18T16:39:28.410Z",
"metadata": {}
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"product": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/product"
},
"data": {
"type": "products",
"id": "e0856109-ad5f-4141-b4ee-01951346f957"
}
},
"license": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/license"
},
"data": {
"type": "licenses",
"id": "defd49e7-f850-4acb-bb2d-fcd5693f22ce"
}
},
"machine": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/machine"
},
"data": {
"type": "machines",
"id": "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
}
}
},
"links": {
"self": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88"
}
}
}

linkUpdate a component

Updates the specified component resource by setting the values of the parameters passed. Any parameters not provided will be left unchanged.

linkAuthentication

  • linkBearer

    required

    An authentication token with privileges to manage the resource: either an admin, an environment, or the product it belongs to.

linkURL Parameters

  • link<account>

    stringrequired

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

  • link<id>

    stringrequired

    The identifier (UUID) of the component to be updated.

linkAttributes

  • linkdata.attributes.name

    stringoptional

    The human readable-name of the component.

  • linkdata.attributes.metadata

    object<string, any>optionalprotectedProtected attributes are only available for bearers with an admin, environment or product role.

    Object containing component metadata.

linkReturns

A 200 OK response will be returned along with the updated component 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>/components/<id>

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88", {
method: "PATCH",
headers: {
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
},
body: JSON.stringify({
"data": {
"type": "components",
"attributes": {
"name": "CPU"
}
}
})
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.patch(
"https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
headers={
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
},
data=json.dumps({
"data": {
"type": "components",
"attributes": {
"name": "CPU"
}
}
})
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
method: .patch,
headers: [
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
],
parameters: [
"data": [
"type": "components",
"attributes": [
"name": "CPU"
]
]
],
encoding: JSONEncoding.default
).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(
"components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
Method.PATCH
);
 
request.AddHeader("Content-Type", "application/vnd.api+json");
request.AddHeader("Accept", "application/vnd.api+json");
request.AddHeader("Authorization", "Bearer <token>");
 
request.AddJsonBody(new {
data = new {
type = "components",
attributes = new {
name = "CPU"
}
}
});
 
var response = client.Execute(request);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
import org.json.*
 
val body = JSONObject(mapOf(
"data" to mapOf(
"type" to "components",
"attributes" to mapOf(
"name" to "CPU"
)
)
))
 
val res = Unirest.patch("https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.api+json")
.header("Accept", "application/vnd.api+json")
.body(body)
.asJson()
import com.mashape.unirest.http.exceptions.*;
import com.mashape.unirest.http.*;
import org.json.*;
 
import static java.util.Map.ofEntries;
import static java.util.Map.entry;
 
JSONObject body = new JSONObject(ofEntries(
entry("data", ofEntries(
entry("type", "components"),
entry("attributes", ofEntries(
entry("name", "CPU")
))
))
));
 
HttpResponse<JsonNode> res = Unirest.patch("https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/vnd.api+json")
.header("Accept", "application/vnd.api+json")
.body(body)
.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 web::json;
using namespace utility;
 
http_client client("https://api.keygen.sh/v1/accounts/<account>");
http_request req;
 
value attrs;
attrs["name"] = value::string("CPU");
 
value data;
data["type"] = value::string("components");
data["attributes"] = attrs;
 
value body;
body["data"] = data;
 
req.headers().add("Authorization", "Bearer <token>");
req.headers().add("Content-Type", "application/vnd.api+json");
req.headers().add("Accept", "application/json");
 
req.set_request_uri("/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88");
req.set_method(methods::PATCH);
req.set_body(body.serialize());
 
client.request(req)
.then([](http_response res)
{
auto data = res.extract_json().get();
})
.wait();
curl -X PATCH https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88 \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer <token>' \
-d '{
"data": {
"type": "components",
"attributes": {
"name": "CPU"
}
}
}'

Example response / 200 OK

{
"data": {
"id": "cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
"type": "components",
"attributes": {
"fingerprint": "7FC5BC17B8944F078539BC7F933F63DA",
"name": "CPU",
"created": "2022-04-18T16:39:28.410Z",
"updated": "2022-04-18T16:39:28.410Z",
"metadata": {}
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"product": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/product"
},
"data": {
"type": "products",
"id": "e0856109-ad5f-4141-b4ee-01951346f957"
}
},
"license": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/license"
},
"data": {
"type": "licenses",
"id": "defd49e7-f850-4acb-bb2d-fcd5693f22ce"
}
},
"machine": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/machine"
},
"data": {
"type": "machines",
"id": "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
}
}
},
"links": {
"self": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88"
}
}
}

linkRemove a component

Permanently removes a component. It cannot be undone.

linkAuthentication

  • linkBearer

    required

    An authentication token with privileges to manage the resource: either an admin, the product it belongs to, the license it belongs to (via license key or a license token), or the user it belongs to (unless the license is protected).

linkURL Parameters

  • link<account>

    stringrequired

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

  • link<id>

    stringrequired

    The identifier (UUID) of the component to be deleted.

linkReturns

A 204 No Content response will be returned.

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>/components/<id>

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88", {
method: "DELETE",
headers: {
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
}
})
import requests
 
res = requests.delete(
"https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
headers={
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
}
)
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
method: .delete,
headers: [
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
]
).responseJSON { response in
let status = response.response?.statusCode
}
using RestSharp;
 
var client = new RestClient("https://api.keygen.sh/v1/accounts/<account>");
var request = new RestRequest(
"components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
Method.DELETE
);
 
request.AddHeader("Accept", "application/vnd.api+json");
request.AddHeader("Authorization", "Bearer <token>");
 
var response = client.Execute(request);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
 
val res = Unirest.delete("https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88")
.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.delete("https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88")
.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("/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88");
req.set_method(methods::DELETE);
 
client.request(req)
.then([](http_response res) {
auto status = res.status_code();
})
.wait();
curl -X DELETE https://api.keygen.sh/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88 \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer <token>'

Example response / 204 No Content

No content

linkList all components

Returns a list of components. The components are returned sorted by creation date, with the most recent components appearing first. Resources are automatically scoped to the authenticated bearer e.g. when authenticated as a user, only components for that specific user will be listed.

linkAuthentication

  • linkBearer

    required

    An authentication token with privileges to view the resources: either an admin, a product which the owning license belongs to, the license which the components belong to (via license key or a license token), or the user which the components belong to.

linkURL Parameters

  • link<account>

    stringrequired

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

linkQuery Parameters

  • linklimit

    integerdefault=10

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

    /v1/accounts/<account>/components?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>/components?page[size]=15&page[number]=2
  • linkmachine

    string

    The identifier (UUID) of the machine to filter by.

    /v1/accounts/<account>/components?machine=79c95ba5-a7bc-474e-ad1b-af12f7736efd
  • linklicense

    string

    The identifier (UUID) of the license to filter by.

    /v1/accounts/<account>/components?license=defd49e7-f850-4acb-bb2d-fcd5693f22ce
  • linkuser

    string

    The identifier (UUID) of the user to filter by.

    /v1/accounts/<account>/components?user=3fd7ff1c-e778-4030-a81c-d2242d909258
  • linkproduct

    string

    The identifier (UUID) of the product to filter by.

    /v1/accounts/<account>/components?product=e0856109-ad5f-4141-b4ee-01951346f957

linkReturns

A 200 OK response will be returned along with a list of component 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>/components

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/components?limit=15", {
method: "GET",
headers: {
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
}
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.get(
"https://api.keygen.sh/v1/accounts/<account>/components?limit=15",
headers={
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/components?limit=15",
headers: [
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
]
).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("components", Method.GET);
 
request.AddHeader("Accept", "application/vnd.api+json");
request.AddHeader("Authorization", "Bearer <token>");
 
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>/components")
.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>/components")
.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("/components");
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>/components?limit=15 -g \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer <token>'

Example response / 200 OK

{
"data": [
{
"id": "cbfe3e6e-9076-4abe-b23a-60ebba3f6d88",
"type": "components",
"attributes": {
"fingerprint": "7FC5BC17B8944F078539BC7F933F63DA",
"name": "Motherboard",
"created": "2022-04-18T16:39:28.410Z",
"updated": "2022-04-18T16:39:28.410Z",
"metadata": {}
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"product": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/product"
},
"data": {
"type": "products",
"id": "e0856109-ad5f-4141-b4ee-01951346f957"
}
},
"license": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/license"
},
"data": {
"type": "licenses",
"id": "defd49e7-f850-4acb-bb2d-fcd5693f22ce"
}
},
"machine": {
"links": {
"related": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88/machine"
},
"data": {
"type": "machines",
"id": "79c95ba5-a7bc-474e-ad1b-af12f7736efd"
}
}
},
"links": {
"self": "/v1/accounts/<account>/components/cbfe3e6e-9076-4abe-b23a-60ebba3f6d88"
}
},
]
}