Skip to content

API Keys

API keys are used to authenticate requests to the FairShare API.

Every server-side request to the FairShare API must include your merchant API key.

Before You Begin

Before using API keys, make sure you have:

  • Created your FairShare merchant account
  • Completed your account setup
  • Connected your payment provider for the correct environment

Find Your API Keys

You can find your merchant API keys in the FairShare dashboard under Developers > API Keys.

From there, copy the API key for the environment you want to use.

Use the Correct Environment Key

FairShare provides separate API keys for Sandbox and Live.

  • Use your Sandbox API key for testing
  • Use your Live API key for production

These keys are not interchangeable. If you are creating test split sessions in sandbox, use your sandbox key. If you are creating real production split sessions in live, use your live key.

For more details, see Sandbox vs Live.

Keep Your API Keys Secure

Your API key is a sensitive credential that gives access to your merchant account.

Do not:

  • Expose it in frontend or client-side code
  • Commit it to version control
  • Share it publicly

Store your API key in a secure environment variable or secrets manager.

If you believe your API key has been exposed, rotate it immediately and contact support.

Authenticate Requests

To authenticate a request, include your API key in the x-api-key header.

Example:

http
x-api-key: YOUR_API_KEY

Important

API keys should only be used in trusted backend environments.

Never use your merchant API key directly in browser-based or mobile client code.

Moving from Sandbox to Live

After testing in sandbox, moving to live is simple.

Once your integration and webhooks are already set up, you mainly need to update your production configuration to use:

  • Your Live API key
  • Your live payment provider setup
  • Your live webhook configuration

For example, when creating split sessions through the API, replace your sandbox API key with your live API key.

Next Step

Once you have your API key, you can start creating split sessions via API and integrating FairShare into your checkout flow.