Authentication
Create an API key and authenticate requests from your server.
https://api.dehashit.com/api/v1/Authentication
Include your API key in the X-Api-Key HTTP header when calling the API from your server. Never expose keys in client-side code, mobile applications, or public version control.
Authentication header
X-Api-Key: dh_live_...Replace dh_live_... with your own key. The example below validates a phone number and is always free, so you can confirm authentication before making a billable lookup.
Example authenticated request
curl -X POST https://api.dehashit.com/api/v1/validations/phone-validation/ \
-H "X-Api-Key: dh_live_..." \
-H "Content-Type: application/json" \
-d '{"phone_number": "254712345678", "country_code": "254"}'import requests
res = requests.post(
"https://api.dehashit.com/api/v1/validations/phone-validation/",
headers={
"X-Api-Key": "dh_live_...",
"Content-Type": "application/json",
},
json={"phone_number": "254712345678", "country_code": "254"},
timeout=10,
)
print(res.json())const res = await fetch("https://api.dehashit.com/api/v1/validations/phone-validation/", {
method: "POST",
headers: {
"X-Api-Key": "dh_live_...",
"Content-Type": "application/json",
},
body: JSON.stringify({ phone_number: "254712345678", country_code: "254" }),
});
const data = await res.json();
console.log(data);package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
body, _ := json.Marshal(map[string]string{
"phone_number": "254712345678",
"country_code": "254",
})
req, _ := http.NewRequest("POST", "https://api.dehashit.com/api/v1/validations/phone-validation/", bytes.NewReader(body))
req.Header.Set("X-Api-Key", "dh_live_...")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
fmt.Println(res.Status)
}Manage your keys
Generate, rotate, and revoke keys in the API keys dashboard. Copy a new key when it is created: its secret is shown only once. Rotate a key to replace it, and revoke any key you no longer use. Requests with missing, invalid, or revoked keys return 401 unauthorized. Dashboard web sessions use an HTTP-only cookie. Use API keys for these server integrations; dashboard sessions do not authenticate the decrypt or validation endpoints.
Need a hand with your integration? Contact support.