---
title: "Trigger a Twilio credit alert for a workspace"
description: "Internal endpoint used by background SMS senders when Twilio rejects an outbound message for an account credit or suspension issue."
---

> Documentation Index
> Fetch the complete documentation index at: https://developer.channelautomations.com/llms.txt
> Use this file to discover all available pages before exploring further.

Path: Channel Automation API › Twilio

`POST /api/twilio/credit-alert`

Internal endpoint used by background SMS senders when Twilio rejects an outbound message for an account credit or suspension issue.

## Header parameters

- `X-Workspace-Id` (`post/api/twilio/credit-alert.header.X-Workspace-Id`; string, required) — Workspace ID for data isolation

## Request body

_Required._

- `workspaceId` (`post/api/twilio/credit-alert.workspaceId`; string, optional)
- `contactId` (`post/api/twilio/credit-alert.contactId`; string, optional)
- `errorCode` (`post/api/twilio/credit-alert.errorCode`; string, optional)
- `errorMessage` (`post/api/twilio/credit-alert.errorMessage`; string, optional)
- `recipient` (`post/api/twilio/credit-alert.recipient`; string, optional)
- `sender` (`post/api/twilio/credit-alert.sender`; string, optional)
- `twilioSid` (`post/api/twilio/credit-alert.twilioSid`; string, optional)
- `source` (`post/api/twilio/credit-alert.source`; string, optional)

## Example request

```json
{
  "workspaceId": "string",
  "contactId": "string",
  "errorCode": "string",
  "errorMessage": "string",
  "recipient": "string",
  "sender": "string",
  "twilioSid": "string",
  "source": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.channelautomation.com/api/twilio/credit-alert \
  --header 'Content-Type: application/json' \
  --header 'X-Workspace-Id: 15213' \
  --data '
{
  "workspaceId": "string",
  "contactId": "string",
  "errorCode": "string",
  "errorMessage": "string",
  "recipient": "string",
  "sender": "string",
  "twilioSid": "string",
  "source": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/twilio/credit-alert';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', 'X-Workspace-Id': '15213'},
  body: JSON.stringify({
    workspaceId: 'string',
    contactId: 'string',
    errorCode: 'string',
    errorMessage: 'string',
    recipient: 'string',
    sender: 'string',
    twilioSid: 'string',
    source: 'string'
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "https://api.channelautomation.com/api/twilio/credit-alert"

payload = {
    "workspaceId": "string",
    "contactId": "string",
    "errorCode": "string",
    "errorMessage": "string",
    "recipient": "string",
    "sender": "string",
    "twilioSid": "string",
    "source": "string"
}
headers = {
    "Content-Type": "application/json",
    "X-Workspace-Id": "15213"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

## Responses

### 200

Alert evaluated.

### 400

Workspace ID is required.

### 500

Internal server error

#### Example

```json
{
  "error": "Internal server error",
  "details": "string",
  "success": false
}
```

- `error` (`post/api/twilio/credit-alert.response.500.error`; string, optional)
  - example `"Internal server error"`
- `details` (`post/api/twilio/credit-alert.response.500.details`; string, optional)
- `success` (`post/api/twilio/credit-alert.response.500.success`; boolean, optional)
  - example `false`


Source: https://developer.channelautomations.com/api/post-api-twilio-credit-alert/index.md
