POST https://api.usecommune.com/newsletters/{newsletter}/publishable-keys Production. There is no separate sandbox host.

Create a publishable key

Mints a read-only key your website's page source can read this newsletter's public data with. Needs settings: write, and is a write.

The secret is in this response and nowhere else. Commune keeps only a digest of it, so no later call returns it; a key you have lost is a key you rotate.

It is cmn_pk_-prefixed rather than cmn_sk_ because it is meant to be public: it goes in HTML that anybody can read. What stops that being a problem is what the key can do, which is read what this newsletter has already published, from this newsletter's own website origins, inside a rate limit. Never an email address, never a draft, never a tag-scoped article, and never another newsletter.

allowed_origins are extra origins, for a development machine or a staging host. The newsletter's own website origins are always accepted and do not need listing, which is why the empty default means "the real website and nowhere else" rather than "nowhere".

This is the one place in this API where a credential mints a credential. An API key cannot mint an API key, because a key that could would outlive its own revocation. Neither half of that holds here: this key can mint nothing, and it reaches one newsletter's published rows by its own row rather than by a grant anybody could widen.

Publishes no event.

Path parameters

  • string Required

Request Headers

  • string Required
  • string

Body

  • string Required
  • array[string]
  • integer
  • integer | null
POST /newsletters/{newsletter}/publishable-keys
Loading...

Share your request

Use this link to easily share a pre-filled request of this operation. Everything you filled will be shared apart from the authentication fields.

Request URL

https://api-reference.usecommune.dev/explorer/operation/operation-createpublishablekey

Send a delete request

It looks like you’re about to send a DELETE request to this API. This type of request carries a risk of permanent and irreversible data loss.

Are you sure you want to continue?
Response
Waiting for a request to be sent.