comecerodocs

Create a license

POST
/licenses

Gets a new license key from a license service for one item of an order, saves it and adds it to the order item. Use it to issue a key by hand. A license request is recorded either way. For a remote_url service your server is called during this request, and its failure is returned as 502. Send save: false to fetch a key without saving it. A generated service is refused, with or without save: false (400, code invalid_input, reference LkMan01): Comecero makes its keys when the order is paid. Secret and trusted tokens may call it.

Authorization

headerAuthorizationBearer <token>

A secret, trusted or limited token. See Authentication.

Query Parameters

expand?string

Comma-separated child objects to return in full instead of as a URL, for example customer,payments. Use dot notation for nested objects (items.product), up to four levels deep. A single object takes up to 12 paths; a list takes up to 2, applied to every item. Extra paths are dropped without an error. See Expanding objects.

show?string

Comma-separated fields to return; all others are left out. Use dot notation for child fields (customer.email). You cannot send show and hide together (400). See Customizing output.

hide?string

Comma-separated fields to leave out of the response. Use dot notation for child fields (customer.email). You cannot send show and hide together (400). See Customizing output.

formatted?boolean

When true, the object also has a formatted child with amounts and dates as display text in the shopper's language and currency (for example $19.99 or November 7, 2026). The default is false. See Localized formatting.

Defaultfalse

Request Body

Which service, order and item the key is for.

application/json
  1. body

Asks a license service for a key for one item of an order, for example to issue a key by hand or to replace one.

license_service_id*string

The license service to get the key from. Must be one of yours, and a list or remote_url service.

order_id*string

The order the key is for. Must be one of your orders.

product_id*string

The product of the order item the key is for. It must be an item of the order.

item_id?string

The order item the key is for. When left out, product_id is used.

account_id*string

Your account id. Required: the order is looked up with the account id in the body, so without it, or with another account's id, the order is not found (404).

save?boolean

When false, the key is fetched and returned but not saved or added to the order. The license request is still recorded. The default is true.

Response Body

The new license.

application/json
  1. response

A license key issued for one item of an order, from the product's license service. A limited token may read a license only when it is bound to it, such as the customer's own order. Every field is returned unless show or hide (on the request, or on the event subscription for a webhook) leaves it out, except the fields from key_last4 to version, which only generated keys have.

object?"license"

The object type. Always license.

Value in"license"
url?string

The URL of this license in the API.

Formaturi
license_id?string

The id of the license.

date_created?string

When the license was issued.

Formatdate-time
date_modified?string

When the license was last changed.

Formatdate-time
test?boolean

True for a test-mode license.

item_id?string

The order item the license is for. The same as the product id.

account_id?string

The account the license belongs to.

label?string

What the key is called, copied from the license service, for example License Code.

license_service?|

The license service that issued the key, as a link, or the full object when you send expand=license_service. Not returned to limited tokens.

order?|

The order, as a link, or the full object when you send expand=order.

product?|

The product, as a link, or the full object when you send expand=product.

text?|

The key as plain text, with any HTML removed. For a generated key, the key itself. Always null for a generated key in a webhook (any event, at any expand depth), which never carries the key.

html?|

The key as HTML, with line breaks turned into <br>. For a generated key, the key itself, HTML-encoded. Always null for a generated key in a webhook.

instructions?|

How to use the key, from the license service or your license server.

key_last4?string

The last 4 characters of the key, without dashes, to tell keys apart without showing them. Only on generated keys.

status?string

Whether the key can still be used. A key past its expires_at stays active here; the license key routes answer EXPIRED for it. Only on generated keys.

Value in"active""revoked"
revoked_reason?|

Why the key was revoked: refund (the order item was fully refunded) or chargeback (a payment of the order was charged back). Null while the key is active. subscription_cancelled and merchant are reserved and not set today. Only on generated keys.

Value in"refund""chargeback""subscription_cancelled""merchant"null
date_revoked?|

When the key was revoked, or null. Only on generated keys.

Formatdate-time
activation_limit?|

How many devices the key can be active on at once: the service's activation_limit times the quantity bought, lowered by a partial refund. Null is unlimited. Only on generated keys.

expires_at?|

When the key stops working, or null if it never expires. For a subscription, the end of the last paid period plus the service's subscription_grace_days; each renewal moves it later. Only on generated keys.

Formatdate-time
customer_id?|

The customer who bought the key. Only on generated keys.

subscription_id?|

The subscription the key was sold with, or null for a one-off sale. One key serves the whole subscription. Only on generated keys.

source?string

Where the key came from. generated when Comecero made it. Present only on keys of a generated service; keys from list and remote_url services have none of the fields from key_last4 to source.

Value in"generated""imported"
version?integer

Goes up by one with every change to the key. Webhooks can arrive out of order, so keep the license with the highest version you have seen and ignore an event with a lower one. Changes made close together can be sent as one event with the latest state, and a change to none of status, activation_limit and expires_at (such as revoked_reason moving from refund to chargeback) sends no event, so the version in events can skip numbers. license:expired does not raise version, so it can carry the same one as an earlier event (such as license:issued or license:reinstated): treat an equal version as current, and skip repeats by event_id, not by version. Only on generated keys.

Range1 <= value
formatted?

Present only when you send formatted=true.

curl -X POST 'https://api.comecero.com/api/v1/licenses' \  -H 'Content-Type: application/json' \  -d '{  "license_service_id": "0095012789659LsuOeAWLC",  "order_id": "7393-GMRFY-954",  "product_id": "widget-pro.test",  "account_id": "AB1234"}'
Example Response
{  "object": "license",  "url": "https://api.comecero.com/api/v1/licenses/0142130710581LiRr8sT2c",  "license_id": "0142130710581LiRr8sT2c",  "date_created": "2026-11-02T00:45:11Z",  "date_modified": "2026-11-02T00:45:11Z",  "test": true,  "item_id": "widget-pro.test",  "account_id": "AB1234",  "label": "License Code",  "license_service": "https://api.comecero.com/api/v1/license_services/0095012789659LsuOeAWLC",  "order": "https://api.comecero.com/api/v1/orders/6622-NXKHE-858",  "product": "https://api.comecero.com/api/v1/products/widget-pro.test",  "text": "AAAA-BBBB-CCCC-0001",  "html": "AAAA-BBBB-CCCC-0001",  "instructions": "Open Widget Pro, choose Help, then Enter License, and paste the code."}