Authentication
Authenticate Cleanvoice API requests.
Get your API key
Go to app.cleanvoice.ai/developer/api-keys and create a new key.
Try with your API key
Paste your key — all code examples on this page update instantly. Stays in your browser only, never sent anywhere.
Pass the key in the header
Every request must include an X-API-Key header. Store it as an environment variable rather than hard-coding it.
export CLEANVOICE_API_KEY="your_api_key_here"
curl https://api.cleanvoice.ai/v1/account \
-H "X-API-Key: $CLEANVOICE_API_KEY"<?php
// Store in environment: export CLEANVOICE_API_KEY="your_api_key_here"
$apiKey = getenv('CLEANVOICE_API_KEY');
$ch = curl_init('https://api.cleanvoice.ai/v1/account');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["X-API-Key: $apiKey"],
]);
$response = curl_exec($ch);
curl_close($ch);import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
// Store in environment: export CLEANVOICE_API_KEY="your_api_key_here"
String apiKey = System.getenv("CLEANVOICE_API_KEY");
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.cleanvoice.ai/v1/account"))
.header("X-API-Key", apiKey)
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());require 'net/http'
# Store in environment: export CLEANVOICE_API_KEY="your_api_key_here"
api_key = ENV['CLEANVOICE_API_KEY']
uri = URI('https://api.cleanvoice.ai/v1/account')
request = Net::HTTP::Get.new(uri)
request['X-API-Key'] = api_key
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
http.request(request)
endHTTP/1.1 200 OKA 200 confirms the key is valid and recognised. A 401 means the key was rejected:
| Status | Meaning |
|---|---|
401 Unauthorized | Key is missing or invalid |
Verify your key
Use the account endpoint to verify your key and inspect remaining credit. The auth check currently lives on /v1/account, even if your editing requests use /v2/....
curl https://api.cleanvoice.ai/v1/account \
-H "X-API-Key: $CLEANVOICE_API_KEY"<?php
$ch = curl_init('https://api.cleanvoice.ai/v1/account');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('CLEANVOICE_API_KEY')],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.cleanvoice.ai/v1/account"))
.header("X-API-Key", System.getenv("CLEANVOICE_API_KEY"))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());require 'net/http'
require 'json'
uri = URI('https://api.cleanvoice.ai/v1/account')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request['X-API-Key'] = ENV['CLEANVOICE_API_KEY']
response = JSON.parse(http.request(request).body)
puts response{
"credit": {
"total": 1234,
"subscription": 1000,
"payg": 234
},
"meta": {}
}Returns your account information and remaining credits if the key is valid.
Error responses
| Status | Meaning |
|---|---|
401 Unauthorized | API key is missing or invalid |
Keep your API key secret. Never commit it to source control, include it in client-side code, or expose it in public URLs. Use environment variables or a secrets manager.