Set authorization header with variable
# support
h
In my API request tool, I am gonna to set authorization header. But problem is : Each assistant has different api token. Detail Usecase: This api is for hotel. Each hotel has own assistant and own api key Can I set header with variable ? How ? https://cdn.discordapp.com/attachments/1379803346826694768/1379803347443253288/image.png?ex=68419181&is=68404001&hm=d2a647dced75ee52d5921b9fd4fb8b5c24227e53acf5d6cf0078579bcb3f9b04&
v
Yes, you can set the authorization header using a variable. In your tool configuration, use the following pattern:
Copy code
Authorization: OAuth oauth_token={{apiToken}}
At runtime, provide the correct
apiToken
value for each assistant via dynamic variables in your server response or configuration. This allows each hotel assistant to use its own API key automatically. Reference: [Vapi Personalization Docs](https://docs.vapi.ai/assistants/personalization) Source: - [Vapi Personalization Docs](https://docs.vapi.ai/assistants/personalization)
v
Yes, you can set the authorization header with a variable by using dynamic variables in your API request tool. Here’s how you can achieve this: 1. **Dynamic Variable Setup**: When starting an API request, use the variable syntax
{{variableName}}
in your header configuration. For example, set the Authorization header like this:
"Authorization": "Bearer {{hotelApiKey}}"
. 2. **Pass Variable Values**: When making the call, ensure you're passing the
hotelApiKey
value through
assistantOverrides.variableValues
in your JSON payload.
Copy code
json
   {
     "assistantOverrides": {
       "variableValues": {
         "hotelApiKey": "your-specific-hotel-api-token"
       }
     }
   }
This setup will dynamically replace
{{hotelApiKey}}
with the corresponding API token for each assistant during the request. More on dynamic variables can be found [here](https://docs.vapi.ai/assistants/dynamic-variables).
h
Is it not possible to set Dynamic Variable inside prompt ?
My client is non-tech. They does not know how to call API
v
Message marked as helpful by @Hans! 🎉
h
Is it not possible to set Dynamic Variable inside prompt ? My client is non-tech. They does not know how to call API For example, in system prompt oauth_token = "1234567890" In API request tool, use {{oauth_token}} in header value Honestly, I tried this but not working I hope it might be possible
a
Yes, i see they already shown a way to do it via API overriding variables, but as you said your client does not have the ability to do that what i suggest is adding the token in the tool secret token. you can "grab" that in the server that receives the request using the X-Vapi-Secret header https://cdn.discordapp.com/attachments/1379803346826694768/1379897528073326754/Screenshot_2025-06-04_at_8.37.34_PM.png?ex=6841e937&is=684097b7&hm=79ff0e3f6537fca896bda4e45a61169e9a652c93f361e569c335dae6c44fb517&