# Installations

Part of the new flow for V3 applications, not related to the marketplace endpoints in Developer Tools.
What your backend calls with the application token, and the webhooks Altegio sends about installations.
**Installation.** A business opens `install_url`, reviews the scopes and picks its Locations. Without
`setup_url` the installation is `active` at once and `installation.created` is sent. With `setup_url` the
installation is `pending`: the business finishes setup on your page, then your backend calls
`POST /marketplace_apps/{marketplace_app_id}/installations/{location_id}/activate`. A `pending`
installation is deleted after 12 hours. Once the installation is `active`, request an installation token
with `grant_type=client_credentials` and the `location_id`.
**Application token.** `grant_type=client_credentials` without `location_id` issues a token for the routes
in this section only. It carries no scopes and reads no Location data.
**Webhooks.** Altegio posts installation events to `webhook_url` following
[Standard Webhooks](https://www.standardwebhooks.com/). The simplest way to verify a delivery is an official
Standard Webhooks library: pass it the whole secret string `whsec_…` from the Developer Hub, it strips the
prefix and decodes base64 itself.
To verify by hand, check `webhook-signature`: `v1,` followed by base64 of HMAC-SHA256 over
`{webhook-id}.{webhook-timestamp}.{body}`. The key is the webhook secret without the `whsec_` prefix,
decoded from base64, not the `whsec_…` string itself. Sign the raw request body exactly as it arrived:
parsing the JSON and serializing it again changes whitespace or escaping, and the signature no longer
matches. Compare signatures in constant time, reject a `webhook-timestamp` older than 5 minutes and drop a
`webhook-id` you have already processed.
Test vector: secret `whsec_RSMfutMthCHHz+7jJkKn4zYyVPG/I/Th739hMkivZJc=`, `webhook-id`
`evt_0196f0c2a1b27c3d8e9f0a1b2c3d4e5f`, `webhook-timestamp` 1793782805 and the body
`{"type":"installation.created","created_at":"2026-11-04T09:00:05Z","data":{"marketplace_app_id":48213,"location_id":760920}}`
give `webhook-signature` `v1,KWH991i1a8Wk8HmCVXEZWrwIMgBcBqEIZmHthuN6y9k=`.
Answer with any `2xx` within 3 seconds. Any other status, a redirect (redirects are not followed) or a
timeout is retried for up to 24 hours with the same `webhook-id`. A rotated secret takes effect at once.
Events can arrive out of order: a retry may deliver an older event after a newer one. Do not derive the
installation state from the event `type`. On every event read the current state with
`GET /marketplace_apps/{marketplace_app_id}/installations/{location_id}` and act on that;
`404 installation_not_found` means the installation is deleted.

 - [GET /marketplace_apps/{marketplace_app_id}/installations](https://developer.alteg.io/en/b2b-v3/openapi/installations/listmarketplaceappinstallations.md): Returns the installations of your application. Use it to reconcile state when a webhook was lost. Deleted installations are not returned. Call it with the **application token**: `POST /oauth/token` wi
 - [GET /marketplace_apps/{marketplace_app_id}/installations/{location_id}](https://developer.alteg.io/en/b2b-v3/openapi/installations/getmarketplaceappinstallation.md): Returns the installation of your application in the Location: `pending` while the business finishes setup on your page, `active` after you activated it, `frozen` while the application is unpaid. Witho
 - [DELETE /marketplace_apps/{marketplace_app_id}/installations/{location_id}](https://developer.alteg.io/en/b2b-v3/openapi/installations/deletemarketplaceappinstallation.md): Uninstalls your application from the Location, exactly as when the business removes it: the scopes are revoked, installation tokens for the Location stop working, and `installation.deleted` is sent. R
 - [POST /marketplace_apps/{marketplace_app_id}/installations/{location_id}/activate](https://developer.alteg.io/en/b2b-v3/openapi/installations/activatemarketplaceappinstallation.md): Confirms that the business finished setup on your page (`setup_url`) and turns a `pending` installation `active`. Only then the installation receives its scopes, `installation.created` is sent, and a
 - [POST /marketplace_apps/{marketplace_app_id}/installations/{location_id}/payments](https://developer.alteg.io/en/b2b-v3/openapi/installations/createmarketplaceappinstallationpayment.md): For applications that bill the business themselves: reports that the business paid for the application in this Location. A `frozen` installation is unfrozen and `installation.unfrozen` is sent. The in
 - [POST /marketplace_apps/{marketplace_app_id}/installations/{location_id}/payments/{payment_id}/refund](https://developer.alteg.io/en/b2b-v3/openapi/installations/refundmarketplaceappinstallationpayment.md): Marks a payment you reported as refunded and returns it with `refunded_at`. The payment is found by `payment_id` among the payments of your application in this Location, so a refund also works after t
 - [POST installation.created](https://developer.alteg.io/en/b2b-v3/openapi/installations/installationcreatedwebhook.md): Sent when an installation becomes `active`: after your `activate` call, or at installation for an application without `setup_url`. Request an installation token for the Location from this moment. Sign
 - [POST installation.deleted](https://developer.alteg.io/en/b2b-v3/openapi/installations/installationdeletedwebhook.md): Sent when the application is uninstalled from the Location, by the business or by your `DELETE` call. Installation tokens for the Location stop working. Signed by the Standard Webhooks scheme with the
 - [POST installation.frozen](https://developer.alteg.io/en/b2b-v3/openapi/installations/installationfrozenwebhook.md): Sent when the installation is frozen because the paid period ended. Installation tokens for the Location stop working until the installation is unfrozen; the application token still reaches the instal
 - [POST installation.unfrozen](https://developer.alteg.io/en/b2b-v3/openapi/installations/installationunfrozenwebhook.md): Sent when a frozen installation works again after a payment through the Altegio checkout or a payment you reported. Signed by the Standard Webhooks scheme with the webhook secret of the application. A
 - [POST installation.paid](https://developer.alteg.io/en/b2b-v3/openapi/installations/installationpaidwebhook.md): Sent for applications billed by Altegio when the business pays through the Altegio checkout, renewals included. Signed by the Standard Webhooks scheme with the webhook secret of the application. Answe
