Browse all documentation

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 →

POST /v1/calendars/subscriptions
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

FieldRule
countriesRequired list of 1–50 ISO alpha-3 country codes.
start_date / end_dateRequired inclusive date window, between 1900 and 2200 and at most 366 days apart.
include_releases / include_holidaysOptional booleans; both default to true. At least one must remain true.
familiesOptional release families, up to 5: gdp, prices, labour, trade, policy_rate, activity, survey, housing, money, public_finance, yield_curve. Omit or use an empty list for every family. For a holiday-only feed, set include_releases to false.
scopeOptional 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_query 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.

Created
{
  "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_id identifies the record for revocation. expires_at 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_not_found. 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 UID is release-{release_id}@narwhal; holiday UID is {uid}@narwhal. SEQUENCE is the release revision or the holiday sequence, defaulting to 0.
  • The feed allows private caching for 5 minutes. Send its ETag as If-None-Match; an unchanged feed returns 304 with no body.
  • A feed that cannot be built returns 503 with no body. Retry later.

Was this page helpful?