Calendar subscriptions API reference
Create a revocable ICS feed for economic releases, public holidays, or both.
Create a subscription
Use your Narwhal bearer key for the create request. Product overview →
curl --request POST \
--url "https://api.narwhalapi.com/v1/calendars/subscriptions" \
--header "Authorization: Bearer $NARWHAL_API_KEY" \
--header "Content-Type: application/json" \
--data '{"countries":["USA"],"start_date":"2026-09-01","end_date":"2026-12-31","include_releases":true,"include_holidays":true}'Create and revoke each cost one call. A refused create costs nothing.
Request fields
| Field | Rule |
|---|---|
countries | Required list of 1–50 ISO alpha-3 country codes. |
start_ | Required inclusive date window, between 1900 and 2200 and at most 366 days apart. |
include_ | Optional booleans; both default to true. At least one must remain true. |
families | Optional release families, up to 5: gdp, prices, labour, trade, policy_, activity, survey, housing, money, public_, yield_. Omit or use an empty list for every family. For a holiday-only feed, set include_ to false. |
scope | Optional nonempty scope identifier, up to 64 characters. |
Holiday-only subscriptions can use published holiday countries outside the economic-release country set.
Create returns 400 invalid_ for a country outside the active profile or, when releases are included, a country without release calendar coverage. When releases are included, it also covers a subscription with more than 1,000 releases; choose fewer countries or families or a shorter date range. A feed that later grows past 1,000 releases serves the first 1,000 by date. When holidays are included, the same error covers an unpublished year or a scope missing from that year. These refusals cost nothing.
Example response
Illustrative response. Save the token URL when you create the subscription; the create response returns it once.
{
"subscription_id": "00000000-0000-4000-8000-000000000301",
"url": "https://api.narwhalapi.com/v1/calendars/subscriptions/EXAMPLE_TOKEN.ics",
"expires_at": "2027-10-22T09:00:00Z"
}subscription_ identifies the record for revocation. expires_ is the expiry timestamp, always 365 days after creation. The calendar client controls the refresh delay.
Refresh and revoke
A calendar client fetches GET /v1/calendars/subscriptions/{token}.ics. The feed supports ETag refresh. Treat its token URL as a secret: anyone with it can read the feed until expiry or revocation.
Use your bearer key with DELETE /v1/calendars/subscriptions/{subscription_id} to revoke it. A successful revocation returns 204 with no body. A well-formed feed token (43 characters) that is expired, revoked, or unknown returns 404; a string of another length needs your bearer key and returns 401. Revoking an unknown or foreign subscription id returns 404 subscription_. The feed never includes your API key.
- Releases with unknown timing or only a deadline are omitted. Estimated ranges need both bounds. Date-only releases and holidays are all-day events.
- Release
UIDisrelease-{release_; holidayid}@narwhal UIDis{uid}@narwhal.SEQUENCEis the release revision or the holiday sequence, defaulting to 0. - The feed allows private caching for 5 minutes. Send its
ETagasIf-None-Match; an unchanged feed returns304with no body. - A feed that cannot be built returns
503with no body. Retry later.
Was this page helpful?