POST
/
v1
/
agents
/
{agent_id}
/
authorize
Authorize a Web Agent Call
curl --request POST \
  --url https://api.bland.ai/v1/agents/{agent_id}/authorize \
  --header 'authorization: <authorization>'
{
  "token": "22480c52-0ff1-4214-bcb7-50649b508432"
}

Headers

authorization
string
required
Your API key for authentication.Example web call usage (client side):
import { BlandWebClient } from 'bland-client-js-sdk';

const agentId = 'YOUR-AGENT-ID';
const sessionToken = 'YOUR-SESSION-TOKEN';


document.addEventListener('DOMContentLoaded', async () => {
    document.getElementById('btn').addEventListener('click', async () => {
        const blandClient = new BlandWebClient(
            agentId,
            sessionToken
        );
        await blandClient.initConversation({
            sampleRate: 44100,
        });
    });
});

Path

agent_id
string
required
The web agent to authorize a call for.Special note: While in Beta, this request must be made to the api.bland.ai domain.

Response

token
string
The single-use session token that can be sent to the client.
status
string
Can be success or error.
message
string
A message saying whether the token creation succeeded, or a helpful message describing why it failed.
{
  "token": "22480c52-0ff1-4214-bcb7-50649b508432"
}