Publisher keys
Create development and production keys, and where to put them in your app.
A publisher key identifies your organization on every serve request. It's a string that starts with spk_.
Create a key
- Open the Publisher Keys page on the Specify dashboard.
- You should see a Development key already generated for you. If not you can generate a key by clicking the Create New + button.
- Copy the key and store it with your other configuration.
Development and production keys
Development keys are meant to be used when you're developing the integration and in dev environments. They work straight away, including while your organization is still pending approval. They return rotating sample ads and never touch your reporting. Always use a Development key everywhere except production.
Production keys serve real campaigns and earn revenue. This is what you should be using when your app is deployed in production. To create one your organization needs to be approved.
Where to put it
Publisher keys ship to the browser, so they are public by design. There is nothing to hide, and no secret to leak.
However you should still read it from your environment rather than hardcoding it, so development and production builds pick up the right one.
SPECIFY_PUBLISHER_KEY=spk_1234567890abcdef1234567890abcdconst specify = new Specify({
publisherKey: process.env.SPECIFY_PUBLISHER_KEY
});Revoking a key
Delete the key from the Publisher Keys page. Revocation is immediate: the next request using it is rejected with a 401, and any placement relying on it stops filling. Create the replacement and deploy it before deleting the old one.
Invalid keys
The SDK throws ValidationError at construction if a key is malformed. A key that is well formed but unknown or revoked fails at request time instead, and serve() will return null.