---
title: Voicemail Detector API v1 reference
updated: "2026-12-01"
url: https://voicemaildetector.com/docs.md
html: https://voicemaildetector.com/docs
---

# Voicemail Detector API v1

Send the audio of the called side and get back who answered: `human`, `machine` or `unknown`. Stream it while the call is live, or send a recording when it is not. Every transport takes the same options and returns the same results.

- REST: `https://api.voicemaildetector.com/v1`
- WebSocket: `wss://api.voicemaildetector.com/v1/stream`
- gRPC: `api.voicemaildetector.com:443`

## Get a key

1. Sign in with Google at https://voicemaildetector.com/login.
2. In the dashboard, create your API key and store it right away: the full key is shown only once.
3. Send your first recording to `/v1/detect`. Usage shows up in the dashboard within a couple of minutes.

An account can have up to 10 active keys, each with a name: one per app, environment or customer. They share the account's plan, credits and concurrent calls, and the dashboard shows usage per key. To replace a key, create the new one, deploy it, then revoke the old one: it stops working within about a minute and the others keep working.

## With a coding agent

Give your coding agent this prompt from the project folder. It reads the setup guide, finds how your code places calls, shows you its plan, wires in the right transport and checks it with two real recordings. Your key stays in `VD_API_KEY`: the prompt never carries it.

```text
Set up Voicemail Detector in this project: fetch https://voicemaildetector.com/install.md and follow it. Read my API key only from the VD_API_KEY environment variable; never print it, commit it or ask me to paste it.
```

- Setup guide: https://voicemaildetector.com/install.md
- This reference in Markdown: https://voicemaildetector.com/docs.md
- Index: https://voicemaildetector.com/llms.txt
- Everything in one file: https://voicemaildetector.com/llms-full.txt
- gRPC contract: https://voicemaildetector.com/proto/vd/v1/detector.proto

## MCP server

Coding agents can connect to the MCP server at https://voicemaildetector.com/mcp (Streamable HTTP, JSON responses, no sessions). Send the API key as `Authorization: Bearer <key>` from the `VD_API_KEY` environment variable. Tools: `read_guide` (the setup guide or this reference), `sample_recordings` (real recordings with their verdicts) and `detect_recording` (one recording through the API with your key; uses one call). Prompt: `setup`.

```json
{
  "mcpServers": {
    "voicemaildetector": {
      "type": "http",
      "url": "https://voicemaildetector.com/mcp",
      "headers": {"Authorization": "Bearer ${VD_API_KEY}"}
    }
  }
}
```

## Node.js and Python

Official client libraries wrap the WebSocket and REST API: `npm install voicemaildetector` (Node.js 22 or later) and `pip install voicemaildetector` (Python 3.10 or later, regular and asyncio). They hold audio until the stream opens, split large frames and raise one error type with a `code` and `retryable`. Guide: https://voicemaildetector.com/docs/sdks. Code and Twilio and Telnyx relay examples: https://github.com/voicemaildetector/voicemaildetector-node and https://github.com/voicemaildetector/voicemaildetector-python.

## Twilio and Telnyx

Twilio Media Streams and Telnyx media streaming can send the call's audio straight to `wss://api.voicemaildetector.com/v1/twilio` or `wss://api.voicemaildetector.com/v1/telnyx`. Twilio takes the key and the callback as `<Parameter name="key">` and `<Parameter name="callback">` inside `<Stream>`; Telnyx, as `key` and `callback` in the query of `stream_url`. `decision_timeout_ms` and `watch_ms` go the same way. The verdict is posted to the callback (https, public) as a form shaped like Twilio's `AsyncAmdStatusCallback` (`AnsweredBy`: `human`, `machine_start`, `unknown`) or JSON shaped like Telnyx's `call.machine.detection.ended` (`result`: `human`, `machine`, `not_sure`), with `verdict`, `stage`, `at_ms` and, when there was no verdict, an error code. Each webhook carries `X-VD-Signature: t=<unix>,v1=<hex HMAC-SHA256("<t>.<raw body>", API key)>`. Guide: https://voicemaildetector.com/docs/twilio-telnyx.

## Asterisk and Vicidial

On Asterisk, the open-source connector replaces `AMD()` with one line of the dialplan and sets the same variables, so Vicidial keeps working. Asterisk 11 to 24.

```sh
curl -fsSL https://voicemaildetector.com/install.sh | sudo sh
sudo voicemaildetector setup
```

Then change `AMD(2000,2000,1000,5000,120,50,4,256)` to `EAGI(voicemaildetector,2000,2000,1000,5000,120,50,4,256)`, or run `sudo voicemaildetector enable`. Guide: https://voicemaildetector.com/docs/asterisk. Code: https://github.com/voicemaildetector/connector.

## Authentication

Every request needs an API key, which starts with `vd_`. Send it as `Authorization: Bearer vd_…`, or as `X-API-Key`. On gRPC it goes in the `authorization` metadata the same way.

A browser opening a WebSocket cannot set headers: pass the key as `?key=vd_…` instead. Keep keys on your servers whenever you can.

## Audio

The called side of the call, mono. Calls cross the telephone network at 8 kHz; audio from a browser (WebRTC) or a voice AI pipeline can stay at its own rate, up to 48 kHz: set `sample_rate` and send it as it is. Start sending at answer; ringback is not the callee.

| encoding | format | 20 ms frame |
|---|---|---|
| `mulaw` | G.711 µ-law | 160 bytes |
| `alaw` | G.711 A-law | 160 bytes |
| `pcm16` | 16-bit little-endian PCM | 320 bytes |

Frame sizes are at 8 kHz; a 20 ms `pcm16` frame is 640 bytes at 16 kHz and 1,920 at 48 kHz. WAV files carry their own format and rate. Raw audio needs `encoding`. Streams take frames of any size; 20 ms is usual.

## Options

Query parameters on REST and WebSocket; the same names in the `Config` message on gRPC, where 0 or unset means the default.

| name | values | meaning |
|---|---|---|
| `encoding` | `pcm16`, `mulaw`, `alaw` | Required for raw audio and for streams. A WAV file carries its own. |
| `sample_rate` | 8000 (default), 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 | The rate of raw audio and streams, as you have it: 8000 for telephone audio, usually 16000 or 48000 from a browser or a voice AI pipeline. A WAV file carries its own. |
| `decision_timeout_ms` | 1000–30000, default 6000 | The most audio heard before the first verdict: every call has one by then. |
| `watch_ms` | up to 60000; 0 for files, 30000 for streams | How long to keep listening after a human verdict, in case a machine turns up later and overturns it. |

Pick `decision_timeout_ms` for your traffic: a shorter one connects sooner and leaves more calls `unknown`; a longer one decides more of them.

## Results

Every result has the same shape, whatever the transport.

```json
{"verdict": "machine", "stage": "decision", "at_ms": 3250}
```

Verdicts:

- `human`: a person answered. Connect.
- `machine`: a voicemail, an announcement, an assistant, an IVR or a bot answered. Cut.
- `unknown`: the line stayed silent, or the audio ended first. Your policy decides.

Stages:

- `decision`: the first verdict on the call.
- `after_human`: a later result that overturns `human`, while `watch_ms` lasts.

`at_ms` is the audio heard, from the answer, when the result was given.

## REST

`POST https://api.voicemaildetector.com/v1/detect` with the whole file as the body, up to 8 MiB. For post-call QA, disputes and backtests against the detector you run today. The answer comes once the file has been heard.

```sh
# A WAV file carries its own format.
curl https://api.voicemaildetector.com/v1/detect \
  -H "Authorization: Bearer $VD_API_KEY" \
  --data-binary @call-0193.wav

# Raw audio names its encoding.
curl "https://api.voicemaildetector.com/v1/detect?encoding=mulaw" \
  -H "Authorization: Bearer $VD_API_KEY" \
  --data-binary @call-0193.ulaw
```

```json
{
  "verdict": "machine",
  "results": [{"verdict": "machine", "stage": "decision", "at_ms": 3250}],
  "audio_ms": 3250
}
```

`verdict` is the last word: the `after_human` result when there is one. `audio_ms` is the audio analysed, which stops once nothing could change the results.

## WebSocket

Open `wss://api.voicemaildetector.com/v1/stream` with the options in the query string. Send audio as binary messages, and `{"type":"end"}` as a text message when the call is over.

Nothing waits for the verdict. Your agent or voice AI starts talking the moment the call is answered, while a copy of the callee's audio goes to the stream; the verdict arrives on the side. On `machine`, hang up or switch to leaving a message; on `human`, the conversation is already going.

```js
import WebSocket from 'ws'

// Answered: your agent or voice AI talks right away. The verdict comes on the side.
agent.start(call)

const ws = new WebSocket('wss://api.voicemaildetector.com/v1/stream?encoding=mulaw', {
  headers: {authorization: `Bearer ${process.env.VD_API_KEY}`}
})

// The callee's audio, raw 20 ms frames.
call.on('audio', frame => ws.readyState === ws.OPEN && ws.send(frame))
call.on('end', () => ws.readyState === ws.OPEN && ws.send(JSON.stringify({type: 'end'})))

ws.on('message', data => {
  const event = JSON.parse(data)
  if (event.type === 'result' && event.verdict === 'machine') {
    agent.leaveMessage() // or call.hangup()
  }
})
```

```json
{"type": "ready"}
{"type": "result", "verdict": "human", "stage": "decision", "at_ms": 2250}
{"type": "done", "audio_ms": 2250}
```

The server sends `ready` once it is listening, a `result` the moment each one is known, and `done` before closing. The decision timeout also runs on the clock from the first frame, so a verdict arrives even if your audio stops. Text messages other than `{"type":"end"}` are ignored.

## gRPC

`vd.v1.DetectorService` at `api.voicemaildetector.com:443`, over TLS. `Stream` takes a `Config` first, then audio messages up to 64 KiB; close your sending side when the call is over. `Detect` takes a whole file. The server supports reflection, so tools like `grpcurl` work without the proto. Full proto: https://voicemaildetector.com/proto/vd/v1/detector.proto.

```protobuf
syntax = "proto3";
package vd.v1;

service DetectorService {
  // Config first, then audio. Results come back the moment they are known.
  rpc Stream(stream StreamRequest) returns (stream StreamResponse);
  // A whole recording, WAV or raw.
  rpc Detect(DetectRequest) returns (DetectResponse);
}

message Config {
  Encoding encoding = 1;              // ENCODING_PCM16, ENCODING_MULAW, ENCODING_ALAW
  uint32 sample_rate = 2;             // 8000 to 48000; 0 means 8000
  uint32 decision_timeout_ms = 3;     // 1000 to 30000; 0 means 6000
  optional uint32 watch_ms = 4;       // up to 60000
}

message StreamRequest {
  oneof request {
    Config config = 1;                // first message only
    bytes audio = 2;                  // up to 64 KiB per message
  }
}

message StreamResponse {
  oneof response {
    Ready ready = 1;
    Result result = 2;
    Done done = 3;
  }
}

message Result {
  Verdict verdict = 1;                // VERDICT_HUMAN, VERDICT_MACHINE, VERDICT_UNKNOWN
  Stage stage = 2;                    // STAGE_DECISION, STAGE_AFTER_HUMAN
  int64 at_ms = 3;
}

message Done {
  int64 audio_ms = 1;
  string reason = 2;
}

message DetectRequest {
  Config config = 1;
  bytes audio = 2;                    // up to 8 MiB
}

message DetectResponse {
  Verdict verdict = 1;
  repeated Result results = 2;
  int64 audio_ms = 3;
}
```

```go
conn, err := grpc.NewClient("api.voicemaildetector.com:443", grpc.WithTransportCredentials(credentials.NewTLS(nil)))
if err != nil {
	return err
}
ctx = metadata.AppendToOutgoingContext(ctx, "authorization", "Bearer "+apiKey)
stream, err := vdv1.NewDetectorServiceClient(conn).Stream(ctx)
if err != nil {
	return err
}
stream.Send(&vdv1.StreamRequest{Request: &vdv1.StreamRequest_Config{Config: &vdv1.Config{
	Encoding: vdv1.Encoding_ENCODING_MULAW,
}}})
go func() {
	for frame := range rtpFrames { // 20 ms each, as they arrive
		if stream.Send(&vdv1.StreamRequest{Request: &vdv1.StreamRequest_Audio{Audio: frame}}) != nil {
			return
		}
	}
	stream.CloseSend()
}()
for {
	msg, err := stream.Recv()
	if err != nil {
		break // io.EOF once the call is decided
	}
	if r := msg.GetResult(); r != nil && r.Verdict == vdv1.Verdict_VERDICT_MACHINE {
		hangup()
	}
}
```

## Errors and limits

REST and WebSocket answer errors as JSON, with the HTTP status; gRPC answers with the matching status code.

```json
{"error": "unauthorized", "message": "invalid API key: send it as Authorization: Bearer <key>"}
```

| code | when |
|---|---|
| `unauthorized` · 401 · `UNAUTHENTICATED` | Missing, revoked or malformed API key. |
| `bad_request` · 400 · `INVALID_ARGUMENT` | Unknown encoding, a sample rate not in the list, an option out of range, or audio sent before the config. |
| `bad_audio` · 400 · `INVALID_ARGUMENT` | The file could not be read as audio: a WAV at a rate not in the list, or raw audio without an encoding. |
| `too_large` · 413 · `INVALID_ARGUMENT` | More than 8 MiB in one request, or more than 64 KiB in one stream message. |
| `busy` · 503 · `RESOURCE_EXHAUSTED` | Too many calls at once. Refused at once, never queued: retry shortly. |
| `too_many_calls` · 429 · `RESOURCE_EXHAUSTED` | Your account already has as many calls running as your plan allows, counting every key. Wait for one to end, or move to a larger plan. |
| `payment_required` · 402 · `RESOURCE_EXHAUSTED` | Your account has no included calls or credits left. Add credits or a plan in your dashboard; calls already running finish. |
| `not_ready` · 503 · `UNAVAILABLE` | The service is starting. Retry on another connection. |
