Register a push installation
POST/v1/contacts/{id}/installations
Requires an API key with the contacts:write scope. About keys and scopes
Works with integration and partner keys, not agent keys.
Safe to retry: a repeat sets the same values again. About idempotency
Registers a device or browser subscription against a contact so push can reach it. Re-registering the same token updates the existing installation rather than creating a duplicate. With idType=externalId, {id} is your own id for the contact, so a backend that knows only its user id can register a device without looking the contact up first. A revoked permission is reported as { pushAppId, externalInstallationId, permission: "denied", lastSeenAt } with the lastSeenAt of the latest registration; if the device registered again since, the report is refused with 409 CONFLICT, and an installation never registered is 404. Returns 201 when the installation is new and 200 when it was already registered.
Path parameters
idstringrequiredKirora's id for the contact, your own with
idType=externalId, or its email address withidType=email, URL-encoded (@as%40).1–255 characters
Query parameters
idTypestringoptionalWhat
{id}is: Kirora's id for the contact (id, the default), your own (externalId, as set with identify) or its email address (email, matched trimmed and without case).one of
id,externalId,email· default"id"
Header parameters
Kirora-WorkspacestringoptionalPartner keys only: the child workspace to act in, by the external id the partner gave it. Without it, a partner key acts in its own workspace. Any other key that sends it is refused with 403, and an unknown workspace is 404.
pattern
^[A-Za-z0-9._:-]{1,128}$Idempotency-KeystringoptionalMakes a retry safe: a repeat with the same key and body within 24 hours gets the first response again, with
Idempotency-Replay: true. The same key with another request is 409IDEMPOTENCY_KEY_REUSED; while the first is still running, 409IDEMPOTENCY_KEY_IN_USE; after anunsafefirst request failed or never returned, 409IDEMPOTENCY_KEY_OUTCOME_UNKNOWN. Use a new key, such as a UUID, for each new request.8–255 characters
Request body
Any of 3 shapes:
- Native token
9 child attributes
pushAppIdstringrequiredThe push app the device registers with.
uuid
externalInstallationIdstringrequiredYour own stable id for the device; registering it again updates it.
1–128 characters
appVersionstringoptionalThe app's version string, such as
2.4.0. Not sent from the web.1–64 characters
osVersionstringoptionalThe operating system version, such as
17.4.1. Not sent from the web.1–64 characters
localestringoptionalThe device's language, a BCP 47 tag such as
en-GB; extensions (-u-…) are dropped.timezonestringoptionalThe device's IANA time zone, such as
Europe/London.up to 100 characters
permissionstringrequiredWhether the user allowed notifications; only
granteddevices receive.one of
granted,deniedtargetKindstringrequiredone of
apns_token,fcm_token,firebase_installation_idtargetstringrequiredThe APNs device token, the FCM registration token, or the Firebase installation ID that Firebase Messaging's
register()reports.1–8,192 characters
- Web push subscription
9 child attributes
pushAppIdstringrequiredThe push app the device registers with.
uuid
externalInstallationIdstringrequiredYour own stable id for the device; registering it again updates it.
1–128 characters
appVersionstringoptionalThe app's version string, such as
2.4.0. Not sent from the web.1–64 characters
osVersionstringoptionalThe operating system version, such as
17.4.1. Not sent from the web.1–64 characters
localestringoptionalThe device's language, a BCP 47 tag such as
en-GB; extensions (-u-…) are dropped.timezonestringoptionalThe device's IANA time zone, such as
Europe/London.up to 100 characters
permissionstringrequiredWhether the user allowed notifications; only
granteddevices receive.one of
granted,deniedtargetKind"web_push_subscription"requiredsubscriptionobjectrequiredThe browser's
PushSubscription, as JSON.3 child attributes
endpointstringrequiredThe browser push service's URL, as
PushSubscription.toJSON()gives it.uri · up to 4,096 characters
expirationTimeinteger | nulloptionalWhen the subscription expires, in epoch milliseconds, if the browser says.
min 0
keysobjectrequiredThe subscription keys, exactly as
PushSubscription.toJSON()gives them.2 child attributes
p256dhstringrequiredThe browser's public key, base64url.
pattern
^[A-Za-z0-9_-]+$authstringrequiredThe subscription's auth secret, base64url.
pattern
^[A-Za-z0-9_-]+$
- Permission denied
8 child attributes
pushAppIdstringrequiredThe push app the device registers with.
uuid
externalInstallationIdstringrequiredYour own stable id for the device; registering it again updates it.
1–128 characters
appVersionstringoptionalThe app's version string, such as
2.4.0. Not sent from the web.1–64 characters
osVersionstringoptionalThe operating system version, such as
17.4.1. Not sent from the web.1–64 characters
localestringoptionalThe device's language, a BCP 47 tag such as
en-GB; extensions (-u-…) are dropped.timezonestringoptionalThe device's IANA time zone, such as
Europe/London.up to 100 characters
permission"denied"requiredlastSeenAtstringrequiredWhen the device last reported this state.
date-time
Returns
Returns 200 OK with a PushInstallation in data. It can also return 201 Created, 409 Conflict, 413 Payload Too Large or 415 Unsupported Media Type; see the statuses below. Otherwise returns an error; Errors lists every code and which to retry.
200 OKThe installation was already registered and is updated.201 CreatedThe installation is new.409 ConflictThe request conflicts with current state — a duplicate unique value, or a resource whose status does not allow this operation.413 Payload Too LargeThe body is larger than this operation accepts (PAYLOAD_TOO_LARGE).415 Unsupported Media TypeThe body is not JSON, or not the upload the operation takes (UNSUPPORTED_MEDIA_TYPE).
idstringrequireduuid
contactIdstringrequireduuid
pushAppIdstringrequireduuid
externalInstallationIdstringrequiredYour own id for the device, as registered.
platformstringrequiredone of
ios,android,webenvironmentstringrequiredone of
sandbox,productionpermissionstringrequiredone of
granted,deniedactivebooleanrequiredFalse once the device is disabled or its token is refused.
invalidatedAtstring | nullrequiredWhen the provider refused the token. A deleted installation keeps it as it was;
activesays it no longer receives.date-time
lastSeenAtstringrequiredWhen the device last registered or refreshed.
date-time
sdkstring | nullrequiredThe Kirora SDK and version that last registered it; null from a server.
appVersionstring | nullrequiredThe app's version, as last registered.
osVersionstring | nullrequiredThe OS version, as last registered.
localestring | nullrequiredThe device's language, as last registered.
timezonestring | nullrequiredThe device's time zone, as last registered.
createdAtstringrequireddate-time
Headers on 200 OK
Idempotency-Replaystringoptionaltruewhen this is the stored response to an earlier request with the same key.one of
true
Headers on 201 Created
Idempotency-Replaystringoptionaltruewhen this is the stored response to an earlier request with the same key.one of
true