# License device replaced (/api/webhooks/license-instance-deactivated)

Webhook event `license:instance_deactivated`, sent as `POST` to your subscription's URL.

Fires when rotation replaces a device. Importing saved devices sends no device events. Skip repeated event_id values. Keep a new device event even when its license_version equals an earlier event's version. The data has no key, fingerprint, customer email or raw metadata.

## Request parameters

### X-Comecero-Signature (header)

Proof the delivery comes from Comecero and was not changed. It is the HMAC-SHA256 of the raw request body (UTF-8), keyed with the signature key as UTF-8, written as 64 lowercase hex characters. The key is the event subscription's `signature_key`, or the account's signature key (Settings, Technical) when the subscription has none. Every account gets one when it is created, so deliveries are signed unless the key was removed. To check it, compute the HMAC over the body exactly as received, before you parse it, and compare the two strings in constant time. Reject the delivery when they differ. The signature has no timestamp, so to guard against a replayed delivery also skip any `event_id` you already handled. If you cannot check signatures, use the event only as a hint: get the object by its id from the API before you act on it.

```json
{
  "type": "string",
  "pattern": "^[0-9a-f]{64}$",
  "examples": [
    "5f2b8c0e9a1d4f7b3c6e8a0d2f4b6c8e0a2c4e6f8b0d2f4a6c8e0b2d4f6a8c0e"
  ]
}
```

### User-Agent (header)

Always `Comecero-Event (+https://comecero.com)`.

```json
{
  "type": "string",
  "examples": [
    "Comecero-Event (+https://comecero.com)"
  ]
}
```

## Request body (required)

### application/json

Fields and constraints (JSON Schema):

```json
{
  "allOf": [
    {
      "type": "object",
      "title": "event",
      "description": "One delivery of one event to one event subscription. When something happens (an order is created, a payment completes), Comecero makes one event for each active event subscription to that event type, each with its own `event_id` and the same `fingerprint`. This is also the body Comecero POSTs to your webhook URL.",
      "properties": {
        "object": {
          "type": "string",
          "enum": [
            "event"
          ],
          "description": "Always `event`."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "readOnly": true,
          "description": "The URL of this event in the API."
        },
        "event_id": {
          "type": "string",
          "readOnly": true,
          "description": "The id of this delivery. It is different for each event subscription, and stays the same when the delivery is retried, so use it to ignore a delivery you already handled."
        },
        "test": {
          "type": "boolean",
          "readOnly": true,
          "description": "`true` for a test mode event."
        },
        "account_id": {
          "type": "string",
          "readOnly": true,
          "description": "The account the event belongs to."
        },
        "type": {
          "type": "string",
          "title": "event_type",
          "description": "The kind of event. See the Webhooks section of this reference for when each one fires and what its `data` holds.",
          "enum": [
            "account:modified",
            "cart:payment_completed",
            "gateway:created",
            "gateway:modified",
            "event_subscription:created",
            "event_subscription:modified",
            "event_subscription:deleted",
            "license:issued",
            "license:extended",
            "license:expiry_changed",
            "license:limit_changed",
            "license:revoked",
            "license:reinstated",
            "license:expired",
            "license_service:low_licenses",
            "invoice:created",
            "invoice:published",
            "invoice:paid",
            "invoice:payment_completed",
            "order:created",
            "order:payment_completed",
            "order:fulfilled",
            "order:licenses_assigned",
            "payment:completed",
            "payment:created_success",
            "payment:created_failure",
            "payment:captured_success",
            "payment:captured_failure",
            "payment:voided",
            "product:created",
            "product:modified",
            "product:deleted",
            "product:low_inventory",
            "refund:created_success",
            "refund:created_failure",
            "refund:deleted",
            "user:created",
            "user:modified",
            "shipment:created",
            "shipment:modified",
            "shipment:deleted",
            "subscription:created",
            "subscription:modified",
            "subscription:cancelled",
            "subscription:cancellation_scheduled",
            "subscription:cancellation_unscheduled",
            "subscription:completed",
            "subscription:converted",
            "subscription_item:added",
            "subscription_item:cancelled",
            "subscription_item:cancellation_scheduled",
            "subscription_item:cancellation_unscheduled",
            "subscription_item:modified",
            "subscription:renewal_success",
            "subscription:renewal_failure",
            "usage:threshold_reached",
            "usage:balance_low",
            "usage:balance_depleted",
            "usage:spend_limit_reached",
            "usage:auto_top_up_succeeded",
            "usage:auto_top_up_failed",
            "usage:auto_top_up_cap_reached",
            "usage:spend_limit_changed",
            "usage:burst_opted_in",
            "usage:burst_revoked",
            "entitlement:changed",
            "usage:credit_granted",
            "license:instance_deactivated"
          ]
        },
        "event_subscription": {
          "description": "The event subscription this delivery is for: its URL, or the full object when you send `expand=event_subscription`. Left out when the token may not read event subscriptions.",
          "oneOf": [
            {
              "type": "string",
              "format": "uri"
            },
            {
              "type": "object",
              "title": "event_subscription",
              "description": "An endpoint that receives events of one type, by HTTP POST to a URL or by email. Make one event subscription for each event type you want.",
              "properties": {
                "object": {
                  "type": "string",
                  "enum": [
                    "event_subscription"
                  ],
                  "description": "Always `event_subscription`."
                },
                "url": {
                  "type": "string",
                  "format": "uri",
                  "readOnly": true,
                  "description": "The URL of this event subscription in the API."
                },
                "event_subscription_id": {
                  "type": "string",
                  "readOnly": true,
                  "description": "The event subscription id."
                },
                "date_created": {
                  "type": "string",
                  "format": "date-time",
                  "readOnly": true,
                  "description": "When the event subscription was created."
                },
                "date_modified": {
                  "type": "string",
                  "format": "date-time",
                  "readOnly": true,
                  "description": "When the event subscription last changed."
                },
                "test": {
                  "type": "boolean",
                  "readOnly": true,
                  "description": "`true` for a test mode event subscription. It only receives test mode events. Set by the token you create it with."
                },
                "active": {
                  "type": "boolean",
                  "description": "Whether events are sent to it. On create the default is `false`, so send `active: true` to start receiving events."
                },
                "account_id": {
                  "type": "string",
                  "readOnly": true,
                  "description": "The account the event subscription belongs to."
                },
                "event_type": {
                  "type": "string",
                  "title": "event_type",
                  "description": "The kind of event. See the Webhooks section of this reference for when each one fires and what its `data` holds.",
                  "enum": [
                    "account:modified",
                    "cart:payment_completed",
                    "gateway:created",
                    "gateway:modified",
                    "event_subscription:created",
                    "event_subscription:modified",
                    "event_subscription:deleted",
                    "license:issued",
                    "license:extended",
                    "license:expiry_changed",
                    "license:limit_changed",
                    "license:revoked",
                    "license:reinstated",
                    "license:expired",
                    "license_service:low_licenses",
                    "invoice:created",
                    "invoice:published",
                    "invoice:paid",
                    "invoice:payment_completed",
                    "order:created",
                    "order:payment_completed",
                    "order:fulfilled",
                    "order:licenses_assigned",
                    "payment:completed",
                    "payment:created_success",
                    "payment:created_failure",
                    "payment:captured_success",
                    "payment:captured_failure",
                    "payment:voided",
                    "product:created",
                    "product:modified",
                    "product:deleted",
                    "product:low_inventory",
                    "refund:created_success",
                    "refund:created_failure",
                    "refund:deleted",
                    "user:created",
                    "user:modified",
                    "shipment:created",
                    "shipment:modified",
                    "shipment:deleted",
                    "subscription:created",
                    "subscription:modified",
                    "subscription:cancelled",
                    "subscription:cancellation_scheduled",
                    "subscription:cancellation_unscheduled",
                    "subscription:completed",
                    "subscription:converted",
                    "subscription_item:added",
                    "subscription_item:cancelled",
                    "subscription_item:cancellation_scheduled",
                    "subscription_item:cancellation_unscheduled",
                    "subscription_item:modified",
                    "subscription:renewal_success",
                    "subscription:renewal_failure",
                    "usage:threshold_reached",
                    "usage:balance_low",
                    "usage:balance_depleted",
                    "usage:spend_limit_reached",
                    "usage:auto_top_up_succeeded",
                    "usage:auto_top_up_failed",
                    "usage:auto_top_up_cap_reached",
                    "usage:spend_limit_changed",
                    "usage:burst_opted_in",
                    "usage:burst_revoked",
                    "entitlement:changed",
                    "usage:credit_granted",
                    "license:instance_deactivated"
                  ]
                },
                "destination": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Where to send events: an `https` URL when `method` is `http`, or one email address or a comma-separated list when `method` is `email`. At most 256 characters. A URL must be a public address (not localhost or a private network)."
                },
                "format": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The body format. `json` and `xml` send the whole event. `html` sends only `data`, as a readable table, and suits email.",
                  "enum": [
                    "json",
                    "xml",
                    "html",
                    null
                  ]
                },
                "method": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "How to deliver. `http` is a POST to `destination`; `email` sends an email.",
                  "enum": [
                    "http",
                    "email",
                    null
                  ]
                },
                "timezone": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "An IANA time zone name for the dates in the event, such as `America/New_York`. When `null`, the account's time zone is used."
                },
                "signature_key": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The key used to sign deliveries in the `X-Comecero-Signature` header. Letters and digits only, at most 64 characters. When `null`, the account's signature key (Settings, Technical) is used."
                },
                "expand": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Comma-separated child objects of `data` to send in full, as with the `expand` query parameter, for example `customer,payments`."
                },
                "show": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Comma-separated fields of `data` to send; all others are left out. You cannot set both `show` and `hide`."
                },
                "hide": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Comma-separated fields of `data` to leave out. You cannot set both `show` and `hide`."
                },
                "http_authorization_username": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "A user name sent with HTTP Basic authorization on each delivery. At most 75 characters. Only returned when `method` is `http`."
                },
                "http_authorization_password": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The password for HTTP Basic authorization. At most 75 characters. It is returned as you set it, so keep secret and trusted tokens safe. Only returned when `method` is `http`."
                },
                "custom_header_name": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The name of an extra header sent with each delivery. At most 75 characters. Sent only when `custom_header_value` is set too."
                },
                "custom_header_value": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The value of the extra header. At most 256 characters."
                },
                "environment_variables": {
                  "type": [
                    "object",
                    "null"
                  ],
                  "additionalProperties": {
                    "type": "string"
                  },
                  "description": "Name and value pairs copied into `environment_variables` of every event sent to this subscription."
                },
                "comments": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Your own notes. At most 256 characters."
                },
                "formatted": {
                  "type": "object",
                  "readOnly": true,
                  "description": "Dates as display text. Only returned with `formatted=true`.",
                  "properties": {
                    "date_created": {
                      "type": "string"
                    },
                    "date_modified": {
                      "type": "string"
                    }
                  }
                }
              },
              "example": {
                "object": "event_subscription",
                "url": "https://api.comecero.com/api/v1/event_subscriptions/1102610913420ES4f9QmLp",
                "event_subscription_id": "1102610913420ES4f9QmLp",
                "date_created": "2026-11-07T14:20:03Z",
                "date_modified": "2026-11-07T14:20:03Z",
                "test": true,
                "active": true,
                "account_id": "AB1234",
                "event_type": "order:created",
                "destination": "https://example.com/webhooks/comecero",
                "format": "json",
                "method": "http",
                "timezone": null,
                "signature_key": null,
                "expand": "customer",
                "show": null,
                "hide": null,
                "http_authorization_username": null,
                "http_authorization_password": null,
                "custom_header_name": null,
                "custom_header_value": null,
                "environment_variables": {
                  "store": "main"
                },
                "comments": "Order sync"
              }
            }
          ]
        },
        "fingerprint": {
          "type": "string",
          "readOnly": true,
          "description": "The id of the thing that happened. Every event subscription that receives the same occurrence gets the same `fingerprint`."
        },
        "status": {
          "type": "string",
          "readOnly": true,
          "description": "Where delivery stands. `pending`: stored but not yet handed to delivery; only `license:*` events pass through it, usually for a moment. `queued`: made, not sent yet. `delivered`: your server answered 2xx (or the email was sent). `retry`: the last attempt failed and another is planned. `failed`: no more attempts will be made.",
          "enum": [
            "pending",
            "queued",
            "delivered",
            "retry",
            "failed"
          ]
        },
        "date_created": {
          "type": "string",
          "format": "date-time",
          "readOnly": true,
          "description": "When the event happened. Dates in an event use the event subscription's `timezone`, or the account's time zone when it has none."
        },
        "date_modified": {
          "type": "string",
          "format": "date-time",
          "readOnly": true,
          "description": "When the event last changed, for example at its last delivery attempt."
        },
        "environment_variables": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": {
            "type": "string"
          },
          "description": "The name and value pairs set on the event subscription when the event was made, passed through so your endpoint can read its own settings."
        },
        "data": {
          "type": "object",
          "additionalProperties": true,
          "description": "The object the event is about, shaped like a GET of that object (an order for `order:created`, a payment for `payment:completed`). The event subscription's `expand`, `show` and `hide` apply to it. It is the object as it was when the event was made, not as it is now."
        },
        "retry_count": {
          "type": "integer",
          "readOnly": true,
          "description": "How many automatic retries have been made. Only returned with `debug=true`."
        },
        "date_last_delivery_attempt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "readOnly": true,
          "description": "When the last delivery attempt was made. Only returned with `debug=true`."
        },
        "date_next_delivery_attempt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "readOnly": true,
          "description": "When the next automatic attempt is planned. Only returned with `debug=true`, and only when an attempt is planned."
        },
        "debug": {
          "type": [
            "string",
            "null"
          ],
          "readOnly": true,
          "description": "Why the last attempt failed, such as the status code and the first 500 characters your server answered. Only returned with `debug=true`."
        },
        "formatted": {
          "type": "object",
          "readOnly": true,
          "description": "Dates as display text. Only returned with `formatted=true`.",
          "properties": {
            "date_created": {
              "type": "string"
            },
            "date_modified": {
              "type": "string"
            },
            "date_delivered": {
              "type": [
                "string",
                "null"
              ]
            },
            "date_last_delivery_attempt": {
              "type": [
                "string",
                "null"
              ]
            },
            "date_next_delivery_attempt": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        }
      },
      "example": {
        "object": "event",
        "url": "https://api.comecero.com/api/v1/events/1102611073847EVt7Kq2Za",
        "event_id": "1102611073847EVt7Kq2Za",
        "test": true,
        "account_id": "AB1234",
        "type": "order:created",
        "event_subscription": "https://api.comecero.com/api/v1/event_subscriptions/1102610913420ES4f9QmLp",
        "fingerprint": "k2P9wQ7xR4vT1nY8",
        "status": "delivered",
        "date_created": "2026-11-07T14:32:10Z",
        "date_modified": "2026-11-07T14:32:11Z",
        "environment_variables": {
          "store": "main"
        },
        "data": {
          "object": "order",
          "url": "https://api.comecero.com/api/v1/orders/7393-GMRFY-954",
          "order_id": "7393-GMRFY-954",
          "test": true,
          "currency": "USD",
          "total": 99.95,
          "customer": "https://api.comecero.com/api/v1/customers/1102611073801CUa8Hn2Lq"
        }
      }
    },
    {
      "type": "object",
      "properties": {
        "type": {
          "const": "license:instance_deactivated"
        },
        "data": {
          "type": "object",
          "title": "license_instance_deactivation",
          "additionalProperties": false,
          "required": [
            "object",
            "license_id",
            "generation",
            "instance_id",
            "reason",
            "deactivated_at",
            "replacement_instance_id",
            "activation_limit",
            "activations",
            "license_version",
            "seat_revision"
          ],
          "properties": {
            "object": {
              "type": "string",
              "description": "The object type.",
              "const": "license_instance_deactivation"
            },
            "license_id": {
              "type": "string",
              "description": "The license id."
            },
            "generation": {
              "type": "integer",
              "minimum": 1,
              "description": "The key generation."
            },
            "instance_id": {
              "type": "string",
              "description": "The removed device id."
            },
            "reason": {
              "type": "string",
              "description": "Automatic seat rotation.",
              "const": "rotated"
            },
            "deactivated_at": {
              "type": "string",
              "description": "When the device was replaced.",
              "format": "date-time"
            },
            "replacement_instance_id": {
              "type": "string",
              "description": "The new device id."
            },
            "activation_limit": {
              "type": "integer",
              "minimum": 1,
              "description": "The device limit."
            },
            "activations": {
              "type": "integer",
              "minimum": 0,
              "description": "The device count. Replacing a device keeps it unchanged."
            },
            "license_version": {
              "type": "integer",
              "minimum": 1,
              "description": "The license version. Several device events may share it."
            },
            "seat_revision": {
              "type": "integer",
              "minimum": 1,
              "description": "The device revision after the change."
            }
          }
        }
      }
    }
  ]
}
```

Example: A license:instance_deactivated event

```json
{
  "object": "event",
  "url": "https://api.comecero.com/api/v1/events/1102611073847EVt7Kq2Za",
  "event_id": "1102611073847EVt7Kq2Za",
  "test": true,
  "account_id": "AB1234",
  "type": "license:instance_deactivated",
  "event_subscription": "https://api.comecero.com/api/v1/event_subscriptions/1102610913420ES4f9QmLp",
  "fingerprint": "license_test:1:4:f70a79fa",
  "status": "delivered",
  "date_created": "2026-11-09T10:02:45Z",
  "date_modified": "2026-11-09T10:02:46Z",
  "environment_variables": {
    "store": "main"
  },
  "data": {
    "object": "license_instance_deactivation",
    "license_id": "license_test",
    "generation": 1,
    "instance_id": "f70a79fa-6054-433e-9c1b-6075344292e4",
    "reason": "rotated",
    "deactivated_at": "2026-12-03T10:05:00Z",
    "replacement_instance_id": "ins_0123456789abcdef0123456789abcdef",
    "activation_limit": 3,
    "activations": 3,
    "license_version": 1,
    "seat_revision": 4
  }
}
```

## Response 200

Answer with any 2xx status within 60 seconds to mark the event `delivered`; the body is ignored. Anything else counts as a failure: another status (redirects are not followed), a timeout, or no connection. After a failure Comecero retries on a growing schedule: three times 2 minutes apart, then every 15 minutes, every hour, every 2 hours, every 4 hours and every 8 hours, 23 attempts over about 56 hours in all. Then the event is `failed` and is not tried again by itself; you can send it again with `POST /events/{event_id}/retry` while it is kept. Events are kept for 30 days after their last change, and for 7 days once delivered or in test mode. Deliveries can arrive more than once and out of order, so use `event_id` to skip repeats and compare `date_created` or get the object fresh before you overwrite newer data. Each event subscription gets its own copy: the same occurrence shares one `fingerprint` across subscriptions.

Resolve remaining `$ref` pointers in /openapi.json.