Select programming language for code examples

linkPackages

Utilizing packages, you can group the distribution of your releases. For example, you can distribute multiple offerings under a single product, such as multiple PyPI packages, a CLI plus a desktop app, a flagship on-premise application along with its add-ons, etc.

linkThe package object

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

linkAttributes

  • linkdata.attributes.name

    string

    The human-readable name of the package. This can be used as an optional label.

  • linkdata.attributes.key

    string

    The machine-readable key of the package.

  • linkdata.attributes.engine

    string

    The engine for the package. Set to null for no engine.

    Options
  • linkdata.attributes.metadata

    object<string, any>

    Object containing package metadata. This can be used to store arbitrary key-value data, e.g. for book keeping or display purposes.

  • linkdata.attributes.created

    timestamp (iso8601)read only

    When the package was created.

  • linkdata.attributes.updated

    timestamp (iso8601)read only

    When the package was last updated.

linkRelationships

  • linkdata.relationships.account

    individual

    The account that the package belongs to.

  • linkdata.relationships.environment

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

    The environment that the package belongs to.

  • linkdata.relationships.product

    individual

    The product that the package belongs to.

Example object

{
"data": {
"id": "ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
"type": "packages",
"attributes": {
"name": "machineid",
"key": "machineid",
"engine": "pypi",
"metadata": {},
"created": "2023-07-26T15:16:43.455Z",
"updated": "2023-07-26T15:16:43.455Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"product": {
"links": {
"related": "/v1/accounts/<account>/products/0d5f0b57-3102-4ddf-beb9-f652cf8e24b7"
},
"data": {
"type": "products",
"id": "0d5f0b57-3102-4ddf-beb9-f652cf8e24b7"
}
}
},
"links": {
"self": "/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08"
}
}
}

linkCreate a package

Creates a new package resource. Packages can be used to enable an engine for a product. In addition, they can be used to group releases.

For example, you can have a single product offering a PyPI toolset, with multiple packages all released and versioned separately.

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.

linkAttributes

  • linkdata.attributes.name

    stringoptional

    The human-readable name of the package. This can be used as an optional label.

  • linkdata.attributes.key

    stringrequired

    The machine-readable key of the package.

  • linkdata.attributes.engine

    stringoptional

    The engine for the package. Set to null for no engine.

    Options
  • linkdata.attributes.metadata

    object<string, any>optional

    Object containing package metadata. This can be used to store arbitrary key-value data, e.g. for book keeping or display purposes.

linkRelationships

linkReturns

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

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/packages", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json"
},
body: JSON.stringify({
"data": {
"type": "package",
"attributes": {
"name": "machineid",
"key": "machineid",
"engine": "pypi"
},
"relationships": {
"product": {
"data": {
"type": "product",
"id": "855ef427-6f68-4153-ab88-e63c631014c3"
}
}
}
}
})
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.post(
"https://api.keygen.sh/v1/accounts/<account>/packages",
headers={
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
},
data=json.dumps({
"data": {
"type": "package",
"attributes": {
"name": "machineid",
"key": "machineid",
"engine": "pypi"
},
"relationships": {
"product": {
"data": {
"type": "product",
"id": "855ef427-6f68-4153-ab88-e63c631014c3"
}
}
}
}
})
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/packages",
method: .post,
headers: [
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json",
"Authorization": "Bearer <token>"
],
parameters: [
"data": [
"type": "package",
"attributes": [
"name": "machineid",
"key": "machineid",
"engine": "pypi"
],
"relationships": [
"product": [
"data": [
"type": "product",
"id": "855ef427-6f68-4153-ab88-e63c631014c3"
]
]
]
]
],
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("packages", 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 = "packages",
attributes = new {
name = "machineid",
key = "machineid",
engine = "pypi"
},
relationships = new {
product = new {
data = new { type = "products", id = "855ef427-6f68-4153-ab88-e63c631014c3" }
}
}
}
});
 
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 "packages",
"attributes" to mapOf(
"name" to "machineid",
"key" to "machineid",
"engine" to "pypi"
),
"relationships" to mapOf(
"product" to mapOf(
"data" to mapOf("type" to "products", "id" to "855ef427-6f68-4153-ab88-e63c631014c3")
)
)
)
))
 
val res = Unirest.post("https://api.keygen.sh/v1/accounts/<account>/packages")
.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", "packages"),
entry("attributes", ofEntries(
entry("name", "machineid")
entry("key", "machineid")
entry("engine", "pypi")
),
entry("relationships", ofEntries(
entry("product", ofEntries(
entry("data", ofEntries(
entry("type", "products"),
entry("id", "855ef427-6f68-4153-ab88-e63c631014c3")
))
))
))
))
));
 
HttpResponse<JsonNode> res = Unirest.post("https://api.keygen.sh/v1/accounts/<account>/packages")
.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("machineid");
attrs["key"] = value::string("machineid");
attrs["engine"] = value::string("pypi");
 
value product_linkage;
product_linkage["type"] = value::string("products");
product_linkage["id"] = value::string("855ef427-6f68-4153-ab88-e63c631014c3");
 
value product;
product["data"] = product_linkage;
 
value rels;
rels["product"] = product;
 
value data;
data["type"] = value::string("packages");
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("/packages");
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>/packages \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-d '{
"data": {
"type": "package",
"attributes": {
"name": "machineid",
"key": "machineid",
"engine": "pypi"
},
"relationships": {
"product": {
"data": {
"type": "product",
"id": "855ef427-6f68-4153-ab88-e63c631014c3"
}
}
}
}
}'

Example response / 201 Created

{
"data": {
"id": "ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
"type": "packages",
"attributes": {
"name": "machineid",
"key": "machineid",
"engine": "pypi",
"metadata": {},
"created": "2023-07-26T15:16:43.455Z",
"updated": "2023-07-26T15:16:43.455Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"product": {
"links": {
"related": "/v1/accounts/<account>/products/0d5f0b57-3102-4ddf-beb9-f652cf8e24b7"
},
"data": {
"type": "products",
"id": "0d5f0b57-3102-4ddf-beb9-f652cf8e24b7"
}
}
},
"links": {
"self": "/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08"
}
}
}

linkRetrieve a package

Retrieves the details of an existing package.

linkAuthentication

  • linkBearer

    optional

    An authentication token with privileges to read the package: either an admin, the product it belongs to, an entitled license (via license key or a license token), or a user with an entitled license. If the product's distribution strategy is OPEN, no authentication is required.

linkURL Parameters

  • link<account>

    stringrequired

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

  • link<package>

    stringrequired

    The identifier (UUID) or key of the package to be retrieved.

linkReturns

A 200 OK response will be returned along with a package 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>/packages/<package>

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08", {
method: "GET",
headers: {
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.get(
"https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
headers={
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
headers: [
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
]
).responseJSON { response in
let json = JSON(data: response.data!)
}
using RestSharp;
 
var client = new RestClient("https://api.keygen.sh/v1/accounts/<account>");
var request = new RestRequest(
"packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
Method.GET
);
 
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Accept", "application/vnd.api+json");
 
var response = client.Execute(request);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
 
val res = Unirest.get("https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08")
.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>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08")
.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("/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08");
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>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08 \
-H 'Authorization: Bearer <token>' \
-H 'Accept: application/vnd.api+json'

Example response / 200 OK

{
"data": {
"id": "ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
"type": "packages",
"attributes": {
"name": "machineid",
"key": "machineid",
"engine": "pypi",
"metadata": {},
"created": "2023-07-26T15:16:43.455Z",
"updated": "2023-07-26T15:16:43.455Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"product": {
"links": {
"related": "/v1/accounts/<account>/products/0d5f0b57-3102-4ddf-beb9-f652cf8e24b7"
},
"data": {
"type": "products",
"id": "0d5f0b57-3102-4ddf-beb9-f652cf8e24b7"
}
}
},
"links": {
"self": "/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08"
}
}
}

linkUpdate a package

Updates the specified package 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<package>

    stringrequired

    The identifier (UUID) or key of the package to be updated.

linkAttributes

  • linkdata.attributes.name

    stringoptional

    The human-readable name of the package. This can be used as an optional label.

  • linkdata.attributes.key

    stringoptional

    The machine-readable key of the package.

  • linkdata.attributes.engine

    stringoptional

    The engine for the package. Set to null for no engine.

    Options
  • linkdata.attributes.metadata

    object<string, any>optional

    Object containing package metadata. This can be used to store arbitrary key-value data, e.g. for book keeping or display purposes.

linkReturns

A 200 OK response will be returned along with the updated license 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>/packages/<package>

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08", {
method: "PATCH",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json"
},
body: JSON.stringify({
"data": {
"type": "packages",
"attributes": {
"engine": "pypi"
}
}
})
})
 
const { data, errors } = await response.json()
import requests
import json
 
res = requests.patch(
"https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
headers={
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json"
},
data=json.dumps({
"data": {
"type": "packages",
"attributes": {
"engine": "pypi"
}
}
})
).json()
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
method: .patch,
headers: [
"Authorization": "Bearer <token>",
"Content-Type": "application/vnd.api+json",
"Accept": "application/vnd.api+json"
],
parameters: [
"data": [
"type": "packages",
"attributes": [
"engine": "pypi"
]
]
],
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(
"packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
Method.PATCH
);
 
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/vnd.api+json");
request.AddHeader("Accept", "application/vnd.api+json");
 
request.AddJsonBody(new {
data = new {
type = "packages",
attributes = new {
engine = "pypi"
}
}
});
 
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 "packages",
"attributes" to mapOf(
"engine" to "pypi"
)
)
))
 
val res = Unirest.patch("https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08")
.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", "packages"),
entry("attributes", ofEntries(
entry("engine", "pypi")
))
))
));
 
HttpResponse<JsonNode> res = Unirest.patch("https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08")
.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["engine"] = value::string("pypi");
 
value data;
data["type"] = value::string("packages");
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("/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08");
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>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08 \
-H 'Authorization: Bearer <token>' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-d '{
"data": {
"type": "packages",
"attributes": {
"engine": "pypi"
}
}
}'

Example response / 200 OK

{
"data": {
"id": "ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
"type": "packages",
"attributes": {
"name": "machineid",
"key": "machineid",
"engine": "pypi",
"metadata": {},
"created": "2023-07-26T15:16:43.455Z",
"updated": "2023-07-26T15:16:43.455Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"product": {
"links": {
"related": "/v1/accounts/<account>/products/0d5f0b57-3102-4ddf-beb9-f652cf8e24b7"
},
"data": {
"type": "products",
"id": "0d5f0b57-3102-4ddf-beb9-f652cf8e24b7"
}
}
},
"links": {
"self": "/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08"
}
}
}

linkDelete a package

Permanently deletes a package. It cannot be undone. This action also immediately deletes any releases and artifacts that the package is associated with.

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<package>

    stringrequired

    The identifier (UUID) or key of the package 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>/packages/<package>

Example request

const fetch = require("node-fetch")
 
const response = await fetch("https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08", {
method: "DELETE",
headers: {
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
})
import requests
 
res = requests.delete(
"https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
headers={
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
}
)
import SwiftyJSON
import Alamofire
 
Alamofire.request("https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
method: .delete,
headers: [
"Authorization": "Bearer <token>",
"Accept": "application/vnd.api+json"
]
).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(
"packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
Method.DELETE
);
 
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Accept", "application/vnd.api+json");
 
var response = client.Execute(request);
import com.mashape.unirest.http.exceptions.*
import com.mashape.unirest.http.*
 
val res = Unirest.delete("https://api.keygen.sh/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08")
.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>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08")
.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("/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08");
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>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08 \
-H 'Authorization: Bearer <token>' \
-H 'Accept: application/vnd.api+json'

Example response / 204 No Content

No content

linkList all packages

Returns a list of packages. The packages are returned sorted by creation date, with the most recent published packages appearing first. Resources are automatically scoped to the authenticated bearer e.g. when authenticated as a license or user, only packages accessible by the requestor will be listed.

linkAuthentication

  • linkBearer

    optional

    An authentication token with privileges to read the packages: either an admin, the product the packages belong to, an entitled license (via license key or a license token), or a user with an entitled license. If the product's distribution strategy is OPEN, no authentication is required.

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

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

    string

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

    /v1/accounts/<account>/packages?product=3ab38aae-bbf7-4846-9c32-af9d94bf5ad4
  • linkengine

    string

    The identifier (UUID) or key of the engine to filter by.

    /v1/accounts/<account>/packages?engine=pypi

linkReturns

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

Example request

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

Example response / 200 OK

{
"data": [
{
"id": "ff1b4222-19d9-400b-8ffd-be5dfdadbc08",
"type": "packages",
"attributes": {
"name": "machineid",
"key": "machineid",
"engine": "pypi",
"metadata": {},
"created": "2023-07-26T15:16:43.455Z",
"updated": "2023-07-26T15:16:43.455Z"
},
"relationships": {
"account": {
"links": {
"related": "/v1/accounts/<account>"
},
"data": {
"type": "accounts",
"id": "<account>"
}
},
"product": {
"links": {
"related": "/v1/accounts/<account>/products/0d5f0b57-3102-4ddf-beb9-f652cf8e24b7"
},
"data": {
"type": "products",
"id": "0d5f0b57-3102-4ddf-beb9-f652cf8e24b7"
}
}
},
"links": {
"self": "/v1/accounts/<account>/packages/ff1b4222-19d9-400b-8ffd-be5dfdadbc08"
}
},
]
}