Skip to main content
PATCH
/
batch
/
jobs
/
{batch_job_id}
/
reschedule
Reschedule Batch Job
curl --request PATCH \
  --url https://api.talkifai.dev/batch/jobs/{batch_job_id}/reschedule \
  --header 'Authorization: Bearer <token>'
{
  "success": true,
  "message": "Rescheduled successfully",
  "batchJobId": "<string>",
  "scheduledStartTime": "2023-11-07T05:31:56Z",
  "status": "scheduled",
  "oldJobCancelled": true,
  "newScheduledJobId": "<string>"
}

Overview

Changes the scheduled start time of a batch job. Only works for jobs in scheduled or pending status. Features:
  • Timezone-aware scheduling
  • Automatic cancellation of old scheduled job
  • Creates new Redis defer job with updated time
Cannot reschedule jobs that are already running, completed, failed, or cancelled.

Request

PATCH /batch/jobs/{batch_job_id}/reschedule?scheduledStartTime=2025-03-01T10:00:00&timezone=America/New_York

Path Parameters

ParameterTypeRequiredDescription
batch_job_idstringUnique batch job identifier

Query Parameters

ParameterTypeRequiredDefaultDescription
scheduledStartTimestringNew scheduled start time (ISO 8601 format)
timezonestring"UTC"IANA timezone for the scheduled time

Timezone Examples

TimezoneDescription
UTCCoordinated Universal Time
America/New_YorkEastern Time (US/Canada)
America/Los_AngelesPacific Time (US/Canada)
Europe/LondonGMT/BST (UK)
Europe/ParisCentral European Time
Asia/KarachiPakistan Standard Time
Asia/DubaiGulf Standard Time
Asia/TokyoJapan Standard Time
Australia/SydneyAustralian Eastern Time

Response

{
  "success": true,
  "message": "Rescheduled successfully (old job cancelled)",
  "batchJobId": "batch_xyz789",
  "scheduledStartTime": "2025-03-01T15:00:00Z",
  "status": "scheduled",
  "oldJobCancelled": true,
  "newScheduledJobId": "arq_job_abc123"
}

Response Fields

FieldTypeDescription
successbooleanWhether reschedule succeeded
messagestringReschedule result description
batchJobIdstringRescheduled batch job ID
scheduledStartTimestringNew scheduled start time (ISO 8601, UTC)
statusstringJob status (scheduled)
oldJobCancelledbooleanWhether old Redis job was cancelled
newScheduledJobIdstringNew Redis defer job ID

Examples

Example 1: Reschedule to Later Time

curl -X PATCH "https://api.talkifai.com/batch/jobs/batch_xyz789/reschedule?scheduledStartTime=2025-03-01T10:00:00&timezone=America/New_York" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response:
{
  "success": true,
  "message": "Rescheduled successfully (old job cancelled)",
  "batchJobId": "batch_xyz789",
  "scheduledStartTime": "2025-03-01T15:00:00Z",
  "status": "scheduled",
  "oldJobCancelled": true,
  "newScheduledJobId": "arq_job_abc123"
}

Example 2: Reschedule with UTC Timezone

curl -X PATCH "https://api.talkifai.com/batch/jobs/batch_xyz789/reschedule?scheduledStartTime=2025-03-01T09:00:00&timezone=UTC" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example 3: Reschedule Pending Job (No Previous Schedule)

curl -X PATCH "https://api.talkifai.com/batch/jobs/batch_pending/reschedule?scheduledStartTime=2025-03-01T09:00:00&timezone=Europe/London" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response:
{
  "success": true,
  "message": "Scheduled successfully",
  "batchJobId": "batch_pending",
  "scheduledStartTime": "2025-03-01T09:00:00Z",
  "status": "scheduled",
  "oldJobCancelled": false,
  "newScheduledJobId": "arq_job_def456"
}

Example 4: Reschedule Running Job (Error)

curl -X PATCH "https://api.talkifai.com/batch/jobs/batch_running/reschedule?scheduledStartTime=2025-03-01T09:00:00&timezone=UTC" \
  -H "Authorization: Bearer YOUR_API_KEY"
Response:
{
  "detail": "Cannot reschedule job in 'running' status. Only 'scheduled' or 'pending' jobs can be rescheduled."
}

Behavior by Status

Job StatusReschedule Behavior
scheduledCancels old Redis job + creates new defer job + updates DB
pendingCreates new Redis defer job + updates DB + changes status to scheduled
running❌ Error: Cannot reschedule running job
completed❌ Error: Cannot reschedule completed job
failed❌ Error: Cannot reschedule failed job
cancelled❌ Error: Cannot reschedule cancelled job

How It Works

PATCH /batch/jobs/{id}/reschedule


1. Parse scheduled time + timezone
         ├── Invalid format → 400 Error
         └── Valid → Convert to UTC


2. Check job status
         ├── Not scheduled/pending → 400 Error
         └── Scheduled/Pending → Continue


3. If has scheduledJobId: Cancel old Redis job
         ├── Found → Cancel + clear
         └── Not found → Proceed


4. Create new Redis defer job


5. Update database with new time + job ID


6. Return success

Error Handling

404 Not Found

{
  "detail": "Batch job not found"
}

400 Bad Request

{
  "detail": "Invalid timezone 'Invalid/Timezone'. Use IANA timezone format (e.g., 'America/New_York', 'Asia/Karachi', 'UTC')."
}
{
  "detail": "Invalid datetime format. Use format like '2025-03-01T10:00:00'."
}
{
  "detail": "Cannot reschedule job in 'running' status. Only 'scheduled' or 'pending' jobs can be rescheduled."
}
Error CodeCause
job_not_foundBatch job ID doesn’t exist
invalid_timezoneInvalid IANA timezone
invalid_datetimeInvalid datetime format
past_scheduled_timeScheduled time is in the past
invalid_statusJob is not in scheduled or pending status

500 Internal Server Error

{
  "detail": "Failed to reschedule batch job"
}

Use Cases

Reschedule Due to Weather Event

Your campaign is scheduled for today, but a storm is affecting your target region:
# Reschedule from today to tomorrow same time
curl -X PATCH "https://api.talkifai.com/batch/jobs/batch_xyz789/reschedule?scheduledStartTime=2025-03-02T09:00:00&timezone=America/New_York" \
  -H "Authorization: Bearer YOUR_API_KEY"

Adjust Calling Hours for Compliance

You realize your scheduled time violates calling hours regulations:
# Reschedule from 7 AM to 9 AM (legal calling hours start)
curl -X PATCH "https://api.talkifai.com/batch/jobs/batch_xyz789/reschedule?scheduledStartTime=2025-03-01T09:00:00&timezone=America/Chicago" \
  -H "Authorization: Bearer YOUR_API_KEY"

Postpone Campaign to Next Week

# Move campaign from Friday to next Monday
curl -X PATCH "https://api.talkifai.com/batch/jobs/batch_xyz789/reschedule?scheduledStartTime=2025-03-10T10:00:00&timezone=America/Los_Angeles" \
  -H "Authorization: Bearer YOUR_API_KEY"

Authorizations

Authorization
string
header
required

Your TalkifAI API key. Get it from Studio → Settings → API Keys.

Path Parameters

batch_job_id
string
required

Query Parameters

scheduledStartTime
string<date-time>
required

New scheduled start time (ISO 8601)

timezone
string
default:UTC

IANA timezone for the scheduled time

Response

Batch job rescheduled

success
boolean
Example:

true

message
string
Example:

"Rescheduled successfully"

batchJobId
string
scheduledStartTime
string<date-time>
status
string
Example:

"scheduled"

oldJobCancelled
boolean
newScheduledJobId
string