Web Agents
Authorize a Web Agent Call
Create a single-use session token for a client to talk with your web agent.
POST
/
v1
/
agents
/
{agent_id}
/
authorize
Headers
authorization
string
requiredYour 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
requiredThe web agent to authorize a call for.
Special note: While in Beta, this request must be made to the web.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.