# Dynamically specified API credentials

**URL:** <https://community.n8n.io/t/dynamically-specified-api-credentials/3396>\
**Category:** Questions\
**Created:** [December 14, 2020, 3:07pm UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396 "2020-12-14T15:07:31Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![wloody54](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/wloody54/32/2648_2.png) [@wloody54](https://community.n8n.io/u/wloody54)\
**Post date:** [December 14, 2020, 3:07pm UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/1 "2020-12-14T15:07:31Z")

</div>

Hi,

is there way how dynamically specified which one API credentials will be used in workflow, when is a node is runned? I want use the Hive and Cortex nodes.

I have more instancies of this products and need run same work flow on different instancies specified as json atribute.

 ![2020-12-14_13-20-18](https://europe1.discourse-cdn.com/n8n/original/2X/1/1fa8e693398c35b0cacebf080ede774bb702c9c0.jpeg)

My question is about this parameter in credentials. When i wrote something like this:  
“theHiveApi”: “{{$json["test"]}}”  
the aplication didn’t expand variable.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [December 14, 2020, 4:04pm UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/2 "2020-12-14T16:04:56Z")

</div>

No that is currently sadly not possible.

The only way to do that (but not very “nice”) is via the Execute-Workflow node and specify the workflow to run as JSON and then have an expression for the credential value.

---

<div class="post-metadata">

**Author:** ![wloody54](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/wloody54/32/2648_2.png) [@wloody54](https://community.n8n.io/u/wloody54)\
**Post date:** [December 14, 2020, 4:57pm UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/3 "2020-12-14T16:57:28Z")

</div>

Interesting idea, i will think about it. It is look as working solution, but still complication for me.

Could be it as future request? I do not know how it is working in backkend but I think it is interesting featchure for some body who use more instances of same aplication.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [December 14, 2020, 5:03pm UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/4 "2020-12-14T17:03:23Z")

</div>

Yes totally agree! Please check first if such a request got already made under Feature Request.  
If yes, please upvote and add your specific needs to it.  
If not, create a new one.

Thanks!

---

<div class="post-metadata">

**Author:** ![wloody54](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/wloody54/32/2648_2.png) [@wloody54](https://community.n8n.io/u/wloody54)\
**Post date:** [December 14, 2020, 6:02pm UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/5 "2020-12-14T18:02:24Z")

</div>

Future request is created [Set Credentials programmatically [GOT CREATED]](http://community.n8n.io/t/set-credentials-programmatically/1748)

---

<div class="post-metadata">

**Author:** ![wloody54](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/wloody54/32/2648_2.png) [@wloody54](https://community.n8n.io/u/wloody54)\
**Post date:** [January 26, 2021, 7:05am UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/6 "2021-01-26T07:05:10Z")

</div>

> [@Set Credentials programmatically \[GOT CREATED\]](http://community.n8n.io/t/set-credentials-programmatically-got-created/1748/11):
>
> Did just add full expression support to credentials: [https://github.com/n8n-io/n8n/commit/1dedb3f4b87750aeea4e7b00ea2d5bf6b8258cc5](https://github.com/n8n-io/n8n/commit/1dedb3f4b87750aeea4e7b00ea2d5bf6b8258cc5) That allows now to use any kind of flow data in credentials. The only limitation is that it uses always the data of the first item. So if there are two items the first one having name: frank1, the second name: tom2 and credentials using the following expression {{$json.name}} it would use in the credentials only the value frank1.

 ![image](https://europe1.discourse-cdn.com/n8n/original/2X/d/d3b6689e7aecad66a3f0799922e2dc349988e45f.png)

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 26, 2021, 8:08am UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/7 "2021-01-26T08:08:19Z")

</div>

That are sadly two different things.

The feature you did request is to set the credentials itself via an expression. That is still not possible.  
The feature that got implemented is being able to use expressions within credentials.

---

<div class="post-metadata">

**Author:** ![wloody54](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/wloody54/32/2648_2.png) [@wloody54](https://community.n8n.io/u/wloody54)\
**Post date:** [January 26, 2021, 8:40am UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/8 "2021-01-26T08:40:38Z")

</div>

Hi Jan.

Yes it is true. Expression support is not same. But for me it could be elegant solution. Better as use raw http request.

I am trying run a sub workflow with diferent credentialas. Simple, you have main workflow and from this main workflow I want to run same sub workflow but with different credentials (in my project api key).

So if I understand correctly, now i can in main workflow add right api key by the “Set” node and with this api key added to json object, run subworkflow. In the “Set” node I can set api dynamically by others nodes and in sub workflow use use expression. Right?

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [January 26, 2021, 8:47am UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/9 "2021-01-26T08:47:40Z")

</div>

Yes, that is correct. That would be possible now.

Great to hear that it is also helpful for you.

Have fun!

---

<div class="post-metadata">

**Author:** ![robinsingh](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@robinsingh](https://community.n8n.io/u/robinsingh)\
**Post date:** [June 25, 2021, 10:03am UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/10 "2021-06-25T10:03:02Z")

</div>

Can anybody please share the example I want to connect the salesforce node with dynamic credentials which I have passed from webhook call

---

<div class="post-metadata">

**Author:** ![harshil1712](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/harshil1712/32/1374_2.png) [@harshil1712](https://community.n8n.io/u/harshil1712)\
**Post date:** [June 25, 2021, 7:44pm UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/11 "2021-06-25T19:44:30Z")

</div>

Hey @robinsingh!

To make sure I understand this clearly, you want to pass on the credentials dynamically to the Salesforce node. Is that correct?

---

<div class="post-metadata">

**Author:** ![Yasirunet](https://avatars.discourse-cdn.com/v4/letter/y/bb73d2/32.png) [@Yasirunet](https://community.n8n.io/u/Yasirunet)\
**Post date:** [August 11, 2022, 2:14am UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/12 "2022-08-11T02:14:24Z")

</div>

Hi @jan !  
This is something still not possible with n8n right? or is there any other way to achieve it? I’m just curious about the updates of this feture.

Thanks in advanced

---

<div class="post-metadata">

**Author:** ![Lester\_Reynolds](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/lester_reynolds/32/33132_2.png) [@Lester\_Reynolds](https://community.n8n.io/u/Lester_Reynolds)\
**Post date:** [January 23, 2024, 3:57pm UTC](https://community.n8n.io/t/dynamically-specified-api-credentials/3396/13 "2024-01-23T15:57:33Z")

</div>

Hello ! Is there now a way to do this ?
