Connecting Basin
The plugin talks to Basin with an Account API key, and shows the forms from one Basin project.
1. Create an Account API key
Section titled “1. Create an Account API key”In Basin, go to Account → API and create an Account API key.
2. Add it to your environment
Section titled “2. Add it to your environment”Add the key to your .env file. Do the same on every environment (staging, production) where the plugin runs.
BASIN_API_KEY="your-account-api-key"The plugin only accepts an environment variable here, never the key itself, so the key can’t end up in project config or version control.
3. Enter it in Craft
Section titled “3. Enter it in Craft”- Go to Basin → Settings (or Settings → Plugins → Basin).
- Under Account API key, enter
$BASIN_API_KEY.
The plugin checks the key as soon as you enter it, and says if it doesn’t work. You can check it again at any time with Test connection.
4. Choose a project
Section titled “4. Choose a project”Once the key works, Basin project lists your projects, with each one’s ID. Choose the one whose forms this site uses, and save.
Every form in that project is now available to the site. There’s nothing to turn on per form: to make a form available, put it in the project in Basin; to remove it, move it out.
Different projects per environment
Section titled “Different projects per environment”The project setting also accepts an environment variable. That’s useful when staging posts to a “Client – Staging” project and production to the live one:
BASIN_PROJECT_ID="12345"$BASIN_PROJECT_ID is then listed under Environment Variables in Basin project, beside the name of the project it holds. Choose it, and save. Only variables that hold one of your project IDs are listed.
Changing the project
Section titled “Changing the project”You can change the project at any time. Nothing is copied or deleted: the site simply uses the new project’s forms from then on.
- Basin → Forms and the submissions screens show the new project’s forms. Links to the old project’s forms stop working.
- Templates and Basin Form fields that use a form from the old project no longer show it, and each one is listed in the error log.
- Each form’s settings on this site (its Form Studio embed code and reCAPTCHA version) are kept for 30 days, so if you switch back within that time, everything works as before.