Add a tester to an agent
POST
/agents/{agent_id}/testers
x-api-key
Registers a tester phone number for an agent. The phone is normalized to E.164; one row per (agent_id, phone_number), capped at 10 testers per agent. A repeat add for the same number is idempotent. Google-first: the Google Business Communications tester invite is created BEFORE the local row — the tester is persisted only after Google has persisted the invite, and any Google failure is an explicit error with nothing stored locally. Secured by an x-api-key.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
x-api-key |
header | string | yes | The relay API key (x-api-key header). |
agent_id |
path | string | yes | The rcs-relay agent identifier (ULID). |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
phone_number |
string | yes | Tester phone number. Spaces, dashes and an optional leading plus sign are accepted, then normalized to E.164. |
Responses
| Status | Description |
|---|---|
200 |
The stored tester row — Google already accepted the invite (`google_sync: "ok"`; a 200 can never mean "local only"). |
401 |
Missing or invalid API key. |
404 |
Agent not found. |
422 |
Malformed phone number, the 10-tester cap has been reached for this agent, the agent row has no google_agent_id yet ("agent not persisted to Google"), or Google rejected the invite with a 4xx (decoded message in `errors`, e.g. its transient "updated within the last 30 seconds" precondition — retry the idempotent POST after the window). |
502 |
Google Business Communications transport error (invite not persisted, nothing stored locally). |
200 example
{
"agent_id": "01H...",
"phone_number": "+33612345678",
"added_at": "2025-01-01T00:00:00Z",
"google_sync": "ok"
}