# Start voice test

Start a test call for a team inbox. Returns a test ID and an audio connection URL when available; text turns use voice.RunVoiceTestTurn.

POST https://api.brigg.app/v1/operations/voice.StartVoiceTest

## Access & visibility

Allow `voice.StartVoiceTest` on your API key.

**Workspace access by default.** Private member data requires [approved member delegation](https://developer.brigg.app/authentication#member-delegation) through `Brigg-Act-As`; the key supplies permissions while private ownership and project boundaries remain enforced.

[Set up authentication](https://developer.brigg.app/authentication) · [Choose permissions](https://developer.brigg.app/permissions)

## Request fields

Send a JSON object with the following fields. Required fields must be included; omit optional fields you do not need.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `inbox_id` | string | No | Inbox record ID from [List inboxes](https://developer.brigg.app/reference/support/ListInboxes). Supply this when testing an inbox; use assistant: true instead for the acting member's own assistant. At least 1 character. |
| `caller_id` | string or null | Yes | Person record ID to simulate a known caller, or null to test an unknown caller. Find a known caller with [List people](https://developer.brigg.app/reference/customers/ListPeople). |
| `selections` | array of [object](#request-selections) | No | Capabilities to test with, overriding the bound set. |

### request.selections[]

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `offering_key` | string | Yes | Stable key identifying a published voice capability. At least 1 character. |
| `revision` | string | Yes | Revision identifying the version of this capability or configuration. At least 1 character. |
| `settings` | [object](#request-selections-settings) | Yes | Configuration fields defined by this voice capability. |

### request.selections[].settings

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `booking_link_id` | string | No | Booking link identifier. |

## Run a conversation test

Start a test for the intended inbox and retain its `test_id`. Text clients can use [Run voice test turn](https://developer.brigg.app/reference/voice/RunVoiceTestTurn); an audio connection URL is only needed for an audio client. Keep temporary connection URLs secret.

Pass the simulated caller's utterance and previous conversation history in order. Keep a stable `turn_id` for a retried turn. Review the returned reply and capability trace; a simulated response is not evidence that a real customer call succeeded. [Review voice test](https://developer.brigg.app/reference/voice/ReviewVoiceTest) accepts the conversation transcript for feedback. End the session when finished; an expired session needs a new start.

## Response

Returns **200 OK** with a JSON body.
| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `test_id` | string | Yes | Names this test to voice.RunVoiceTestTurn, voice.ReviewVoiceTest and voice.EndVoiceTest. |
| `expires` | number | Yes | Epoch ms after which the test is no longer accepted. |
| `socket_url` | string or null | Yes | The audio socket URL, or null on a stage without an audio service. |

## Errors & retries

Set `BRIGG_REQUEST_ID` once for each logical action. The samples send it as `Idempotency-Key`. Reuse the same value and body on retries, including after a timeout; a missing response does not prove the action failed.

For rate limits, follow the server’s retry guidance and back off. See [HTTP errors](https://developer.brigg.app/http#errors) and [safe retries and limits](https://developer.brigg.app/reliability).

| HTTP status | Code | What to do |
| --- | --- | --- |
| 400 | `invalid_json` | Send a JSON object with Content-Type: application/json. |
| 400 | `invalid_input` | Check the request fields and types. Supply a stable Idempotency-Key containing 1–200 characters. |
| 401 | `invalid_key` | The workspace API key is missing, invalid or revoked. |
| 403 | `forbidden` | Check the key’s operation and resource grants. If Brigg-Act-As is supplied, the key must be authorized to delegate to that member. |
| 404 | `not_found` | The requested operation or resource is not available to this credential. |
| 429 | `rate_limited` | Wait for Retry-After before retrying. Reuse the original Idempotency-Key. |

## Next steps

- [Run voice test turn](https://developer.brigg.app/reference/voice/RunVoiceTestTurn)
- [Review voice test](https://developer.brigg.app/reference/voice/ReviewVoiceTest)
- [End voice test](https://developer.brigg.app/reference/voice/EndVoiceTest)
- [List inboxes](https://developer.brigg.app/reference/support/ListInboxes)

[Download OpenAPI](https://developer.brigg.app/openapi.json) · [Versioning & retirement](https://developer.brigg.app/versioning)

## Examples

### Test an unknown caller

Choose a real inbox ID. A null socket_url still supports text turns.
#### cURL


```sh
curl 'https://api.brigg.app/v1/operations/voice.StartVoiceTest' \
  -H "Authorization: Bearer $BRIGG_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "Idempotency-Key: $BRIGG_REQUEST_ID" \
  --data-raw '{
  "inbox_id": "e_inbox_support",
  "caller_id": null
}'
```

#### TypeScript


```typescript
const requestId = process.env.BRIGG_REQUEST_ID;
if (!requestId) throw new Error("Set BRIGG_REQUEST_ID once per action and reuse it on retries.");

const response = await fetch("https://api.brigg.app/v1/operations/voice.StartVoiceTest", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BRIGG_API_KEY}`,
    "Content-Type": "application/json",
    "Idempotency-Key": requestId, // Create once per action; reuse on retries.
  },
  body: JSON.stringify({
    "inbox_id": "e_inbox_support",
    "caller_id": null
  }),
});
const result = await response.json();
if (!response.ok) throw new Error(`${response.status}: ${result.error} — ${result.message}`);
console.log(result);
```

#### Python


```python
import json
import os
from urllib.request import Request, urlopen
from urllib.error import HTTPError

request_id = os.environ["BRIGG_REQUEST_ID"]  # Reuse for retries of this action.
payload = {
  "inbox_id": "e_inbox_support",
  "caller_id": None
}
request = Request(
    "https://api.brigg.app/v1/operations/voice.StartVoiceTest",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['BRIGG_API_KEY']}",
        "Content-Type": "application/json",
        "Idempotency-Key": request_id,  # Create once per action; reuse on retries.
    },
    method="POST",
)
try:
    with urlopen(request) as response:
        print(json.load(response))
except HTTPError as error:
    print(error.code, json.load(error))
    raise
```

#### Response example


```json
{
  "test_id": "voice_test_kickoff",
  "expires": 1794301800000,
  "socket_url": null
}
```

## JSON schemas


```json-schema-request
{
  "type": "object",
  "properties": {
    "inbox_id": {
      "type": "string",
      "minLength": 1,
      "description": "Inbox record ID from [List inboxes](https://developer.brigg.app/reference/support/ListInboxes). Supply this when testing an inbox; use assistant: true instead for the acting member's own assistant."
    },
    "caller_id": {
      "anyOf": [
        {
          "type": "string",
          "minLength": 1,
          "description": "Person record ID to simulate a known caller, or null to test an unknown caller. Find a known caller with [List people](https://developer.brigg.app/reference/customers/ListPeople)."
        },
        {
          "type": "null",
          "description": "Person record ID to simulate a known caller, or null to test an unknown caller. Find a known caller with [List people](https://developer.brigg.app/reference/customers/ListPeople)."
        }
      ],
      "description": "Person record ID to simulate a known caller, or null to test an unknown caller. Find a known caller with [List people](https://developer.brigg.app/reference/customers/ListPeople)."
    },
    "selections": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "offering_key": {
            "type": "string",
            "minLength": 1,
            "description": "Stable key identifying a published voice capability."
          },
          "revision": {
            "type": "string",
            "minLength": 1,
            "description": "Revision identifying the version of this capability or configuration."
          },
          "settings": {
            "type": "object",
            "properties": {
              "booking_link_id": {
                "type": "string",
                "description": "Booking link identifier."
              }
            },
            "additionalProperties": false,
            "description": "Configuration fields defined by this voice capability."
          }
        },
        "required": [
          "offering_key",
          "revision",
          "settings"
        ],
        "additionalProperties": false
      },
      "description": "Capabilities to test with, overriding the bound set."
    }
  },
  "required": [
    "caller_id"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "inbox_id": "e_inbox_support",
      "caller_id": null
    }
  ]
}
```


```json-schema-response
{
  "type": "object",
  "properties": {
    "test_id": {
      "type": "string",
      "description": "Names this test to voice.RunVoiceTestTurn, voice.ReviewVoiceTest and voice.EndVoiceTest."
    },
    "expires": {
      "type": "number",
      "description": "Epoch ms after which the test is no longer accepted."
    },
    "socket_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "The audio socket URL, or null on a stage without an audio service."
    }
  },
  "required": [
    "test_id",
    "expires",
    "socket_url"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "test_id": "voice_test_kickoff",
      "expires": 1794301800000,
      "socket_url": null
    }
  ]
}
```

