<p>You could try to send the API key via the headers.</p>
<p>You'll need to add a feedme config file where you can add request options.
see <a href="https://docs.craftcms.com/feed-me/v4/get-started/configuration.html#example-requestoptions" rel="nofollow noreferrer">https://docs.craftcms.com/feed-me/v4/get-started/configuration.html#example-requestoptions</a></p>
<p>For example:</p>
<pre><code>
return [
    '*' =&gt; [
        'requestOptions' =&gt; [
            'headers' =&gt; [
                'X-API-KEY' =&gt; 'xxxxxxxx',
            ],
        ],
    ]
];```
</code></pre>

CC BY-SA 4.0
2022-07-27T10:05:51.123Z
2022-07-27T10:05:51.123Z
MetaMachine
<p>I want to use the feedme plugin to get data from an API that uses API Tokens as authentication. Of course without adding the API Key, I get the following error in Feedme <code>response: {&quot;error&quot;:{&quot;type&quot;:&quot;Unauthorized&quot;}}</code>. Where can I add the API key so that I can fetch the data? I checked all the options inside the plugin and there's nothing about that.</p>

<plugin-feedme><craft4>
Feedme API call with auth token
# Feedme API call with auth token

(Asked by: username_0 on 2022-07-27)

I want to use the feedme plugin to get data from an API that uses API Tokens as authentication. Of course without adding the API Key, I get the following error in Feedme `response: {"error":{"type":"Unauthorized"}}`. Where can I add the API key so that I can fetch the data? I checked all the options inside the plugin and there's nothing about that.

**Tags:** plugin-feedme, craft4

---

## 1 answers

### Answer by username_1 on 2022-07-27. Score: 1 | Accepted answer

You could try to send the API key via the headers.
You'll need to add a feedme config file where you can add request options.
see https://docs.craftcms.com/feed-me/v4/get-started/configuration.html#example-requestoptions
For example:

return [
    '*' => [
        'requestOptions' => [
            'headers' => [
                'X-API-KEY' => 'xxxxxxxx',
            ],
        ],
    ]
];```


---

