---
title: "Schedule an SMS for a future time (LiveChat, Allison, sequences)"
description: "Every /api/trigger route (send-sms, schedule-message-wait, schedule-message, schedule-recurring,\nschedule-delay, schedule-until, cancel-job, job-status) requires EITHER a verified Supabase session\n(`Authorization: Bearer <access_token>`) of a current member of `workspaceId` (body; query on\nGET), OR `X-Internal-Service-Key` equal to the backend's INTERNAL_SERVICE_KEY (backend-to-backend;\nrefused when unset). API keys are refused. cancel-job / job-status also answer 403 for a job of\nanother workspace.\n"
---

> 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 › Trigger

`POST /api/trigger/schedule-until`

Every /api/trigger route (send-sms, schedule-message-wait, schedule-message, schedule-recurring,
schedule-delay, schedule-until, cancel-job, job-status) requires EITHER a verified Supabase session
(`Authorization: Bearer <access_token>`) of a current member of `workspaceId` (body; query on
GET), OR `X-Internal-Service-Key` equal to the backend's INTERNAL_SERVICE_KEY (backend-to-backend;
refused when unset). API keys are refused. cancel-job / job-status also answer 403 for a job of
another workspace.

## Authentication

- `BearerAuth`, http, header `Authorization`, format `JWT`

## Request body

_Required._

- `to` (`post/api/trigger/schedule-until.to`; string, required)
- `body` (`post/api/trigger/schedule-until.body`; string, required)
- `workspaceId` (`post/api/trigger/schedule-until.workspaceId`; string, required)
- `scheduledTime` (`post/api/trigger/schedule-until.scheduledTime`; string, required)
  - format `date-time`
- `contactId` (`post/api/trigger/schedule-until.contactId`; string, optional)
- `mediaUrl` (`post/api/trigger/schedule-until.mediaUrl`; string, optional)

## Example request

```json
{
  "to": "string",
  "body": "string",
  "workspaceId": "string",
  "scheduledTime": "2019-08-24T14:15:22Z",
  "contactId": "string",
  "mediaUrl": "string"
}
```

## Code samples

### cURL

```bash
curl --request POST \
  --url https://api.channelautomation.com/api/trigger/schedule-until \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "to": "string",
  "body": "string",
  "workspaceId": "string",
  "scheduledTime": "2019-08-24T14:15:22Z",
  "contactId": "string",
  "mediaUrl": "string"
}
'
```

### TypeScript

```typescript
const url = 'https://api.channelautomation.com/api/trigger/schedule-until';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json', Authorization: 'Bearer <token>'},
  body: JSON.stringify({
    to: 'string',
    body: 'string',
    workspaceId: 'string',
    scheduledTime: '2019-08-24T14:15:22Z',
    contactId: 'string',
    mediaUrl: '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/trigger/schedule-until"

payload = {
    "to": "string",
    "body": "string",
    "workspaceId": "string",
    "scheduledTime": "2019-08-24T14:15:22Z",
    "contactId": "string",
    "mediaUrl": "string"
}
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <token>"
}

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

print(response.text)
```

## Responses

### 200

Scheduled

### 400

Missing fields

### 401

No verified session / invalid internal key

### 403

Not a member of workspaceId


Source: https://developer.channelautomations.com/api/post-api-trigger-schedule-until/index.md
