<p>Craft config files usually allow to return environment-specific arrays. So you could just configure different endpoints like so:</p>

<pre class="lang-php prettyprint-override"><code>return [
    '*' =&gt; [],
    '.com' =&gt; [
        'endpoints' =&gt; [
            'api/example&lt;ext:(.json)?&gt;' =&gt; function() {
                // example API config for live environment
            },
        ],
    ],
    '.dev' =&gt; [
        'endpoints' =&gt; [
            'api/example&lt;ext:(.json)?&gt;' =&gt; function() {
                // example API config for dev environment
            },
        ],
    ],
];
</code></pre>

CC BY-SA 3.0
2016-12-14T16:23:50.137Z
2016-12-14T16:23:50.137Z
carlcs
<p>Doh so the answer is PHP constants:</p>

<pre><code>define('CRAFT_CONFIG_PATH', '../../craftdev/config/');
</code></pre>

<p>useful to know.</p>

CC BY-SA 3.0
2016-12-15T09:17:21.423Z
That'll change the path for _all_ your config files (including `db.php`, `general.php` and Redactor configs), though.
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2016-12-14T15:53:48.040Z
2016-12-14T15:53:48.040Z
joomkit
<p>Is it possible to have a dev version path for the Element API plugin so we can keep live and dev API separated?</p>

<plugin-elementapi>
Separate path for Element API plugin
# Separate path for Element API plugin

(Asked by: username_0 on 2016-12-14)

Is it possible to have a dev version path for the Element API plugin so we can keep live and dev API separated?

**Tags:** plugin-elementapi


---

## 2 answers

### Answer by username_1 on 2016-12-14. Score: 2

Craft config files usually allow to return environment-specific arrays. So you could just configure different endpoints like so:
return [
    '*' => [],
    '.com' => [
        'endpoints' => [
            'api/example' => function() {
                // example API config for live environment
            },
        ],
    ],
    '.dev' => [
        'endpoints' => [
            'api/example' => function() {
                // example API config for dev environment
            },
        ],
    ],
];


---

### Answer by username_0 on 2016-12-14. Score: 1

Doh so the answer is PHP constants:
define('CRAFT_CONFIG_PATH', '../../craftdev/config/');

useful to know.

> **Comments:**
> **username_2**: That'll change the path for _all_ your config files (including `db.php`, `general.php` and Redactor configs), though.  

---

