Methods for Passing Keys
Three methods for passing API keys are supported and are used when creating the tool.Method 1: Query Parameter
The API key will be passed via the query string. The name of the parameter must be provided when the tool is created.Creating a tool with a query param auth key
Providing the auth key during call creation
Method 2: Header
The API key will be passed via a custom header. The name of the header must be provided when the tool is created.Creating a tool with a custom header auth key
Providing the auth key during call creation
Method 3: HTTP Authentication
The API key will be passed via the HTTP Authentication header. The name of the scheme (e.g.Bearer
) must be provided when the tool is created.
Creating a tool that passes auth key via HTTP Authentication header
Providing the auth key during call creation
Multiple Options Supported
Your tool can specify multiple options for fulfilling auth requirements (for example if your server allows either query or header auth). Each option may also contain multiple requirements, for example if your server requires both a user_id and an auth_token for that user.Passing Keys at Call Creation Time
When defining an agent or creating a call, you pass in the key(s) in theauthTokens
property of selectedTools
.
If the tokens you provide satisfy multiple options, the first non-empty option whose requirements are all satisfied
will be used. An unauthenticated option, if present, will only be used if no other option can be satisfied.