Delete a schedule
Delete an existing schedule to stop all future occurrences. This permanently cancels the recurring charges or transfers associated with the schedule. Past occurrences are not affected and remain in your records.
Request Parametersโ
Required - 1 fieldPath Parameters
`id`STRING(required)
The schedule ID to delete. Schedule IDs start with schd_ followed by test_ for test mode.
Responsesโ
200
Schedule deletedReturns the deleted schedule object with status updated to "deleted". All future occurrences are cancelled.
Response includes:
id- Schedule identifier (schd_*)status- Updated to "deleted"deleted- Set to truedeleted_at- Timestamp of deletionoccurrences- List of past occurrences (preserved)
- Deletion is permanent and cannot be undone
- Past charges/transfers are not affected or reversed
- Any pending occurrences scheduled for today may still execute
400
Bad requestRequest validation failed. The schedule may already be deleted or in an invalid state.
Common causes:
- Schedule is already deleted
- Schedule is in a state that cannot be deleted
- Invalid schedule ID format
401
UnauthorizedAuthentication failed. Invalid or missing API key.
Common causes:
- Missing Authorization header
- Invalid secret key
- Using public key instead of secret key
- Incorrect HTTP Basic Auth format
404
Not foundSchedule not found or does not exist.
Common causes:
- Invalid schedule ID
- Schedule ID from different account
- Mixing test and live mode keys
- Schedule was already deleted
5xx
Server errorServer-side error occurred. These are rare but should be handled gracefully.
How to handle:
- Retry the request with exponential backoff
- Check status.omise.co for service incidents
- See Error Handling for detailed guidance
Code samplesโ
- cURL
- Ruby
- Python
- Node.js
- PHP
- Java
- C#
- Go
curl https://api.omise.co/schedules/schd_test_5xuy4w91xqz7d1w9u0t \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-X DELETE
require 'omise'
Omise.api_key = 'skey_test_5xuy4w91xqz7d1w9u0t'
schedule = Omise::Schedule.retrieve('schd_test_5xuy4w91xqz7d1w9u0t')
schedule.destroy
import omise
omise.api_secret = 'skey_test_5xuy4w91xqz7d1w9u0t'
schedule = omise.Schedule.retrieve('schd_test_5xuy4w91xqz7d1w9u0t')
schedule.destroy()
const omise = require('omise')({
secretKey: 'skey_test_5xuy4w91xqz7d1w9u0t'
});
const schedule = await omise.schedules.destroy('schd_test_5xuy4w91xqz7d1w9u0t');
<?php
define('OMISE_SECRET_KEY', 'skey_test_5xuy4w91xqz7d1w9u0t');
$schedule = OmiseSchedule::retrieve('schd_test_5xuy4w91xqz7d1w9u0t');
$schedule->destroy();
Client client = new Client.Builder()
.secretKey("skey_test_5xuy4w91xqz7d1w9u0t")
.build();
Schedule schedule = client.schedules().destroy("schd_test_5xuy4w91xqz7d1w9u0t");
var client = new Client("skey_test_5xuy4w91xqz7d1w9u0t");
var schedule = await client.Schedules.Destroy("schd_test_5xuy4w91xqz7d1w9u0t");
client, _ := omise.NewClient(
"pkey_test_5xuy4w91xqz7d1w9u0t",
"skey_test_5xuy4w91xqz7d1w9u0t",
)
schedule, _ := client.DestroySchedule("schd_test_5xuy4w91xqz7d1w9u0t")
Error and result codesโ
Common Error Codesโ
| Code | Description | Resolution |
|---|---|---|
authentication_failure | Invalid API key | Verify your secret key is correct |
not_found | Schedule not found | Check schedule ID and ensure correct mode (test/live) |
invalid_schedule | Schedule cannot be deleted | Check if schedule is already deleted |
Schedule Status After Deletionโ
| Field | Value |
|---|---|
status | deleted |
deleted | true |
deleted_at | Timestamp of deletion |
API Credentials
Try it outโ
Required - 1 fields
Your IP:
...Loading...