Skip to main content
POST
/
v1
/
customer-portal
/
license-keys
/
activate
Go (SDK)
package main

import(
	"context"
	polargo "github.com/polarsource/polar-go"
	"github.com/polarsource/polar-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := polargo.New()

    res, err := s.CustomerPortal.LicenseKeys.Activate(ctx, components.LicenseKeyActivate{
        Key: "<key>",
        OrganizationID: "<value>",
        Label: "<value>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.LicenseKeyActivationRead != nil {
        // handle response
    }
}
{
  "id": "<string>",
  "license_key_id": "<string>",
  "label": "<string>",
  "meta": {},
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "license_key": {
    "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,
      "type": "individual",
      "name": "John Doe",
      "billing_address": {
        "country": "AD",
        "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>"
    },
    "benefit_id": "<string>",
    "key": "<string>",
    "display_key": "<string>",
    "status": "granted",
    "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"
  }
}

Documentation Index

Fetch the complete documentation index at: https://polar.sh/docs/llms.txt

Use this file to discover all available pages before exploring further.

You only need to use this endpoint if you have device activations enabled on the license key benefit. You then use this endpoint to reserve an allocation for a specific device. Storing the unique activation ID from the response on the device and using it as extra validation in the /validate endpoint.Not using activations? Just use the /validate endpoint directly instead.

Body

application/json
key
string
required
organization_id
string<uuid4>
required
label
string
required
conditions
Conditions · object

Key-value object allowing you to set conditions that must match when validating the license key.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

meta
Meta · object

Key-value object allowing you to store additional information about the activation

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

Response

Successful Response

id
string<uuid4>
required
license_key_id
string<uuid4>
required
label
string
required
meta
Meta · object
required
created_at
string<date-time>
required
modified_at
string<date-time> | null
required
license_key
LicenseKeyRead · object
required