Skip to content
Visual explainer 2h 30m to learn 5 steps

Polling with schedules, cursors and time zones in n8n

Poll a source on a schedule with a persisted cursor and explicit time zone, and verify catch-up after downtime.

By Invicly Tech, , in n8n, AI Automation and Voice Agents. About 10 minutes to read.

Topic 9 of 43

In short

Polling means asking a source for new items on a timer, using the Schedule Trigger. A webhook pushes events to you, while polling pulls them. Polling needs a saved cursor (the last item seen) and an explicit time zone, so you skip duplicates and catch up after downtime.

Think of it like this: A cursor is a bookmark. When you come back after a break, you open the book at the bookmark instead of rereading from page one.

Explained simply

Not every system can call you. Some only let you ask them for news. Asking on a timer is called polling. In n8n the Schedule Trigger node starts a workflow every few minutes, hourly, daily or on a cron pattern.

The hard part of polling is remembering where you stopped. Imagine a list of new orders. If you ask for the last 15 minutes every 15 minutes, a late run misses orders and an early run repeats them. Instead, save a cursor: the time or ID of the last order you handled. Each run asks for everything after the cursor.

Time zones need care too. A schedule saying 09:00 means 09:00 in some time zone. In n8n, set the time zone in the workflow settings, such as Europe/Berlin, so you do not depend on the server default.

Even with a cursor, duplicates can appear, for example when a run fails after processing some items. Keep a processed key for each item, and skip those you have already done. Finally test the failure case: stop the workflow for an hour and check that the next run catches up.

Press Play on a diagram to walk through it one step at a time.

FlowOne polling run with a cursor
  1. 1
    Schedule fires

    Every 15 minutes in the set time zone

  2. 2
    Read cursor

    From a data table

  3. 3
    Fetch items since cursor

    Ask the source for newer items

  4. 4
    Process new items

    Skip keys already done

  5. 5
    Save new cursor

    Only after processing worked

ComparePolling or webhook
Polling
  • You control when it runs
  • Works when the source cannot call you
  • Delay up to one interval
  • Needs a cursor and catch-up
Webhook
  • Near real time
  • Needs a reachable public URL
  • Source may retry and send duplicates
  • Missed events if you were down
CycleThe polling loop over time
  1. 1
    Wait

    Until the next interval

  2. 2
    Ask since cursor

    Only newer items

  3. 3
    Process and de-duplicate
  4. 4
    Move cursor forward

    After success

  5. Back to step 1

In depth

Polling compared with webhooks

A webhook is push: the source calls you the moment something happens. It is fast and cheap, but it needs a public address, authentication and handling of retries. If you are down, events can be lost unless the sender retries.

Polling is pull: you ask on a timer. It needs no public address, so it works behind a firewall and with services that offer no webhooks. The cost is delay up to one interval and some wasted calls when nothing changed. Many real systems use both: a webhook for speed and a daily poll to catch anything missed.

  • Webhook: fast, needs a public URL
  • Polling: simple, delayed, you control the rate
  • Combine them for safety
  • Check the source's rate limits before choosing an interval

Persisting a cursor or a processed key

A cursor must survive restarts, so keep it outside the running workflow. Good places are an n8n data table, a database row or a small file. Read it at the start of each run and write the new value only at the end, once processing worked.

If the source has no reliable order, keep a set of processed event IDs instead. The Remove Duplicates node can do this: its mode for items processed in previous executions remembers values between runs, and it has a clear history operation for resets. A cursor is smaller; a processed-key set is more forgiving about order.

  • Store the cursor in a data table or database
  • Write it last, after success
  • Use event IDs when order is not reliable
  • Keep a way to reset it for testing
SequenceCursor read and write in one run
Schedule
Workflow
Data table
Source API
  1. 1Fire at 09:00 Europe/Berlin
    Schedule to Workflow: Fire at 09:00 Europe/Berlin
  2. 2Get cursor
    Workflow to Data table: Get cursor
  3. 3Last ID: 4021
    Data table to Workflow: Last ID: 4021
  4. 4List items with ID above 4021
    Workflow to Source API: List items with ID above 4021
  5. 5Items 4022 to 4030
    Source API to Workflow: Items 4022 to 4030
  6. 6Process each new item
    Workflow to Workflow: Process each new item
  7. 7Save cursor 4030
    Workflow to Data table: Save cursor 4030

Time zones and schedules

The Schedule Trigger follows the workflow's time zone, set in the workflow settings. If you leave it empty, n8n uses the instance setting, which comes from the GENERIC_TIMEZONE environment variable. These can differ from the time zone of your users, so set it deliberately.

Daylight saving time can surprise you. A daily job at 02:30 may not exist on the day the clocks jump forward. Pick a safe hour, or use UTC for machine-to-machine jobs. Store dates in RFC 3339 form with an offset so the cursor means the same thing everywhere.

  • Set the time zone per workflow
  • Use IANA names such as Europe/Berlin
  • Avoid hours that vanish at clock changes
  • Store cursors as UTC timestamps or IDs

Testing catch-up after downtime

A Schedule Trigger does not replay missed runs. If n8n is stopped for an hour, those runs simply do not happen. What saves you is the cursor: the next run asks for everything after it, so the missed items come back in one larger batch.

Test this on purpose. Put three synthetic items in the source, run once, add four more, deactivate the workflow, wait for two intervals, activate it, and check that all seven were processed exactly once. If the batch could be large, add paging so one run does not time out.

  • Deactivate for a few intervals on purpose
  • Count processed items against the source
  • Check no item was handled twice
  • Add paging for large catch-up batches

Learn it in 5 short steps

About 30m each. Track them with a timer in your plan.

  1. 1
    Compare polling with webhooks~30m
  2. 2
    Persist a cursor or processed key~30m
  3. 3
    Set the workflow time zone~30m
  4. 4
    Skip already processed events~30m
  5. 5
    Test catch-up after downtime~30m

Key points

  • Choose a webhook when the source can push. Choose polling when it cannot, or when you want control over timing.
  • Save a cursor, such as the last updated time or last ID, in a data table or another store that survives restarts.
  • Set the time zone in workflow settings. Otherwise the instance default decides when 09:00 happens.
  • Skip items you already handled with a processed key or the Remove Duplicates node.
  • A Schedule Trigger does not replay missed runs. Catch-up happens because the cursor asks for everything since last time.

Key terms

Tap a card to flip it. 0/5 known

Examples

Filter new items with a cursor in a Code node

A previous node returned the saved cursor, and the HTTP Request returned items with numeric IDs. This code keeps only newer items and passes the highest ID on so a later node can save it.

javascript
const cursor = Number($('Get cursor').first().json.lastId ?? 0);
const items = $input.all().map(i => i.json);
const fresh = items.filter(x => Number(x.id) > cursor);
const newCursor = fresh.length
  ? Math.max(...fresh.map(x => Number(x.id)))
  : cursor;
return [{ json: { fresh, newCursor, count: fresh.length } }];

Catch-up test plan

Prerequisites: a mock source with a list endpoint and a data table with one cursor row. Expected evidence: seven processed rows with no repeats. Cleanup: delete test rows and reset the cursor to zero.

text
1 Source has items 1-3. Run workflow. Cursor = 3.
2 Add items 4-7 to the source.
3 Deactivate the workflow for two intervals.
4 Activate. Wait for the next run.
5 Check: processed table has IDs 1-7 once each.
6 Check: cursor = 7.
7 Reset cursor to 0 for the next test.

Quick reference

  • Use a webhook when the source can push; poll when it cannot.
  • Save the cursor in a data table or database, not in the running workflow.
  • Write the cursor after processing succeeds.
  • Set the workflow time zone in Settings; use IANA names like Europe/Berlin.
  • GENERIC_TIMEZONE sets the instance default time zone.
  • Remove Duplicates can skip items seen in previous executions.
  • Schedule Trigger does not replay missed runs; the cursor provides the catch-up.
  • Test by deactivating the workflow for a few intervals.

Common mistakes

  • Saving the cursor before processing. If a run fails halfway, those items are skipped forever.
  • Assuming the schedule uses your local time when the server and workflow use another zone.
  • Using only now minus 15 minutes as the window. A late run or downtime leaves a gap.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1A workflow asks for items from the last 15 minutes every 15 minutes. What can go wrong?

Question 2

2When should the new cursor be saved?

Question 3

3Where does the Schedule Trigger get its time zone?

Question 4

4n8n was stopped for an hour. What happens to the missed scheduled runs?

Question 5

5Which is a good reason to choose polling over a webhook?

0/5 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Set a Schedule Trigger to run every 5 minutes and set the workflow time zone to Europe/Berlin. Show both settings.

  2. Exercise 2medium

    Add a data table with one cursor row. Read it at the start, filter new items, and update it at the end.

  3. Exercise 3hard

    Prove catch-up and duplicate safety. Stop the workflow for two intervals, then add a deliberate failure after processing item 2 and rerun.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

How often should I poll?
As rarely as your business allows, and never faster than the source's rate limit. Ten to sixty minutes suits many back-office jobs.
What is the difference between a cursor and a processed key?
A cursor is one marker of progress. A processed key is a record of each item already handled, which also protects against reordering.
Why did my schedule run at the wrong hour?
The workflow or instance time zone differs from the one you expected. Set it in workflow Settings.
Can I store the cursor in workflow static data?
It can work in production runs, but a data table or database is easier to inspect and reset, so prefer that for learning.

Go deeper

ShareXLinkedInWhatsApp