A restriction stops casual reuse of your key, such as someone pasting it into their own app or site. It does not prove who a customer is: anything outside a browser can claim any app ID or origin. To prove that events come from the customer they name, use identity verification.
Add a restriction
- In Tranthor, open Settings > API keys.
- Under Public write key, find Restrict this key.
- Add your mobile apps under Allowed app IDs, and your websites under Allowed websites.
- Select Save. Restrictions apply within 30 seconds.
How requests are matched
A request from a browser carries anOrigin header. Tranthor matches it against Allowed websites. Any other request must send an app ID that is in Allowed app IDs.
So if you fill only one list, the other kind of request is refused. With only app IDs, the key stops working on websites. With only websites, it stops working in mobile apps and on servers.
Allowed app IDs
The iOS and Android SDKs send the app ID on every request: the bundle identifier on iOS, the package name on Android. Add those, for examplecom.example.shop. If you set appId in the SDK configuration, add that value instead.
If you call the API from a server with a restricted key, send an allowed value in the x-tranthor-app-id header.
Allowed websites
Enter the scheme, the host and, if it is not the default, the port. No path.
Entries are case-insensitive.
http and https are different websites.
When a request is refused
Tranthor answers403 with one of these codes:
The SDKs treat these as configuration errors: the batch is dropped and reported through
onError, without retrying. Check the lists before you ship an app with a new bundle identifier or package name, or a site on a new domain.
You can also set restrictions from your backend with an Admin API key. The request replaces both lists:

