Register a push installationMenu

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

idstringrequired

Kirora's id for the contact, your own with idType=externalId, or its email address with idType=email, URL-encoded (@ as %40).

1–255 characters

Query parameters

idTypestringoptional

What {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-Workspacestringoptional

Partner 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-Keystringoptional

Makes 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 409 IDEMPOTENCY_KEY_REUSED; while the first is still running, 409 IDEMPOTENCY_KEY_IN_USE; after an unsafe first request failed or never returned, 409 IDEMPOTENCY_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
pushAppIdstringrequired

The push app the device registers with.

uuid

externalInstallationIdstringrequired

Your own stable id for the device; registering it again updates it.

1–128 characters

appVersionstringoptional

The app's version string, such as 2.4.0. Not sent from the web.

1–64 characters

osVersionstringoptional

The operating system version, such as 17.4.1. Not sent from the web.

1–64 characters

localestringoptional

The device's language, a BCP 47 tag such as en-GB; extensions (-u-…) are dropped.

timezonestringoptional

The device's IANA time zone, such as Europe/London.

up to 100 characters

permissionstringrequired

Whether the user allowed notifications; only granted devices receive.

one of granted, denied

targetKindstringrequired

one of apns_token, fcm_token, firebase_installation_id

targetstringrequired

The 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
pushAppIdstringrequired

The push app the device registers with.

uuid

externalInstallationIdstringrequired

Your own stable id for the device; registering it again updates it.

1–128 characters

appVersionstringoptional

The app's version string, such as 2.4.0. Not sent from the web.

1–64 characters

osVersionstringoptional

The operating system version, such as 17.4.1. Not sent from the web.

1–64 characters

localestringoptional

The device's language, a BCP 47 tag such as en-GB; extensions (-u-…) are dropped.

timezonestringoptional

The device's IANA time zone, such as Europe/London.

up to 100 characters

permissionstringrequired

Whether the user allowed notifications; only granted devices receive.

one of granted, denied

targetKind"web_push_subscription"required
subscriptionobjectrequired

The browser's PushSubscription, as JSON.

3 child attributes
endpointstringrequired

The browser push service's URL, as PushSubscription.toJSON() gives it.

uri · up to 4,096 characters

expirationTimeinteger | nulloptional

When the subscription expires, in epoch milliseconds, if the browser says.

min 0

keysobjectrequired

The subscription keys, exactly as PushSubscription.toJSON() gives them.

2 child attributes
p256dhstringrequired

The browser's public key, base64url.

pattern ^[A-Za-z0-9_-]+$

authstringrequired

The subscription's auth secret, base64url.

pattern ^[A-Za-z0-9_-]+$

Permission denied
8 child attributes
pushAppIdstringrequired

The push app the device registers with.

uuid

externalInstallationIdstringrequired

Your own stable id for the device; registering it again updates it.

1–128 characters

appVersionstringoptional

The app's version string, such as 2.4.0. Not sent from the web.

1–64 characters

osVersionstringoptional

The operating system version, such as 17.4.1. Not sent from the web.

1–64 characters

localestringoptional

The device's language, a BCP 47 tag such as en-GB; extensions (-u-…) are dropped.

timezonestringoptional

The device's IANA time zone, such as Europe/London.

up to 100 characters

permission"denied"required
lastSeenAtstringrequired

When 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).
idstringrequired

uuid

contactIdstringrequired

uuid

pushAppIdstringrequired

uuid

externalInstallationIdstringrequired

Your own id for the device, as registered.

platformstringrequired

one of ios, android, web

environmentstringrequired

one of sandbox, production

permissionstringrequired

one of granted, denied

activebooleanrequired

False once the device is disabled or its token is refused.

invalidatedAtstring | nullrequired

When the provider refused the token. A deleted installation keeps it as it was; active says it no longer receives.

date-time

lastSeenAtstringrequired

When the device last registered or refreshed.

date-time

sdkstring | nullrequired

The Kirora SDK and version that last registered it; null from a server.

appVersionstring | nullrequired

The app's version, as last registered.

osVersionstring | nullrequired

The OS version, as last registered.

localestring | nullrequired

The device's language, as last registered.

timezonestring | nullrequired

The device's time zone, as last registered.

createdAtstringrequired

date-time

Headers on 200 OK

Idempotency-Replaystringoptional

true when this is the stored response to an earlier request with the same key.

one of true

Headers on 201 Created

Idempotency-Replaystringoptional

true when this is the stored response to an earlier request with the same key.

one of true