Statamic - How do I link my account?
Enable the Statamic REST API and connect it to Tenklo
Overview
To authenticate with the Statamic REST API, you need:
- Base URL - The hostname of your Statamic site (e.g.
acme.example.com) - API token - The value of
STATAMIC_API_AUTH_TOKENin your Statamic.envfile
This guide walks you through enabling the REST API on your Statamic site and connecting it to Tenklo.
Prerequisites
- A Statamic site with access to the
.envfile andconfig/statamic/api.php
Instructions
Step 1: Enable the REST API
Enable the API and generate a token in your .env file. There is no UI to generate a token — create one yourself using any of the following commands:
# Mac/Linux
openssl rand -hex 32
# Node
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
# PHP
php -r "echo bin2hex(random_bytes(32));"Then add both variables to your .env:
STATAMIC_API_ENABLED=true
STATAMIC_API_AUTH_TOKEN=a3f9c1d8e6b4...All resources are disabled by default. Enable the ones you need in config/statamic/api.php:
'resources' => [
'collections' => true,
'taxonomies' => true,
// entries, assets, globals, forms, users, etc.
]For more granular control, you can enable specific sub-resources only:
'resources' => [
'collections' => [
'articles' => true,
'pages' => true,
],
'taxonomies' => true,
]If STATAMIC_API_AUTH_TOKEN is not set, the API is publicly accessible without authentication. Always set a token in production.
Step 2: Find your base URL
Your base URL is the hostname of your Statamic site, for example acme.example.com.
Step 3: Enter credentials in the Connect UI
- Open the form where you need to authenticate with Statamic.
- Enter your Base URL and API token in their respective fields.
- Submit the form, and you should be successfully authenticated.
You are now connected to Statamic.