Keys and environments in Desmo
Desmo uses API keys to identify who is sending data and which environment it belongs to. At a high level:- Publishable keys (start with
pk_) are used by the iOS SDK in your app. - Secret keys (start with
sk_) are used only by your backend and internal tools.
sandbox– for development and test traffic.live– for production deliveries.
Configuring the iOS SDK with a key
When you callDesmo.setup, you pass your publishable key and an environment:
-
The key must start with
pk_, otherwiseDesmo.setupthrowsDesmoClientError.invalidApiKeyand logs an error. -
The key is sent on every HTTP request in the
Desmo-Keyheader:
sk_...) keys in your app—those belong only on your backend.
Choosing an environment
TheDesmoEnvironment type controls which Desmo backend the SDK talks to:
.sandbox and .live point to https://api.getdesmo.io, but they are treated as separate environments in the control plane (keys, tenants, projects).
Recommended usage:
- Use
.sandboxduring development and QA. - Use
.livein your production app.
Rotating and revoking keys
When you create or revoke keys in the dashboard:- Existing apps using an old publishable key will continue to work until you revoke that key.
- Once revoked, requests using that key will start failing with authorization errors.
- Create a new publishable key for the environment you need.
- Update your app configuration (or remote config) to use the new key.
- Ship an app update and wait for adoption.
- Revoke the old key once you are confident no important traffic is using it.
Security guidelines
- Treat keys as credentials:
- Do not commit real keys into public repos.
- Prefer using Xcode build settings or a remote config system to inject keys.
- Never log keys in production logs.
- Use separate keys for sandbox and live environments to avoid test data mixing with real deliveries.