Using API Keys
Prerequisites
- You have obtained API Keys and got both a
ClientID
and aClientSecret
.
API Requests
Use the ClientID
and ClientSecret
as headers for signing all requests to the Palabra API.
Code example for Built-in Voices Palabra API request:
- cURL
- Python
- Go
- NodeJS
curl -L 'https://api.palabra.ai/saas/voice/builtin' \
-H 'Accept: application/json' \
-H 'ClientID: <YourClientID>' \
-H 'ClientSecret: <YourClientSecret>'
import requests
url = 'https://api.palabra.ai/saas/voice/builtin'
headers = {
'Accept': 'application/json',
'ClientID': '<YourClientID>',
'ClientSecret': '<YourClientSecret>',
}
response = requests.get(url, headers=headers)
# Print the response status code and content
print(response.status_code)
print(response.json())
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.palabra.ai/saas/voice/builtin"
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
// Set headers
req.Header.Set("Accept", "application/json")
req.Header.Set("ClientID", "<YourClientID>")
req.Header.Set("ClientSecret", "<YourClientSecret>")
// Perform the request
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error making request:", err)
return
}
defer resp.Body.Close()
// Read and print the response
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response body:", err)
return
}
fmt.Println("Status Code:", resp.StatusCode)
fmt.Println("Response Body:", string(body))
}
const axios = require('axios');
const url = 'https://api.palabra.ai/saas/voice/builtin';
const headers = {
'Accept': 'application/json',
'ClientID': '<YourClientID>',
'ClientSecret': '<YourClientSecret>'
};
axios.get(url, { headers })
.then(response => {
console.log('Status Code:', response.status);
console.log('Response Data:', response.data);
})
.catch(error => {
console.error('Error making request:', error);
});
API Reference Playground
Most sections in the Palabra Documentation, such as “Built-in Voices”, include a Playground block where you can authorize using your ClientID
and ClientSecret
and execute test requests directly to the Palabra API.
Swagger Playground
The Palabra API documentation is also available in a Swagger mode, offering the same content as the API Reference but with a different user interface.
Swagger supports authorization using your ClientID
and ClientSecret
, allowing you to make test requests directly within the Swagger playground.