Skip to main content
Version: 2019-05-29 (Current)

Bulk create charge schedules

Upload a CSV file to create multiple charge schedules in a single operation. This endpoint initiates an asynchronous bulk creation job and returns a recurring_id that you can use to monitor progress and download status reports.

Request Parametersโ€‹

Required - 1 fieldRequired Parameters
โ–ผ
`file`FILE(required)
CSV file containing charge schedule data. Each row represents one schedule to create.
Example:"schedules.csv"
Constraints:Maximum file size: 10MB, Format: CSV, Maximum rows: 10,000
CSV StructureCSV Columns
โ–ผ
`customer_key`STRING(required)
Unique identifier for tracking this row in status reports. Can be any string meaningful to your system.
Example:"sub_001"
`customer`STRING(required)
Customer ID (cust_*) who will be charged. Customer must have at least one card attached.
Example:"cust_test_5xuy4w91xqz7d1w9u0t"
`card`STRING(optional)
Specific card ID to charge. If not specified, the customer's default card will be used.
Example:"card_test_5xuy4w91xqz7d1w9u0t"
`amount`INTEGER(required)
Charge amount in smallest currency unit (e.g., satang for THB, cents for USD).
Example:100000
`description`STRING(optional)
Description that will appear on each charge created by this schedule.
Example:"Monthly subscription fee"
`every`INTEGER(required)
Frequency multiplier. For example, every=2 with period=month means every 2 months.
Example:1
`period`STRING(required)
Time unit for the schedule frequency.
Example:"month"
Values:day, week, month
`days_of_month`STRING(optional)
For monthly schedules: specific days to charge (1-28). Use semicolon to specify multiple days.
Example:"1;15"
`start_date`STRING(optional)
Schedule start date in YYYY-MM-DD format. Defaults to today if not specified.
Example:"2025-02-01"
`end_date`STRING(optional)
Schedule end date in YYYY-MM-DD format. Schedule will expire after this date.
Example:"2025-12-31"

Responsesโ€‹

200

Upload accepted

CSV file accepted and bulk creation job has been queued. Use the returned recurring_id to monitor progress.

Response includes:
  • object - Always "recurring_export"
  • id - Recurring export ID (recr_*) for tracking the job
  • livemode - Whether this is a live mode operation
  • location - API path to monitor the job
  • state - Initial state (typically "pending")
  • total_rows - Number of rows detected in CSV
  • processed_rows - Number of rows processed (0 initially)
  • successful_rows - Number of successful creations (0 initially)
  • failed_rows - Number of failed creations (0 initially)
  • created_at - Job creation timestamp

400

Bad request

Request validation failed. Check the error message for details.

Common causes:
  • File missing or empty
  • Invalid CSV format or structure
  • Missing required columns in CSV header
  • File exceeds 10MB size limit
  • CSV contains more than 10,000 rows

401

Unauthorized

Authentication 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 found

Endpoint not found or feature not enabled.

Common causes:
  • Bulk operations feature not enabled for account
  • Incorrect API endpoint URL

5xx

Server error

Server-side error occurred. These are rare but should be handled gracefully.

How to handle:

Code samplesโ€‹

# Upload CSV file to create multiple charge schedules
curl https://api.omise.co/schedules/upload \
-X POST \
-u skey_test_5xuy4w91xqz7d1w9u0t: \
-F "file=@/path/to/schedules.csv"

Example CSV Fileโ€‹

customer_key,customer,card,amount,description,every,period,days_of_month,start_date,end_date
sub_001,cust_test_5xuy4w91xqz7d1w9u0t,,100000,Monthly premium plan,1,month,1,2025-02-01,2026-01-31
sub_002,cust_test_5xuy4w91xqz7d1w9u0t,card_test_5xuy4w91xqz7d1w9u0t,50000,Basic subscription,1,month,15,2025-02-01,
sub_003,cust_test_5xuy4w91xqz7d1w9u0t,,200000,Enterprise plan,1,month,1;15,2025-02-01,2025-12-31

Error and result codesโ€‹

Common Error Codesโ€‹

CodeDescriptionResolution
authentication_failureInvalid API keyVerify your secret key is correct
invalid_fileFile is missing or invalidEnsure file is a valid CSV
file_too_largeFile exceeds 10MB limitSplit into smaller files
invalid_csv_structureMissing required columnsCheck CSV header row
too_many_rowsCSV exceeds 10,000 rowsSplit into multiple files

CSV Row Error Codesโ€‹

CodeDescriptionResolution
invalid_customerCustomer ID not foundVerify customer exists
no_card_attachedCustomer has no cardAttach a card to customer first
invalid_cardCard ID not found or expiredUse valid card ID
invalid_amountAmount is invalidUse positive integer
invalid_periodPeriod value invalidUse day, week, or month
invalid_date_formatDate format invalidUse YYYY-MM-DD format

๐Ÿ”‘API Credentials

Try it outโ€‹

Required - 1 fields
โ–ผ
Your IP: ...Loading...