Add an obligation of your own
const url = 'https://api.emite.cr/v1/fiscal/custom-obligations';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"Planilla CCSS","periodicity":"mensual","dueDay":1,"dueDayKind":"calendar","monthOffset":1,"anchorMonth":1,"notes":"example"}'};
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/fiscal/custom-obligations \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Planilla CCSS", "periodicity": "mensual", "dueDay": 1, "dueDayKind": "calendar", "monthOffset": 1, "anchorMonth": 1, "notes": "example" }'dueDayKind: business counts BUSINESS days — CCSS is due on the 4th business day of the following month, which is not the 4th of the month. A non-monthly obligation must carry anchorMonth (400 CUSTOM_OBLIGATION_ANCHOR_REQUIRED), or the first period of the year would be a guess. Requires fiscal:write.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Name the obligation is shown with in the calendar (stored trimmed).
Example
Planilla CCSSHow often it falls due: mensual (monthly), trimestral (every three months), cuatrimestral (every four), semestral (every six) or anual (yearly). Any but mensual needs anchorMonth (400 CUSTOM_OBLIGATION_ANCHOR_REQUIRED).
The day it falls due. With dueDayKind: calendar, a day of the month: the last day when the month is shorter, moved to the next business day when it falls on a weekend or holiday. With business, the Nth business day of the month: the last business day when the month has fewer.
How dueDay counts: calendar days, or Costa Rica business days — the CCSS falls due on the 4th business day of the following month, which is not the 4th. Must be sent: the API applies no default.
How many months after the end of the period the due date falls, from 0 to 12: 0 is the same month, 1 (the default) the following one.
For a non-monthly obligation, a month in which one of its periods ends: it sets the phase of the cycle (a quarterly one anchored at 2 has periods ending in February, May, August and November) and, for an annual one, the month its year ends. Required unless periodicity is mensual, for which it is ignored.
Free-text notes; omitting them on an update clears the stored ones.
Responses
Section titled “Responses”object
Id of the obligation: the customObligationId of its occurrences.
Name the obligation is shown with.
How often it falls due (see the request body).
The day it falls due, counted as dueDayKind says.
Whether dueDay counts calendar or business days.
Months after the end of the period the due date falls.
The month that sets the cycle of a non-monthly obligation; null when none was given.
Free-text notes, or null.
Example
{ "periodicity": "mensual", "dueDayKind": "calendar"}