> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bland.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Authorize a Web Agent Call

> Create a single-use session token for a client to talk with your web agent.

### Headers

<ParamField header="authorization" type="string" required>
  Your API key for authentication.

  Example web call usage (client side):

  ```javascript theme={null}
  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,
          });
      });
  });
  ```
</ParamField>

### Path

<ParamField path="agent_id" type="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.
</ParamField>

### Body

<ParamField body="request_data" type="object">
  Variables to be passed to this session.

  Example:

  ```json theme={null}
  {
    "name": "John Doe"
  }
  ```
</ParamField>

### Response

<ResponseField name="token" type="string">
  The single-use session token that can be sent to the client.
</ResponseField>

<ResponseField name="status" type="string">
  Can be `success` or `error`.
</ResponseField>

<ResponseField name="message" type="string">
  A message saying whether the token creation succeeded, or a helpful message describing why it failed.
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
    "token": "22480c52-0ff1-4214-bcb7-50649b508432"
  }
  ```
</ResponseExample>

***

Docs for agents: [llms.txt](/llms.txt)
