Skip to main content

cURL recipes

All examples use the placeholder YOUR_API_KEY — replace with your own zh_api_… key.

Submit speech analysis

curl -X POST "https://platform.zenhire.ai/api/v1/speech/analyze" \
-H "X-API-Key: YOUR_API_KEY" \
-F "audio=@interview.mp3" \
-F "language=en" \
-F "externalId=candidate-abc-123"

Poll for results

curl "https://platform.zenhire.ai/api/v1/speech/analyze/req_..." \
-H "X-API-Key: YOUR_API_KEY"

List runs

# All runs (newest first, default limit 20)
curl "https://platform.zenhire.ai/api/v1/speech/runs" \
-H "X-API-Key: YOUR_API_KEY"

# All runs for a specific external id
curl "https://platform.zenhire.ai/api/v1/speech/runs?externalId=candidate-abc-123" \
-H "X-API-Key: YOUR_API_KEY"

# Last 24 hours of successful runs
curl "https://platform.zenhire.ai/api/v1/speech/runs?status=success&createdAfter=2026-04-19T00:00:00Z" \
-H "X-API-Key: YOUR_API_KEY"

Credits

curl "https://platform.zenhire.ai/api/v1/credits" \
-H "X-API-Key: YOUR_API_KEY"

Health

curl "https://platform.zenhire.ai/api/v1/health"

End-to-end submit + poll loop (bash)

#!/bin/bash
set -euo pipefail

API_KEY="${ZENHIRE_API_KEY:?set ZENHIRE_API_KEY}"
AUDIO="interview.mp3"
BASE="https://platform.zenhire.ai"

SUBMIT=$(curl -sS -X POST "$BASE/api/v1/speech/analyze" \
-H "X-API-Key: $API_KEY" \
-F "audio=@$AUDIO" \
-F "language=en")

REQUEST_ID=$(echo "$SUBMIT" | sed -n 's/.*"id":"\([^"]*\)".*/\1/p')
echo "Submitted: $REQUEST_ID"

while true; do
sleep 15
RESP=$(curl -sS "$BASE/api/v1/speech/analyze/$REQUEST_ID" \
-H "X-API-Key: $API_KEY")
STATUS=$(echo "$RESP" | sed -n 's/.*"status":"\([^"]*\)".*/\1/p')

case "$STATUS" in
success|partial)
echo "Done: $STATUS"
echo "$RESP" | python3 -m json.tool
break
;;
failed)
echo "Failed: $RESP"
exit 1
;;
*)
echo "Still $STATUS..."
;;
esac
done