# Storing API key in DB and injecting it into N1ED

> Add an API key column to your database and inject the key into tinymce.init, so each website your CMS serves loads its own N1ED configuration.

Source: https://n1ed.com/docs/custom-cms/store-api-key  
Section: For developers > Custom CMS > Storing API key in DB  
Updated: 2026-09-29  
Every page of n1ed.com has a Markdown copy at its URL + `.md` (`index.md` after a URL that ends in `/`); all of them are in one file: https://n1ed.com/llms-full.txt

N1ED can be installed on many websites, and each of them needs an API key of its own: the key selects the configuration the editor loads, its custom blocks and its file storage. A CMS you ship to many customers therefore injects the API key into N1ED dynamically, and lets an administrator set or change it without touching code. This page does the first half: the key comes from your database.

Create a field for the API key in the database (a string of 24 characters). Its default value is the shared demo key of N1ED, `N1ED24RR1234123412341234`: N1ED runs on it out of the box, with a shared configuration nobody can change, until an administrator sets a key of their own in the [next steps](https://n1ed.com/docs/custom-cms/set-and-change-api-key).

Then read the key from the database and pass it to the editor where you initialize it, as `apiKey`. For TinyMCE and PHP:

```php
<?php
    $apiKey = getN1EDApiKeyFromDB(); // write your own function
?>
<script>
    tinymce.init({
        selector: "#editor",
        plugins: "n1ed",
        apiKey: "<?php echo $apiKey ?>"
    });
</script>
```

This only reads the key and passes it as it is; the next step adds the script that updates it.

#### Check it

Be sure N1ED loads with your default API key. Its configuration is the one the [Dashboard](https://n1ed.com/dashboard) shows for that key: on the shared demo key it cannot be changed, which is what the next steps are for.
