# Test texts in the sandbox

Try your texts in the sandbox before your number is approved. Each text is recorded with the outcome a live one would have had, and none is sent.

Use the sandbox to build and check your texts before your own number is approved. The sandbox is a `prv_test_` key, separate data, and `"environment": "sandbox"` on every event. There, a text your request would send is recorded instead, with its body and the outcome a live text would have had. It never reaches a carrier, and it isn't counted on your plan.

**Before you begin:** you need a sandbox key. The published keys on [Sandbox and test keys](https://provenanceauth.com/docs/get-started/sandbox.md) work as written; sign in to the sandbox console for a key of your own.

## 1. Send a request to a test number

Create a request as you would on live. The recipient's number decides what happens:

| Send to | Outcome | What you get back |
| --- | --- | --- |
| `+12025550101` | Delivered | `{ "channel": "text", "delivered": true, "sender": "custom", "test": true }` |
| `+12025550102` | Failed at the provider | `"reason": "send_failed"` with `"test": true`, then the email if the request has one |
| `+12025550103` | The person replied STOP | A stop for your company; this text and later ones read `"reason": "opted_out"`, and the request goes by email |
| `+12025550104` | No consent on record | `"reason": "no_text_consent"`, and the request goes by email, until you record a statement for it or the person agrees in the step ([consent to text](https://provenanceauth.com/docs/messaging/text-consent.md#10-when-a-text-goes)) |
| Any other number | Delivered | As the first row: in the sandbox every other number counts as agreed |

**curl**

```bash
export PROVENANCE_KEY=prv_test_capture_C4pT9vQ2bW7mK3sYd8cFjLh6gAe1nR5x
curl -X POST $PROVENANCE_API/v1/attest/capture_requests \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "case_id": "CLM-TEST-1", "session_type": "id", "contact": { "phone": "+12025550101" } }'
```

**Node**

```ts
const request = await prov.attest.captureRequests.create({
  caseId: "CLM-TEST-1",
  sessionType: "id",
  contact: { phone: "+12025550101" },
});
console.log(request.delivery);
```

**Python**

```python
request = prov.attest.capture_requests.create(
    case_id="CLM-TEST-1",
    session_type="id",
    contact={"phone": "+12025550101"},
)
print(request["delivery"])
```

The published capture account carries an approved test number, so the text goes from it. Every delivery, reminder delivery and webhook delivery object carries `"test": true` in the sandbox, and never on live, so your live code can refuse anything that has it.

## 2. Read the text back

[`GET /v1/account/test_texts`](https://provenanceauth.com/docs/api/account.md#get-v1-account-test-texts) lists your recorded texts, newest first. Add `request_id` for one request's texts, or read one with [`GET /v1/account/test_texts/{id}`](https://provenanceauth.com/docs/api/account.md#get-v1-account-test-texts-id).

**curl**

```bash norun
curl "$PROVENANCE_API/v1/account/test_texts?request_id=$REQUEST_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const texts = await prov.account.testTexts({ requestId: request.id });
console.log(texts.data[0]?.body);
```

**Python**

```python
texts = prov.account.test_texts(request_id=request["id"])
print(texts["data"][0]["body"])
```

```json
{
  "id": "ttxt_408ce607aa663201b8c5",
  "object": "test_text",
  "test": true,
  "kind": "company",
  "purpose": "capture_link",
  "reminder": false,
  "to": "•••• 0101",
  "from": "+18335550142",
  "sender": "custom",
  "body": "Sandbox needs a photo of your ID and a selfie from your phone camera: https://…/capture/… Reply STOP to opt out.",
  "segments": 2,
  "outcome": "delivered",
  "request": { "object": "capture_request", "id": "capr_01M7FJ5FFMKE72Q2T4ZDK925V7" },
  "created_at": "2026-11-15T12:15:58.453Z"
}
```

`body` is the text as it would have been sent, link included; the link opens the sandbox request. The first text a test number gets from your number ends with "Reply STOP to opt out.", as on live; later ones don't. In the sandbox console, open the request and its text row in **Delivery** shows who it is from and the body.

The `sending_number.*` webhooks fire in the sandbox as on live, with `"test": true` on the object ([the webhooks](https://provenanceauth.com/docs/messaging/sending-numbers.md#9-get-the-webhooks)).

Recorded texts are kept for 30 days. Anyone with a published key can read the texts sent under it. To keep yours to yourself, sign in to the sandbox console and use your own test key.

## 3. Run a STOP test again

[`DELETE /v1/account/test_texts/stops`](https://provenanceauth.com/docs/api/account.md#delete-v1-account-test-texts-stops) stands in for the person's START: it lifts the stops `+12025550103` wrote for your account, so the test can run twice. No other company's stop is touched.

## 4. Act out the carrier review

In the sandbox your number is requested when you save your business details, on every plan, and nothing is bought. The tax id you give decides the review in seconds:

| Tax id | Outcome | In the console |
| --- | --- | --- |
| Any other value | Approved | **Sending** |
| `00-0000002` | Rejected, can be edited | **Needs a fix**; a resubmission edits the registration |
| `00-0000003` | Rejected, can't be edited | **Needs a fix**; a resubmission makes a new registration for the same number |
| `00-0000004` | Stays in review | **In review** |
| `00-0000005` | Approved, then paused on the first send | **Paused** |

The steps are the ones in [your own sending number](https://provenanceauth.com/docs/messaging/sending-numbers.md). The sandbox console's **Settings → Texts** lists these numbers and tax ids beside your test number.

## Limits of test texts

Carrier approval of your business and delivery of your texts happen only on live. Codes and notices Provenance sends you are never recorded: a phone code reads `channel_not_configured`, and the sandbox returns it as `dev_code`. Emails and app notifications in the sandbox go only where the sandbox has them set up, and are not recorded.

## Errors you might see

| Symptom | Cause | Fix |
| --- | --- | --- |
| `403` [`sandbox_only`](https://provenanceauth.com/docs/platform/errors.md#sandbox_only) | A live key | Use a `prv_test_` key. |
| `404` [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing) | A text recorded for another account, or more than 30 days ago | List your texts first. |

## See also

- [Test webhooks](https://provenanceauth.com/docs/integrate/test-webhooks.md), the step before this one
- [Go live](https://provenanceauth.com/docs/get-started/go-live.md), when your texts work in the sandbox
- [Your own sending number](https://provenanceauth.com/docs/messaging/sending-numbers.md)
- [Sandbox and test keys](https://provenanceauth.com/docs/get-started/sandbox.md)
- [Capture requests](https://provenanceauth.com/docs/attest/guides/capture-requests.md)
- [Reminders](https://provenanceauth.com/docs/messaging/reminders.md)
