Create a publishable key
/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/publishable-keysMints a new publishable key of the given type. A web key delivers refresh tokens as an httpOnly cookie the browser guards; a native key returns them in the response body for a phone app to store in the OS keychain. The type is fixed at creation โ a key cannot be converted later, because sessions already issued from it carry the delivery it implied.
Authentication
AuthorizationJWT access token. Never send alongside X-API-Key: a request carrying both is refused.
publishable_keys.manageDeveloper ConsoleCreate, rename, and revoke publishable keys. Granted through an administrator role in the Admin Workspace; a valid token without it is refused with 403.
Request body
application/json
typeenum Required What kind of app will hold this key, which decides how a session created with it receives its refresh token. `web` delivers an httpOnly cookie the browser guards; `native` returns the token in the response body for a phone app to store in the OS keychain. Fixed at creation โ a key cannot be converted later, because sessions already issued from it carry the delivery it implied.
namestring Required Label shown in the dashboard, so several keys on one environment are tellable apart (e.g. "iOS app", "marketing site").
Responses
application/json
data *PublishableKeyResponseDto
application/json
error *ApiErrorBodyDto
application/json
error *ApiErrorBodyDto
Errors
When the request can't be completed, the response body includes a stable error code you can branch on.
account.capability_requiredForbiddenThe signed-in user's administrator roles do not grant the capability this endpoint requires.
Ask an account administrator to grant a role carrying the capability named in the Authentication section, then retry.
Returned object
curl -X POST "https://auth.canopy-io.com/portal/v1/accounts/{accountSlug}/applications/{appSlug}/environments/{envSlug}/publishable-keys" \ -H "Authorization: Bearer $CANOPY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "type": "web", "name": "string" }'
{ "data": { "id": "string", "key": "string", "type": "web", "name": "string", "created_at": "2026-04-20T12:00:00.000Z" } }
Tell us how we can improve this guide.