Fency.ai

Publishable keys

Client-side keys that are safe to expose in browser code.

Publishable keys are designed for client-side use in your React webapp. They are safe to expose in browser code. They are used in combination with sessions created with a secret key in your backend.

A publishable key always starts with pk_:

pk_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef

Creating a publishable key

To create a publishable key, navigate to your Fency.ai dashboard and go to the API Keys section. Click "Create new key" and select "Publishable key" as the key type.

Allowed origins

Allowed origins (CORS) restrict which domains can use your publishable key, providing an additional layer of security. When creating or editing a publishable key, you can specify which domains are allowed to make requests:

  • Development: http://localhost:3000, http://localhost:5173
  • Production: https://yourdomain.com

Best practices

  • Use separate publishable keys for local development and production.
  • Only add origins that actually need access.
  • Regularly review and update your allowed origins list, especially for production.

On this page