KDPika Licensing Sign inStart free
API v1
Show all languages
Browse documentation

Choose a page in the navigation drawer.

KDPika Licensing · API v1 Intermediate

Retrieve the public key

Retrieve the current public verification key.

On this page
Updated 2026-10-17 UTCDownload Markdown

Retrieve the current public verification key.

What you will learn

  • Send this exact operation with its required credentials and fields.
  • Interpret success, refusal, side effects and retry risks.

Prerequisites

Method and path

GET /api/v1/public-key

When to use it

Fetch the current Ed25519 verification key during a trusted setup or controlled key refresh. This endpoint is global, not specific to an organization or environment.

Authentication and environment

No credential or environment header is required.

Request headers

HeaderRequiredDescriptionExample
AcceptrecommendedJSON responsesapplication/json

Path and query parameters

No path parameters are accepted.

No pagination, filtering, sorting or list query parameters are implemented. Use JSON rather than relying on alternate form/query parsing.

Request body

No request body is consumed. Send this GET request without a body.

The schemas describe supported recommended input types. Current PHP parsing trims/casts strings and may ignore unknown fields; it is not strict JSON-schema validation. Invalid optional descriptive fields can become empty/null. Conventions describes malformed JSON and alternate parsing.

Success response

HTTP 200. The following is a real isolated Sandbox capture; secret values are replaced with explicit placeholders.

jsonjson
{
  "success": true,
  "key": {
    "algorithm": "Ed25519",
    "key_id": "ed25519_2b9bc7e214b1209f",
    "public_key": "3VNX3t2NIvzg37o1w-bjxJdJVFtgbfpR-_Q80u4U5tQ",
    "encoding": "base64url"
  },
  "request_id": "req_d9e278f6722a692a5dc3bbe8"
}

Response fields

FieldTypeRequiredConstraintsDescriptionExample
successbooleanyesconst=trueThe operation succeeded.true
keyobjectyesSee descriptionCurrent global verification key, not a historical key ring.Nested object/array shown in full JSON
key.algorithmstringyesconst="Ed25519"Fixed verification algorithm."Ed25519"
key.key_idstringyespattern="^ed25519_[a-f0-9]{16}$"ed25519_ plus first16 hex SHA256 characters of raw public key."ed25519_2b9bc7e214b1209f"
key.public_keystringyespattern="^[A-Za-z0-9_-]{43}$"Unpadded base64url of32 raw Ed25519 public-key bytes."3VNX3t2NIvzg37o1w-bjxJdJVFtgbfpR-_Q80u4U5tQ"
key.encodingstringyesconst="base64url"Raw-key encoding."base64url"
request_idstringyespattern="^req_[a-f0-9]{24}$"Request correlation ID. Replay bodies can retain an earlier ID."req_d9e278f6722a692a5dc3bbe8"

Response headers

X-Request-ID identifies the current request. Successful limited calls include X-RateLimit-Remaining and X-RateLimit-Reset, the latter in Unix seconds.

Errors omit those rate headers and Retry-After. See the complete rate-limit reference.

Error responses

CodeHTTPCauseFixRetryable?
RATE_LIMITED429Bucket exhausted; wait for window reset; no licensing Retry-After headerAfter window; apply jitterAfter the 60-second window, with jitter
INTERNAL_ERROR500Uncaught exception at global boundarySafe retry only for idempotent operation; preserve request_idOnly safe reads after backoff; reconcile mutations

An unregistered path or wrong method is handled by the global router as NOT_FOUND (HTTP 404), not405. Every licensing error has success=false, error.code, error.message and request_id. Errors keeps SDK-local and operational namespaces separate.

Side effects

No license, device, token, customer, audit event, webhook or email is created. The public-key IP limiter is consumed. The global API metadata log has no organization attribution.

Authenticated requests can consume the organization monthly API usage counter once tenant context is established, including some failures. This usage counter is currently warning-only, not a monthly API rejection gate. Developer-key authentication can update last_used_at before a later failure. No request body or Authorization value is saved by the API metadata logger.

Idempotency and concurrency

GET is safe to retry with bounded backoff. Cache the successful key for the advertised3600 seconds, subject to your pinned-key refresh policy. A timeout never justifies disabling verification. The endpoint returns only the current key, not a historical key ring.

Rate limits

60 requests per60 seconds, keyed by the caller IP.

Fixed windows begin with the first hit after expiry. Attempted calls consume every bucket they reach, even if later business validation fails.

Runnable examples

These are complete native HTTP transport programs, not full SDK clients or entitlement verifiers. JSON request bodies and credentials come from KDP_* environment variables. They print raw responses to a private terminal; do not send their stdout to application/CI logs. Use the P5 verification guides before granting access.

Kotlin

Save every file shown below. Install the exact runtime/dependencies from the complete example archive README. Set the endpoint request JSON in KDP_BODY_JSON and the documented KDP_* credential variables in your private process environment.

Run java -cp request.jar:gson.jar RequestKt public-key. Expected: full JSON, exit 0 for success, exit 1 for an API rejection; exit 2 for setup/transport failure. The cURL sample checks HTTP status; parse JSON before use. Never authorize a feature from transport output alone.

Request.ktkotlin
// Purpose: inspect one client-callable Sandbox operation; not an entitlement verifier.
// Requires Kotlin2.4.21/JVM17+, Gson2.14.0. Run compiled RequestKt with public-key.
// Expected: raw JSON; exit0 success/1 API rejection/2 setup or transport failure.
// KDP_* variables carry credentials/body; private terminal only, never application/CI logs.
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import java.time.Duration
import com.google.gson.JsonParser
import com.google.gson.JsonPrimitive
import kotlin.system.exitProcess

val operationsJson = """
{
  "public-key": {
    "method": "GET",
    "path": "/public-key",
    "auth": "public"
  },
  "activate": {
    "method": "POST",
    "path": "/licenses/activate",
    "auth": "publicApp"
  },
  "validate": {
    "method": "POST",
    "path": "/licenses/validate",
    "auth": "activation"
  },
  "deactivate": {
    "method": "POST",
    "path": "/licenses/deactivate",
    "auth": "activation"
  }
}
""".trimIndent()
fun required(name: String): String = (System.getenv(name) ?: "").also {
    require(it.isNotEmpty() && !it.contains('\r') && !it.contains('\n')) { "Missing configuration." }
}
fun main(args: Array<String>) {
    try {
        val operations = JsonParser.parseString(operationsJson).asJsonObject
        require(args.size == 1 && operations.has(args[0]))
        val name = args[0]; val op = operations.getAsJsonObject(name)
        val base = (System.getenv("KDP_BASE_URL") ?: "https://licensing.kdpika.com/api/v1").trimEnd('/')
        val uri = URI.create(base)
        val local = uri.scheme == "http" && uri.host in listOf("localhost", "127.0.0.1") && System.getenv("KDP_ALLOW_LOOPBACK") == "1"
        require(uri.host != null && (uri.scheme == "https" || local) && uri.userInfo == null && uri.query == null && uri.fragment == null && uri.path == "/api/v1")
        val request = HttpRequest.newBuilder(URI.create(base + op["path"].asString)).timeout(Duration.ofSeconds(15))
            .header("Accept", "application/json").header("User-Agent", "KDPikaDocsExample/1.0 Kotlin")
        when (op["auth"].asString) {
            "publicApp" -> request.header("X-App-ID", required("KDP_APP_ID")).header("X-Environment", "SANDBOX")
            "activation" -> request.header("Authorization", "Bearer " + required("KDP_ACTIVATION_TOKEN"))
        }
        if (name == "validate") request.header("X-Installation-ID", required("KDP_INSTALLATION_ID"))
        if (op["method"].asString == "POST") {
            val body = System.getenv("KDP_BODY_JSON") ?: "{}"
            require(JsonParser.parseString(body).isJsonObject)
            request.header("Content-Type", "application/json").POST(HttpRequest.BodyPublishers.ofString(body))
        } else request.GET()
        val client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(5)).followRedirects(HttpClient.Redirect.NEVER).build()
        val response = client.send(request.build(), HttpResponse.BodyHandlers.ofString())
        val result = JsonParser.parseString(response.body()).asJsonObject
        System.out.write(response.body().toByteArray(Charsets.UTF_8)); System.out.write(10)
        if (response.statusCode() !in 200..299 || result["success"] != JsonPrimitive(true)) {
            System.err.println("API rejection. Inspect error.code/request_id; reconcile mutations before retrying."); exitProcess(1)
        }
    } catch (error: Exception) {
        System.err.println("Request unavailable or configuration invalid. Check KDP_* settings/connectivity; do not blindly retry mutations."); exitProcess(2)
    }
}

Expected result

A correctly authenticated eligible request returns the documented HTTP status and schema. Check the actual success/error result and request IDs; a successful transport or unsigned management response does not grant a feature.

Common mistakes

  • Mixing Public App IDs, internal product IDs and product-plan IDs.
  • Assuming a mutation timeout means no work committed, or assuming Idempotency-Key protects every action.
  • Logging raw responses that contain a newly issued license key or activation token.

Security notes

Keep lmp_ credentials out of shipped desktop/browser code. Verify signed payload bytes and product/environment/installation/status/time/feature policy. The examples do not fix the documented idempotency, cache canonicalization or current-key-only rotation limitations.

Troubleshooting

SymptomCauseAction
RATE_LIMITED (HTTP 429)Bucket exhausted; wait for window reset; no licensing Retry-After headerAfter window; apply jitter
INTERNAL_ERROR (HTTP 500)Uncaught exception at global boundarySafe retry only for idempotent operation; preserve request_id

Next steps

Read idempotency and signed responses before integrating a purchase-to-license workflow.

Was this page helpful?

Choose an answer

Do not include personal data, license keys or credentials. Retained for up to 30 days. This is not a support inbox.

Search documentation

Arrow keys to move, Enter to open, Escape to close. Search stays in your browser.

Cookie settings