Select programming language for code examples

linkGroups

Groups can be used to associate multiple users, licenses and machines under a single group. This is great for setting up "Teams" or group licenses. For example, you use an "ACME Co." group for a team license package that belongs to the ACME customer, making sure all licenses are associated with eachother.

How resources can be added into a group:

  1. By specifying a group relationship during creation of a new resource. For example, to add a new license to a group, specify the group relationship.
  2. By changing an existing resource's group relationship. For example, to add an existing license to a group, change it's group relationship.
  3. Through inheritance. For example, any machines created for a license in group "ACME" will automatically be included into the same group.

Groups can also be used to assert collective resource limits for certain customers. For example, providing a handful of licenses to a customer which should not exceed a combined machine count across all of the customer's licenses.

As a more concrete example — consider a licensing model which wanted to assert each individual license can have up to 3 activations, but collectively, the entire group should not exceed a total of 15 activations. You would add each license to the group, then set a machine limit on the group, which will be applied in addition to the policy's per-license machine limit.

linkThe group object

Below you will find the various attributes for the group resource. Groups can be utilized to associate multiple resources with eachother, as well as to define collective resource limits.

linkAttributes

  • linkdata.attributes.name

    string

    The name of the group.

  • linkdata.attributes.maxUsers

    integer

    The maximum number of users the group can have, collectively. When null, an unlimited number of users may be in the group. Must be a number greater than 0.

  • linkdata.attributes.maxLicenses

    integer

    The maximum number of licenses the group can have, collectively. When null, an unlimited number of licenses may be in the group. Must be a number greater than 0.

  • linkdata.attributes.maxMachines

    integer

    The maximum number of machines the group can have, collectively. When null, an unlimited number of machines may be in the group. Must be a number greater than 0.

  • linkdata.attributes.created

    timestamp (ISO8601 format)read only

    When the group was created.

  • linkdata.attributes.updated

    timestamp (ISO8601 format)read only

    When the group was last updated.

  • linkdata.attributes.metadata

    object<string, scalar>

    Object containing group metadata.

linkRelationships

  • linkdata.relationships.account

    individual

    The account that the group belongs to.

  • linkdata.relationships.owners

    collectionprotectedProtected relationships are only available for bearers with an admin or product role.

    The owners of the group.

  • linkdata.relationships.users

    collectionprotectedProtected relationships are only available for bearers with an admin or product role.

    The users that are in the group.

  • linkdata.relationships.licenses

    collectionprotectedProtected relationships are only available for bearers with an admin or product role.

    The licenses that are in the group.

  • linkdata.relationships.machines

    collectionprotectedProtected relationships are only available for bearers with an admin or product role.

    The machines that are in the group.

Example object

{
"data": {
"id": "db7e99e1-dd6d-447b-98e8-ceb354d9d85d",
"type": "groups",
"attributes": {
"name": "Example Group",
"maxUsers": null,
"maxLicenses": null,
"maxMachines": null,
"metadata": {},
"created": "2022-03-07T14:13:02.959Z",
"updated": "2022-03-07T14:13:02.959Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/{ACCOUNT}"
},
"data": {
"type": "accounts",
"id": "{ACCOUNT}"
}
},
"owners": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/owners"
}
},
"users": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/users"
}
},
"licenses": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/licenses"
}
},
"machines": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/machines"
}
}
},
"links": {
"self": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d"
}
}
}

linkCreate a group

Creates a new group resource.

linkAuthentication

  • linkBearer

    required

    An authentication token with privileges to create the resource: an admin or a product.

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

  • linkdata.attributes.maxUsers

    integer, optional

    The maximum number of users the group can have, collectively. When null, an unlimited number of users may be in the group. Must be a number greater than 0.

  • linkdata.attributes.maxLicenses

    integer, optional

    The maximum number of licenses the group can have, collectively. When null, an unlimited number of licenses may be in the group. Must be a number greater than 0.

  • linkdata.attributes.maxMachines

    integer, optional

    The maximum number of machines the group can have, collectively. When null, an unlimited number of machines may be in the group. Must be a number greater than 0.

  • linkdata.attributes.metadata

    object<string, scalar>, optional

    Object containing group metadata.

linkReturns

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

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups", {
method: "POST",
headers: {
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
},
body: JSON.stringify({
"data": {
"type": "groups",
"attributes": {
"name": "Example Group"
}
}
})
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.post(
"https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups",
headers={
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
},
data=json.dumps({
"data": {
"type": "groups",
"attributes": {
"name": "Example Group"
}
}
})
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups",
method: .post,
headers: [
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
],
parameters: [
"data": [
"type": "groups",
"attributes": [
"name": "Example Group"
]
]
],
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("groups", 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 = "groups",
attributes = new {
name = "Example Group"
}
}
});
 
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 "groups",
"attributes" to mapOf(
"name" to "Example Group"
)
)
))
 
val res = Unirest.post("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups")
.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", "groups"),
entry("attributes", ofEntries(
entry("name", "Example Group")
))
))
));
 
HttpResponse<JsonNode> res = Unirest.post("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups")
.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("Example Group");
 
value data;
data["type"] = value::string("groups");
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("/groups");
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}/groups \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {TOKEN}' \
-d '{
"data": {
"type": "groups",
"attributes": {
"name": "Example Feature"
}
}
}'

Example response / 201 Created

{
"data": {
"id": "db7e99e1-dd6d-447b-98e8-ceb354d9d85d",
"type": "groups",
"attributes": {
"name": "Example Group",
"maxUsers": null,
"maxLicenses": null,
"maxMachines": null,
"metadata": {},
"created": "2022-03-07T14:13:02.959Z",
"updated": "2022-03-07T14:13:02.959Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/{ACCOUNT}"
},
"data": {
"type": "accounts",
"id": "{ACCOUNT}"
}
},
"owners": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/owners"
}
},
"users": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/users"
}
},
"licenses": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/licenses"
}
},
"machines": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/machines"
}
}
},
"links": {
"self": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d"
}
}
}

linkRetrieve a group

Retrieves the details of an existing group.

linkAuthentication

  • linkBearer

    required

    An authentication token with privileges to view the resources: either an admin, a product, a group owner, or a group member.

linkURL Parameters

  • link:account

    string, required

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

  • link:id

    string, required

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

linkReturns

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

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d", {
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}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d",
headers={
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d",
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(
"groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d",
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}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d")
.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}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d")
.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("/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d");
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}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {TOKEN}'

Example response / 200 OK

{
"data": {
"id": "db7e99e1-dd6d-447b-98e8-ceb354d9d85d",
"type": "groups",
"attributes": {
"name": "Example Group",
"maxUsers": null,
"maxLicenses": null,
"maxMachines": null,
"metadata": {},
"created": "2022-03-07T14:13:02.959Z",
"updated": "2022-03-07T14:13:02.959Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/{ACCOUNT}"
},
"data": {
"type": "accounts",
"id": "{ACCOUNT}"
}
},
"owners": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/owners"
}
},
"users": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/users"
}
},
"licenses": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/licenses"
}
},
"machines": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/machines"
}
}
},
"links": {
"self": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d"
}
}
}

linkUpdate a group

Updates the specified group 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: an admin.

linkURL Parameters

  • link:account

    string, required

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

  • link:id

    string, required

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

linkAttributes

  • linkdata.attributes.name

    string, optional

    The name of the group.

  • linkdata.attributes.maxUsers

    integer, optional

    The maximum number of users the group can have, collectively. When null, an unlimited number of users may be in the group. Must be a number greater than 0.

  • linkdata.attributes.maxLicenses

    integer, optional

    The maximum number of licenses the group can have, collectively. When null, an unlimited number of licenses may be in the group. Must be a number greater than 0.

  • linkdata.attributes.maxMachines

    integer, optional

    The maximum number of machines the group can have, collectively. When null, an unlimited number of machines may be in the group. Must be a number greater than 0.

  • linkdata.attributes.metadata

    object<string, scalar>, optional

    Object containing group metadata.

linkReturns

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

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups/db1ff21b-f42f-4623-952b-ca7f2600bded", {
method: "PATCH",
headers: {
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
},
body: JSON.stringify({
"data": {
"type": "groups",
"attributes": {
"code": "EXAMPLE_ENTITLEMENT_CODE"
}
}
})
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.patch(
"https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups/db1ff21b-f42f-4623-952b-ca7f2600bded",
headers={
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
},
data=json.dumps({
"data": {
"type": "groups",
"attributes": {
"code": "EXAMPLE_ENTITLEMENT_CODE"
}
}
})
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups/db1ff21b-f42f-4623-952b-ca7f2600bded",
method: .patch,
headers: [
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
],
parameters: [
"data": [
"type": "groups",
"attributes": [
"code": "EXAMPLE_ENTITLEMENT_CODE"
]
]
],
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(
"groups/db1ff21b-f42f-4623-952b-ca7f2600bded",
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 = "groups",
attributes = new {
code = "EXAMPLE_ENTITLEMENT_CODE"
}
}
});
 
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 "groups",
"attributes" to mapOf(
"code" to "EXAMPLE_ENTITLEMENT_CODE"
)
)
))
 
val res = Unirest.patch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups/db1ff21b-f42f-4623-952b-ca7f2600bded")
.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", "groups"),
entry("attributes", ofEntries(
entry("code", "EXAMPLE_ENTITLEMENT_CODE")
))
))
));
 
HttpResponse<JsonNode> res = Unirest.patch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups/db1ff21b-f42f-4623-952b-ca7f2600bded")
.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["code"] = value::string("EXAMPLE_ENTITLEMENT_CODE");
 
value data;
data["type"] = value::string("groups");
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("/groups/db1ff21b-f42f-4623-952b-ca7f2600bded");
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}/groups/db1ff21b-f42f-4623-952b-ca7f2600bded \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {TOKEN}' \
-d '{
"data": {
"type": "groups",
"attributes": {
"code": "EXAMPLE_ENTITLEMENT_CODE"
}
}
}'

Example response / 200 OK

{
"data": {
"id": "db1ff21b-f42f-4623-952b-ca7f2600bded",
"type": "groups",
"attributes": {
"name": "Example Feature",
"code": "EXAMPLE_ENTITLEMENT_CODE",
"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}"
}
}
},
"links": {
"self": "/v1/accounts/{ACCOUNT}/groups/db1ff21b-f42f-4623-952b-ca7f2600bded"
}
}
}

linkDelete a group

Permanently deletes a group. The group will immediately be removed from all users, licenses and machines. It cannot be undone.

linkAuthentication

  • linkBearer

    required

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

linkURL Parameters

  • link:account

    string, required

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

  • link:id

    string, required

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

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d", {
method: "DELETE",
headers: {
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
}
})
import requests
 
res = requests.delete(
"https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d",
headers={
"Accept": "application/vnd.api+json",
"Authorization": "Bearer {TOKEN}"
}
)
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d",
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(
"groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d",
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}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d")
.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}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d")
.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("/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d");
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}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer {TOKEN}'

Example response / 204 No Content

No content

linkList all groups

Returns a list of groups. This will include all groups associated with the authenticated bearer, including groups they are an owner of, as well as groups they are a member of. The groups are returned sorted by creation date, with the most recent groups appearing first.

linkAuthentication

  • linkBearer

    required

    An authentication token with privileges to view the resources: either an admin, a product, a group owner, or a group member.

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 groups to be returned. Limit must be a number between 1 and 100.

    https://api.keygen.sh/v1/accounts/{ACCOUNT}/groups?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}/groups?page[size]=15&page[number]=2

linkReturns

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

Example request

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

Example response / 200 OK

{
"data": [
{
"id": "db7e99e1-dd6d-447b-98e8-ceb354d9d85d",
"type": "groups",
"attributes": {
"name": "Example Group",
"maxUsers": null,
"maxLicenses": null,
"maxMachines": null,
"metadata": {},
"created": "2022-03-07T14:13:02.959Z",
"updated": "2022-03-07T14:13:02.959Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/{ACCOUNT}"
},
"data": {
"type": "accounts",
"id": "{ACCOUNT}"
}
},
"owners": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/owners"
}
},
"users": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/users"
}
},
"licenses": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/licenses"
}
},
"machines": {
"links": {
"related": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d/machines"
}
}
},
"links": {
"self": "/v1/accounts/{ACCOUNT}/groups/db7e99e1-dd6d-447b-98e8-ceb354d9d85d"
}
},
]
}