AnantSparrow
10/04/2024, 3:17 PMVapi
10/04/2024, 3:23 PMphp
<?php
// Your VAPI.ai credentials
$provider = 'your_provider_name'; // Replace with your provider name
$apiKey = 'your_api_key'; // Replace with your API key
// VAPI.ai credential endpoint
$url = 'https://api.vapi.ai/credential';
// Prepare the payload
$data = [
'provider' => $provider,
'apiKey' => $apiKey
];
// Initialize cURL session
$ch = curl_init($url);
// Set cURL options
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $apiKey, // Add your token here
'Content-Type: application/json'
]);
// Execute the POST request
$response = curl_exec($ch);
// Check for errors
if (curl_errno($ch)) {
// Handle error
echo 'cURL error: ' . curl_error($ch);
} else {
// Parse the response
$decodedResponse = json_decode($response, true);
// Do something with the response
print_r($decodedResponse);
}
// Close cURL session
curl_close($ch);
?>
Make sure to replace 'your_provider_name'
and 'your_api_key'
with your actual VAPI.ai provider name and API key. This script will send a POST request to the VAPI.ai credential endpoint and output the response.
If you're still having trouble or need further assistance, please let me know!Vapi
10/04/2024, 3:23 PMAnantSparrow
10/04/2024, 3:24 PMAnantSparrow
10/04/2024, 3:24 PMVapi
10/04/2024, 3:25 PMAnantSparrow
10/05/2024, 5:25 PMDigi
10/05/2024, 5:33 PMAnantSparrow
10/05/2024, 5:34 PMDigi
10/05/2024, 5:34 PMDigi
10/05/2024, 5:35 PMDigi
10/05/2024, 5:35 PMAnantSparrow
10/05/2024, 5:42 PMAnantSparrow
10/05/2024, 5:42 PMAnantSparrow
10/05/2024, 5:42 PMShubham Bajaj
10/07/2024, 6:13 PMShubham Bajaj
10/07/2024, 7:43 PM