Preview the next occurrences of a candidate schedule
const url = 'https://api.emite.cr/v1/recurring-invoices/preview-next-runs';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"schedule":{"frequency":"daily","interval":1,"startDate":"2026-06-01","endDate":"2027-06-01","dayOfMonth":15,"endOfMonthRule":"last_day_when_missing","weekday":1,"maxOccurrences":12,"autoSubmit":true},"count":6,"from":"2026-06-01"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.emite.cr/v1/recurring-invoices/preview-next-runs \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "schedule": { "frequency": "daily", "interval": 1, "startDate": "2026-06-01", "endDate": "2027-06-01", "dayOfMonth": 15, "endOfMonthRule": "last_day_when_missing", "weekday": 1, "maxOccurrences": 12, "autoSubmit": true }, "count": 6, "from": "2026-06-01" }'Computes the next N occurrence dates for a schedule config WITHOUT persisting anything. Powers the "next emissions" widget in the create/edit form. Returns { runs: string[] } where each entry is a YYYY-MM-DD date.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The cadence to preview, in the shape of a schedule body. Nothing is saved.
object
How often an invoice is created, every interval units:
daily: counted in days fromstartDate.weekly: onweekday.monthly: ondayOfMonth.yearly: in the month ofstartDate, ondayOfMonth.
Example
monthlyEvery how many frequency units an invoice is created: 2 with monthly means every other month. An integer, 1 or more; 1 when omitted.
Example
1Anchor of the cadence, a calendar date (YYYY-MM-DD) in Costa Rica time: occurrences are counted from it. The first run is the first occurrence on or after both this date and today.
Example
2026-06-01Last date an occurrence may fall on (YYYY-MM-DD, inclusive). The schedule becomes completed once its next occurrence would come after it, and one whose first occurrence already does is created completed.
Example
2027-06-01Day of the month for monthly and yearly schedules; defaults to the day of startDate. For a month without that day see endOfMonthRule. Ignored for daily and weekly.
Example
15How monthly and yearly schedules pick the day:
last_day_when_missing(default):dayOfMonth, or the last day of a month that does not have it (31 becomes 30, or 28/29 in February).last_day_always: always the last day of the month, whateverdayOfMonthsays.
Ignored for daily and weekly.
Example
last_day_when_missingDay of the week for weekly schedules, 0 Sunday to 6 Saturday; defaults to the weekday of startDate. The first occurrence is the first such day on or after startDate. Ignored for the other frequencies.
Example
1Maximum number of occurrences: the schedule becomes completed after that many. An occurrence that failed for good also counts.
Example
12true (default): each invoice is signed and sent to Hacienda as soon as it is created, which needs a caller holding invoices:sign and invoices:submit (403 RECURRING_AUTO_SUBMIT_REQUIRES_SUBMIT_SCOPE). false: each invoice is left as a draft for someone to review and send.
Example
trueHow many dates to return.
Example
6First date to consider (YYYY-MM-DD); defaults to the later of startDate and today in Costa Rica. The preview lists the dates of the cadence only: it does not stop at endDate or maxOccurrences.
Example
2026-06-01Responses
Section titled “Responses”object
The next occurrence dates of the cadence (YYYY-MM-DD), oldest first, as many as count asks.
Example
{ "runs": [ "2026-11-01", "2026-12-01", "2027-01-01" ]}Missing or invalid JWT / API key