Select programming language for code examples

linkProducts

linkThe product object

Below you will find the various attributes for the product resource, as well as the product resource's relationships.

linkAttributes

  • linkdata.attributes.name

    string

    The name of the product.

  • linkdata.attributes.url

    string

    A related URL for the product e.g. the marketing website, company website, etc.

  • linkdata.attributes.distributionStrategy

    string, default isLICENSED

    The strategy for distributing releases.

    Options

    • LICENSED: Only licensed users, with a valid license, can access releases and release artifacts. API authentication is required.
    • OPEN: Anybody can access releases. No API authentication required, so this is a great option for rendering releases on a public downloads page, open source projects, or freemium products.
    • CLOSED: Only admins can access releases. Download links will need to be generated server-side. API authentication is required.
  • linkdata.attributes.platforms

    array<string>

    An array of platforms the product supports.

  • linkdata.attributes.metadata

    object<string, scalar>

    Object containing product metadata.

  • linkdata.attributes.created

    timestamp (ISO8601 format)read only

    When the product was created.

  • linkdata.attributes.updated

    timestamp (ISO8601 format)read only

    When the product was last updated.

linkRelationships

  • linkdata.relationships.account

    individual

    The account that the product belongs to.

  • linkdata.relationships.policies

    collection

    The policies that are associated with the product.

  • linkdata.relationships.licenses

    collection

    The licenses that are associated with the product.

  • linkdata.relationships.machines

    collection

    The machines that are associated with the product.

  • linkdata.relationships.users

    collection

    The users that own a license for the product.

  • linkdata.relationships.tokens

    collection

    The authentication tokens of the product.

Example object

{
"data": {
"id": "31339351-f7f5-4bdd-8346-5d8399a1ac07",
"type": "products",
"links": {
"self": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07"
},
"attributes": {
"name": "Example App",
"distributionStrategy": "OPEN",
"url": "https://example.com",
"platforms": [],
"metadata": {},
"created": "2017-01-02T20:26:53.464Z",
"updated": "2017-01-02T20:26:53.464Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/{ACCOUNT}"
},
"data": {
"type": "accounts",
"id": "{ACCOUNT}"
}
},
"policies": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/policies"
}
},
"licenses": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/licenses"
}
},
"machines": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/machines"
}
},
"users": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/users"
}
},
"tokens": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens"
}
}
}
}
}

linkCreate a product

Creates a new product resource.

linkAuthentication

  • linkBearer

    required

    An authentication token with admin privileges.

linkURL Parameters

  • link:account

    string, required

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

linkAttributes

  • linkdata.attributes.name

    string, required

    The name of the product.

  • linkdata.attributes.url

    string, optional

    A related URL for the product e.g. the marketing website, company website, etc. Must be a valid URL.

  • linkdata.attributes.distributionStrategy

    string, optional, default isLICENSED

    The strategy for distributing releases.

    Options

    • LICENSED: Only licensed users, with a valid license, can access releases and release artifacts. API authentication is required.
    • OPEN: Anybody can access releases. No API authentication required, so this is a great option for rendering releases on a public downloads page, open source projects, or freemium products.
    • CLOSED: Only admins can access releases. Download links will need to be generated server-side. API authentication is required.
  • linkdata.attributes.platforms

    array<string>, optional

    An array of platforms the product supports.

  • linkdata.attributes.metadata

    object<string, scalar>, optional

    Object containing product metadata.

linkReturns

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

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products", {
method: "POST",
headers: {
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
},
body: JSON.stringify({
"data": {
"type": "products",
"attributes": {
"name": "Example On-Premise",
"url": "https://example.com",
"platforms": ["iOS", "Android"]
}
}
})
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.post(
"https://api.keygen.sh/v1/accounts/{ACCOUNT}/products",
headers={
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
},
data=json.dumps({
"data": {
"type": "products",
"attributes": {
"name": "Example On-Premise",
"url": "https://example.com",
"platforms": ["iOS", "Android"]
}
}
})
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products",
method: .post,
headers: [
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
],
parameters: [
"data": [
"type": "products",
"attributes": [
"name": "Example On-Premise",
"url": "https://example.com",
"platforms": ["iOS", "Android"]
]
]
],
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("products", 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 = "products",
attributes = new {
name = "Example On-Premise",
url = "https://example.com",
platforms = new[] { "iOS", "Android" }
}
}
});
 
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 "products",
"attributes" to mapOf(
"name" to "Example On-Premise",
"url" to "https://example.com",
"platforms" to listOf("iOS", "Android")
)
)
))
 
val res = Unirest.post("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products")
.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;
import static java.util.List.of;
 
JSONObject body = new JSONObject(ofEntries(
entry("data", ofEntries(
entry("type", "products"),
entry("attributes", ofEntries(
entry("name", "Example On-Premise"),
entry("url", "https://example.com"),
entry("platforms", of("iOS", "Android"))
))
))
));
 
HttpResponse<JsonNode> res = Unirest.post("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products")
.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 platforms;
platforms[0] = value::string("iOS");
platforms[1] = value::string("Android");
 
value attrs;
attrs["name"] = value::string("Example On-Premise");
attrs["url"] = value::string("https://example.com");
attrs["platforms"] = platforms;
 
value data;
data["type"] = value::string("products");
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("/products");
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}/products \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {TOKEN}' \
-d '{
"data": {
"type": "products",
"attributes": {
"name": "Example On-Premise",
"url": "https://example.com",
"platforms": ["iOS", "Android"]
}
}
}'

Example response / 201 Created

{
"data": {
"id": "31339351-f7f5-4bdd-8346-5d8399a1ac07",
"type": "products",
"links": {
"self": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07"
},
"attributes": {
"name": "Example On-Premise",
"distributionStrategy": "LICENSED",
"url": "https://example.com",
"platforms": ["linux"],
"metadata": {},
"created": "2017-01-02T20:26:53.464Z",
"updated": "2017-01-02T20:26:53.464Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/{ACCOUNT}"
},
"data": {
"type": "accounts",
"id": "{ACCOUNT}"
}
},
"policies": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/policies"
}
},
"licenses": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/licenses"
}
},
"machines": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/machines"
}
},
"users": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/users"
}
},
"tokens": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens"
}
}
}
}
}

linkRetrieve a product

Retrieves the details of an existing product.

linkAuthentication

  • linkBearer

    required

    An authentication token with privileges to view the resource: either an admin or the product.

linkURL Parameters

  • link:account

    string, required

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

  • link:id

    string, required

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

linkReturns

A 200 OK response will be returned along with a product 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}/products/{ID}

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07", {
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}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07",
headers={
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07",
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(
"products/31339351-f7f5-4bdd-8346-5d8399a1ac07",
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}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07")
.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}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07")
.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("/products/31339351-f7f5-4bdd-8346-5d8399a1ac07");
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}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07 \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {TOKEN}'

Example response / 200 OK

{
"data": {
"id": "31339351-f7f5-4bdd-8346-5d8399a1ac07",
"type": "products",
"links": {
"self": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07"
},
"attributes": {
"name": "Example App",
"distributionStrategy": "OPEN",
"url": "https://example.com",
"platforms": [],
"metadata": {},
"created": "2017-01-02T20:26:53.464Z",
"updated": "2017-01-02T20:26:53.464Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/{ACCOUNT}"
},
"data": {
"type": "accounts",
"id": "{ACCOUNT}"
}
},
"policies": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/policies"
}
},
"licenses": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/licenses"
}
},
"machines": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/machines"
}
},
"users": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/users"
}
},
"tokens": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens"
}
}
}
}
}

linkUpdate a product

Updates the specified product 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 or the product.

linkURL Parameters

  • link:account

    string, required

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

  • link:id

    string, required

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

linkAttributes

  • linkdata.attributes.name

    string, optional

    The name of the product.

  • linkdata.attributes.url

    string, optional

    A related URL for the product e.g. the marketing website, company website, etc. Must be a valid URL.

  • linkdata.attributes.distributionStrategy

    string, optional

    The strategy for distributing releases.

    Options

    • LICENSED: Only licensed users, with a valid license, can access releases and release artifacts. API authentication is required.
    • OPEN: Anybody can access releases. No API authentication required, so this is a great option for rendering releases on a public downloads page, open source projects, or freemium products.
    • CLOSED: Only admins can access releases. Download links will need to be generated server-side. API authentication is required.
  • linkdata.attributes.platforms

    array<string>, optional

    An array of platforms the product supports.

  • linkdata.attributes.metadata

    object<string, scalar>, optional

    Object containing product metadata.

linkReturns

A 200 OK response will be returned along with the updated product 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}/products/{ID}

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07", {
method: "PATCH",
headers: {
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
},
body: JSON.stringify({
"data": {
"type": "products",
"attributes": {
"platforms": [
"iOS",
"Android",
"Windows"
]
}
}
})
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.patch(
"https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07",
headers={
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
},
data=json.dumps({
"data": {
"type": "products",
"attributes": {
"platforms": [
"iOS",
"Android",
"Windows"
]
}
}
})
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07",
method: .patch,
headers: [
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
],
parameters: [
"data": [
"type": "products",
"attributes": [
"platforms": [
"iOS",
"Android",
"Windows"
]
]
]
],
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(
"products/31339351-f7f5-4bdd-8346-5d8399a1ac07",
Method.PATCH
);
 
request.AddHeader("Accept", "application/vnd.api+json");
request.AddHeader("Authorization", "Bearer {TOKEN}");
 
request.AddJsonBody(new {
data = new {
type = "products",
attributes = new {
platforms = new[] { "iOS", "Android", "Windows" }
}
}
});
 
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 "products",
"attributes" to mapOf(
"platforms" to listOf("iOS", "Android", "Windows")
)
)
))
 
val res = Unirest.patch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07")
.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;
import static java.util.List.of;
 
JSONObject body = new JSONObject(ofEntries(
entry("data", ofEntries(
entry("type", "products"),
entry("attributes", ofEntries(
entry("platforms", of("iOS", "Android", "Windows"))
))
))
));
 
HttpResponse<JsonNode> res = Unirest.patch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07")
.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 platforms;
platforms[0] = value::string("iOS");
platforms[1] = value::string("Android");
platforms[2] = value::string("Windows");
 
value attrs;
attrs["platforms"] = platforms;
 
value data;
data["type"] = value::string("products");
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("/products/31339351-f7f5-4bdd-8346-5d8399a1ac07");
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}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07 \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {TOKEN}' \
-d '{
"data": {
"type": "products",
"attributes": {
"platforms": [
"iOS",
"Android",
"Windows"
]
}
}
}'

Example response / 200 OK

{
"data": {
"id": "31339351-f7f5-4bdd-8346-5d8399a1ac07",
"type": "products",
"links": {
"self": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07"
},
"attributes": {
"name": "Example App",
"distributionStrategy": "OPEN",
"url": "https://example.com",
"platforms": [],
"metadata": {},
"created": "2017-01-02T20:26:53.464Z",
"updated": "2017-01-02T20:26:53.464Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/{ACCOUNT}"
},
"data": {
"type": "accounts",
"id": "{ACCOUNT}"
}
},
"policies": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/policies"
}
},
"licenses": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/licenses"
}
},
"machines": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/machines"
}
},
"users": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/users"
}
},
"tokens": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens"
}
}
}
}
}

linkDelete a product

Permanently deletes a product. It cannot be undone. This action also immediately deletes any policies, licenses and machines that the product is associated with.

linkAuthentication

  • linkBearer

    required

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

linkURL Parameters

  • link:account

    string, required

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

  • link:id

    string, required

    The identifier (UUID) of the product 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}/products/{ID}

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07", {
method: "DELETE",
headers: {
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
}
})
import requests
 
res = requests.delete(
"https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07",
headers={
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
}
)
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07",
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(
"products/31339351-f7f5-4bdd-8346-5d8399a1ac07",
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}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07")
.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}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07")
.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("/products/31339351-f7f5-4bdd-8346-5d8399a1ac07");
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}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07 \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {TOKEN}'

Example response / 204 No Content

No content

linkList all products

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

linkAuthentication

  • linkBearer

    required

    An authentication token with admin privileges.

linkURL Parameters

  • link:account

    string, required

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

linkFilters

  • linklimit

    integer, default is10

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

    https://api.keygen.sh/v1/accounts/{ACCOUNT}/products?limit=25
  • linkpage

    object<string, integer>

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

    https://api.keygen.sh/v1/accounts/{ACCOUNT}/products?page[size]=15&page[number]=2

linkReturns

A 200 OK response will be returned along with a list of product 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}/products{FILTERS}

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products?limit=15", {
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}/products?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}/products?limit=15",
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("products", 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}/products")
.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}/products")
.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("/products");
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}/products?limit=15 -g \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {TOKEN}'

Example response / 200 OK

{
"data": [
{
"id": "31339351-f7f5-4bdd-8346-5d8399a1ac07",
"type": "products",
"links": {
"self": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07"
},
"attributes": {
"name": "Example App",
"distributionStrategy": "OPEN",
"url": "https://example.com",
"platforms": [],
"metadata": {},
"created": "2017-01-02T20:26:53.464Z",
"updated": "2017-01-02T20:26:53.464Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/{ACCOUNT}"
},
"data": {
"type": "accounts",
"id": "{ACCOUNT}"
}
},
"policies": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/policies"
}
},
"licenses": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/licenses"
}
},
"machines": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/machines"
}
},
"users": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/users"
}
},
"tokens": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens"
}
}
}
},
]
}

linkGenerate a product token

Generates a new product token resource. Product tokens do not expire.

Product tokens should not be included in any client-facing code, as they offer full access to all of the product's resources. Only use these tokens server-side e.g. to consume webhooks or to create new resources in response to events from your payment provider.

linkAuthentication

  • linkBearer

    required

    An authentication token with admin privileges.

linkURL Parameters

  • link:account

    string, required

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

  • link:id

    string, required

    The identifier (UUID) of the product to generate a token for.

linkReturns

A 200 OK response will be returned along with the new token 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}/products/{ID}/tokens

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens", {
method: "POST",
headers: {
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
}
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.post(
"https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens",
headers={
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens",
method: .post,
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(
"products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens",
Method.POST
);
 
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.post("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens")
.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.post("https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens")
.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("/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens");
req.set_method(methods::POST);
 
client.request(req)
.then([](http_response res) {
auto data = res.extract_json().get();
})
.wait();
curl -X POST https://api.keygen.sh/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07/tokens \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {TOKEN}'

Example response / 200 OK

{
"data": {
"id": "07d52aa8-b96c-4b55-b05d-f5f570e1775a",
"type": "tokens",
"attributes": {
"kind": "product-token",
"token": "prod-2ddd064509b6bcaa356958dcce6da3a538919e13ddbc26b359fb374ff89dfacav3",
"expiry": "2022-03-15T19:27:50.440Z",
"created": "2017-01-02T20:26:53.464Z",
"updated": "2017-01-02T20:26:53.464Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/{ACCOUNT}"
},
"data": {
"type": "accounts",
"id": "{ACCOUNT}"
}
},
"bearer": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/products/31339351-f7f5-4bdd-8346-5d8399a1ac07"
},
"data": {
"type": "products",
"id": "31339351-f7f5-4bdd-8346-5d8399a1ac07"
}
}
}
}
}