https://retellai.com/?utm_source=discord&utm_medium=seo logo
<@1145576664366055464> how do i access the headers...
# ❓・ai-evy-support
r
@AI Evy how do i access the headers section?
a
Thanks for tagging me @ryan_81480. I'll look through relevant sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [API Key Overview]() * [Retell Node API Library]() * [Retell Python API library]() * [ADD SIP headers]() -----------------------------
### Answer For REST API requests, you need to include your API key in the Authorization header [(1)]() . Here's how to access response headers in different SDKs: For Node.js/TypeScript:
Copy code
typescript
const response = await client.agent
  .create({
    response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
    voice_id: '11labs-Adrian',
  })
  .asResponse();
console.log(response.headers.get('X-My-Header'));
[(2)]() For Python:
Copy code
python
response = client.agent.with_raw_response.create(
    response_engine={
        "llm_id": "llm_234sdertfsdsfsdf",
        "type": "retell-llm",
    },
    voice_id="11labs-Adrian",
)
print(response.headers.get('X-My-Header'))
[(3)]() However, for custom functions and tool calls, currently there isn't a way to pass custom headers directly [(4)]() [(5)]() .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
r
Where do I imput the json code "{ "Authorization": "Bearer cal_live_1a102226dd72227ef138e8eebc1bfd2d", "Content-Type": "application/json" } "
@AI Evy Where do I imput the json code "{ "Authorization": "Bearer cal_live_1a102226dd72227ef138e8eebc1bfd2d", "Content-Type": "application/json" } "
a
Thanks for the follow-up, @ryan_81480. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [SDKs]() * [Integrate any system with custom function]() * [Retell Node API Library]() * [LLM WebSocket]() -----------------------------
### Answer For Node.js/TypeScript, you can initialize the client with your API key like this:
Copy code
typescript
import Retell from 'retell-sdk';

const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
});
[(1)]() The Content-Type header is automatically set to application/json when making API requests through the SDK [(2)]() . For custom requests, you can include headers like this:
Copy code
javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: '<authorization>',
    'Content-Type': 'application/json'
  }
};
[(3)]() Remember that you should get your API key from the "API Keys" tab in your dashboard .
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.