License Keys
Get License Key
Get a license key.
Scopes: customer_portal:read customer_portal:write
GET
/
v1
/
customer-portal
/
license-keys
/
{id}
Go (SDK)
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.LicenseKeys.Get(ctx, operations.CustomerPortalLicenseKeysGetSecurity{
CustomerSession: polargo.Pointer(os.Getenv("POLAR_CUSTOMER_SESSION")),
}, "<value>")
if err != nil {
log.Fatal(err)
}
if res.LicenseKeyWithActivations != nil {
// handle response
}
}import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.license_keys.get(security=polar_sdk.CustomerPortalLicenseKeysGetSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), id="<value>")
# Handle response
print(res)import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.licenseKeys.get({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$requestSecurity = new Operations\CustomerPortalLicenseKeysGetSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->licenseKeys->get(
security: $requestSecurity,
id: '<value>'
);
if ($response->licenseKeyWithActivations !== null) {
// handle response
}curl --request GET \
--url https://api.polar.sh/v1/customer-portal/license-keys/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/customer-portal/license-keys/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.polar.sh/v1/customer-portal/license-keys/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customer-portal/license-keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"organization_id": "<string>",
"customer_id": "<string>",
"customer": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"metadata": {},
"email_verified": true,
"name": "John Doe",
"billing_name": "John Doe",
"billing_address": {
"line1": "<string>",
"line2": "<string>",
"postal_code": "<string>",
"city": "<string>",
"state": "<string>"
},
"tax_id": {
"[0]": "<string>"
},
"organization_id": "<string>",
"deleted_at": "2023-11-07T05:31:56Z",
"avatar_url": "<string>",
"external_id": "usr_1337",
"email": "customer@example.com",
"locale": "<string>",
"default_payment_method_id": "<string>"
},
"benefit_id": "<string>",
"key": "<string>",
"display_key": "<string>",
"limit_activations": 123,
"usage": 123,
"limit_usage": 123,
"validations": 123,
"last_validated_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"activations": [
{
"id": "<string>",
"license_key_id": "<string>",
"label": "<string>",
"meta": {},
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": "<string>",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
customer_sessionmember_session
Customer session tokens are specific tokens that are used to authenticate customers on your organization. You can create those sessions programmatically using the Create Customer Session endpoint.
Path Parameters
Response
Successful Response
The ID of the object.
Creation timestamp of the object.
Last modification timestamp of the object.
Show child attributes
Show child attributes
The benefit ID.
Available options:
granted, revoked, disabled Show child attributes
Show child attributes
Was this page helpful?
⌘I
Go (SDK)
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.LicenseKeys.Get(ctx, operations.CustomerPortalLicenseKeysGetSecurity{
CustomerSession: polargo.Pointer(os.Getenv("POLAR_CUSTOMER_SESSION")),
}, "<value>")
if err != nil {
log.Fatal(err)
}
if res.LicenseKeyWithActivations != nil {
// handle response
}
}import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.license_keys.get(security=polar_sdk.CustomerPortalLicenseKeysGetSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), id="<value>")
# Handle response
print(res)import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.licenseKeys.get({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$requestSecurity = new Operations\CustomerPortalLicenseKeysGetSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->licenseKeys->get(
security: $requestSecurity,
id: '<value>'
);
if ($response->licenseKeyWithActivations !== null) {
// handle response
}curl --request GET \
--url https://api.polar.sh/v1/customer-portal/license-keys/{id} \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/customer-portal/license-keys/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.polar.sh/v1/customer-portal/license-keys/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customer-portal/license-keys/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"organization_id": "<string>",
"customer_id": "<string>",
"customer": {
"id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z",
"metadata": {},
"email_verified": true,
"name": "John Doe",
"billing_name": "John Doe",
"billing_address": {
"line1": "<string>",
"line2": "<string>",
"postal_code": "<string>",
"city": "<string>",
"state": "<string>"
},
"tax_id": {
"[0]": "<string>"
},
"organization_id": "<string>",
"deleted_at": "2023-11-07T05:31:56Z",
"avatar_url": "<string>",
"external_id": "usr_1337",
"email": "customer@example.com",
"locale": "<string>",
"default_payment_method_id": "<string>"
},
"benefit_id": "<string>",
"key": "<string>",
"display_key": "<string>",
"limit_activations": 123,
"usage": 123,
"limit_usage": 123,
"validations": 123,
"last_validated_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"activations": [
{
"id": "<string>",
"license_key_id": "<string>",
"label": "<string>",
"meta": {},
"created_at": "2023-11-07T05:31:56Z",
"modified_at": "2023-11-07T05:31:56Z"
}
]
}{
"error": "<string>",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
