# Signatures & fields

Every licence answer — success or error — is an Ed25519-signed envelope. Verify the signature over the payload string first, then decode the payload.

## Public key

Embed this key in your software. It is also served at `GET /api/license/public-key`; the `kid` in each answer tells you which key signed it, so a future key can be added without breaking installs.

```text
5Uk3p1+J0PXzJkwS4wVFvTN9GcHpJzX5ClRI8zlI0yQ=
```

Embed the standby key too — every key listed below as `next`. It does not sign anything today; it is there so that, if the active key ever had to be replaced in a hurry, your installations keep verifying answers without an update. See [Key rotation](https://sellmycode.net/api-docs/key-rotation.md).

Keys published right now:

| kid | status | public key |
|---|---|---|
| `k1` | active | `5Uk3p1+J0PXzJkwS4wVFvTN9GcHpJzX5ClRI8zlI0yQ=` |
| `k2` | next | `erOiojOdS5F/IfhPMO9gvjAvuEPVapIadTDaWU0z83o=` |


Libraries that want PEM/SPKI instead of the raw key (OpenSSL, Java, .NET) can use this — the same key wrapped in the standard 12-byte Ed25519 SPKI header:

```text
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA5Uk3p1+J0PXzJkwS4wVFvTN9GcHpJzX5ClRI8zlI0yQ=
-----END PUBLIC KEY-----
```

## Key and signature format

| Item | Format |
|---|---|
| Algorithm | Ed25519 as defined in RFC 8032 (pure Ed25519 — no pre-hashing, no context string) |
| Public key | the raw 32-byte Ed25519 public key, standard Base64 with padding (44 characters). Not PEM, not DER, not hex. |
| Signature | the raw 64-byte Ed25519 signature, standard Base64 with padding (88 characters) |
| Signed message | the exact UTF-8 bytes of the payload string as it appears in the envelope — verify before decoding; never re-encode the JSON and verify that |
| kid | short string naming the key that signed this answer; pick the matching public key by it |
| Timestamps | ISO 8601 with offset, always UTC (+00:00) |

## Response format

```json
{
  "payload": "{\"status\":\"success\",\"code\":\"activated\", … }",
  "signature": "base64 Ed25519 signature of payload",
  "kid": "k1",
  "alg": "Ed25519"
}
```

Decoded payload of an activate call:

```json
{
  "status": "success",
  "code": "activated",
  "domain": "customer-site.com",
  "license_type": "Regular",
  "activation_limit": 2,
  "activations_used": 1,
  "updates": { "active": true, "until": "2027-01-30T10:00:00+00:00" },
  "activation_token": "9f2c…e41a",
  "grace_until": "2026-10-16T08:00:00+00:00",
  "nonce": "the nonce you sent",
  "issued_at": "2026-10-09T08:00:00+00:00"
}
```

## Fields returned

Envelope — the top level of every answer:

| Field | Type | Description |
|---|---|---|
| `payload` | string | the signed JSON document, as a string |
| `signature` | string | Base64 Ed25519 signature of payload |
| `kid` | string | which key signed it |
| `alg` | string | always "Ed25519" |

Payload of a successful verify (HTTP 200, code "valid"). activate returns the same fields:

| Field | Type | Description |
|---|---|---|
| `status` | string | "success" |
| `code` | string | verify: "valid" · activate: "activated" (a new domain took a slot), "reactivated" (a paused domain resumed on the slot it already held) or "already_activated" |
| `domain` | string | the domain as we stored it: lower case, no scheme, no www, no path |
| `item.id` | integer | item id on SellMyCode — check it is YOUR item, so a code bought for another product is not accepted |
| `item.name` | string | item title |
| `item.version` | string | latest published version |
| `item.url` | string | item page |
| `license_type` | string | "Regular" \| "Extended" |
| `purchased_at` | string | ISO 8601, UTC |
| `activation_limit` | integer \| null | sites this licence may run on; null = unlimited |
| `activations_used` | integer | slots in use: active and paused sites (a paused site keeps its slot) |
| `slot_bound` | boolean | this domain holds one of the licence's slots |
| `slot_released` | boolean | the author revoked this domain and its slot was freed |
| `updates.active` | boolean | whether the buyer may still download updates — informational, never a reason to stop working |
| `updates.until` | string \| null | end of the update period, ISO 8601 UTC; null = no end date |
| `updates.renew_url` | string \| null | where to renew, set only once updates have ended |
| `grace_until` | string | run on this answer until this time if we cannot be reached (currently 7 days ahead) |
| `nonce` | string | the nonce you sent — must match |
| `issued_at` | string | when we signed it, ISO 8601 UTC |
| `activation_token` | string \| null | activate only: 48 hex characters on "activated"; null on "already_activated" |
| `entitlement` | string \| null | a 24-hour JWT (EdDSA) for your own update server; on verify and "already_activated" only when you send `activation_token` — see [Entitlement tokens](https://sellmycode.net/api-docs/licence-entitlement.md) |
| `hint` | string | activate only, with "already_activated" |

Payload of deactivate (HTTP 200, code "deactivated"): status, code, domain, activations_used, activation_limit, slot_bound (true), slot_released (false), nonce, issued_at.

Payload of every error: status ("error"), code, msg, nonce (null if yours was missing or malformed), issued_at — plus, depending on the code, activation_limit, activations_used, slot_bound, slot_released, hint, transfer_url (with activation_limit_reached, license_blocked and site_blocked) and retry_after (seconds, with rate_limited).

> **Note:** New fields may be added to the payload over time; ignore fields you do not know. Existing fields keep their name and type.

---
Source: https://sellmycode.net/api-docs/licence-signatures
