# Whitelist Number for Test Agent

`POST /rcs/test/agents/{agentId}/whitelist`

Whitelist a phone number for testing with a specific test agent.

During development and testing, RCS agents can only send messages to whitelisted phone numbers.
Use this endpoint to whitelist specific phone numbers so you can send and receive messages from the test agent.

## Verification Process

After whitelisting, the recipient must accept the tester invite:

1. The recipient's device will receive a message from "RBM Tester Management".
2. The recipient must tap "Make me a tester" to accept.
3. Once accepted, the status transitions from `PENDING` to `ACCEPTED`.

## Verification

    **Accepting the invite**

    Accepting the tester invite

    **Declining the invite**

    Declining the tester invite

## Cooldown

There is a **2-minute cooldown** after creating or updating a test agent before you can whitelist numbers.
Attempting to whitelist during the cooldown returns a `500` error with the remaining wait time.

## Authentication

Send your API key in the `PINNACLE-API-KEY` header.

## Parameters

- `agentId` — path, string. The RCS agent ID (must be prefixed with `agent_`).

## Request body

Required.

Content type: `application/json`.

### Fields

- `phoneNumber` — `string`. Phone number to whitelist for testing in E.164 format.

### Example

```json
{
  "phoneNumber": "+12345678901"
}
```

## Responses

### 200

Returns the whitelist status of the phone number.

Content type: `application/json`. Schema: `TestAgentWhitelistResponse`.

- `status` — `RcsWhitelistStatus`, values: `PENDING`, `ACCEPTED`, `REJECTED`. Status of a whitelisted phone number for RCS testing.

- `PENDING` — The tester invite has been sent but the recipient has not yet accepted or rejected it.
- `ACCEPTED` — The recipient accepted the tester invite and can send/receive messages with the test agent.
- `REJECTED` — The recipient rejected the tester invite or the invite could not be delivered.

Example:

```json
{
  "status": "PENDING"
}
```

### 400

Validation failed. The payload has missing required fields and/or invalid types.

See https://zod.dev/error-formatting for more information.

Content type: `application/json`. Schema: `object`.

- `description` — `string`. Human-readable summary of validation failures.
- `errors` — `object`. Structured dictionary of issues containing two main sections:
- `errors`: Array of global validation errors not tied to specific fields
- `properties`: Object mapping field names to their specific validation errors, where each field contains an `errors` array

Example:

```json
{
  "description": "✖ Invalid input: expected string, received number\n  → at example_field",
  "errors": {
    "errors": [
      "Unrecognized key: 'extraKey'"
    ],
    "properties": {
      "example_field": {
        "errors": [
          "Invalid input: expected string, received NaN"
        ]
      }
    }
  }
}
```

### 401

The request lacks valid authentication credentials or the provided credentials are invalid.

Ensure you're including a valid API key in the request headers and that your account has the necessary permissions to access this endpoint.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "Invalid API key."
}
```

### 403

Your subscription does not include access to this feature.

This occurs when attempting to use functionality that requires a higher subscription tier.
Please upgrade your subscription to access this feature.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "Your subscription does not include access to this feature."
}
```

### 404

The requested resource could not be found.

This may occur if the identifier is incorrect, the resource has been deleted, or you don't have permission to access it.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "The requested resource could not be found."
}
```

### 500

An internal error occurred. Common causes:

- **Cooldown period:** The 2-minute cooldown after agent creation/update has not expired.

Content type: `application/json`. Schema: `object`.

- `error` — `string`. Human-readable description of the error that occurred, corresponding to the HTTP status code.

Example:

```json
{
  "error": "Please wait 45 more second(s) before whitelisting numbers (2-minute cooldown after agent changes)."
}
```

## SDK examples

### TypeScript

```typescript
import { PinnacleClient } from "rcs-js";

const client = new PinnacleClient({
  apiKey: process.env.PINNACLE_API_KEY!,
});

await client.rcs.test.whitelistNumber("agent_abc123def456", {
    phoneNumber: "+12345678901"
});
```

### Python

```python
import os
from rcs import Pinnacle

client = Pinnacle(
    api_key=os.environ["PINNACLE_API_KEY"],
)

client.rcs.test.whitelist_number(
    agent_id="agent_abc123def456",
    phone_number="+12345678901",
)
```

### Ruby

```ruby
require "rcs"

client = Pinnacle::Client.new(
  api_key: ENV.fetch("PINNACLE_API_KEY")
)

client.rcs.test.whitelist_number(
  agent_id: "agent_abc123def456",
  phone_number: "+12345678901"
)
```

## Machine-readable schema

[OpenAPI 3.1 JSON](https://docs.pinnacle.sh/openapi.json)
