Guides Data pipelines

Keep a copy in your own systems

A nightly job that pulls only what changed since last time.

3 steps6 min

  1. Start from a date

    The first run asks for everything changed since a date. Results come oldest change first, so you can stop and resume at any point.

    curl
    curl "https://api.trendwatching.com/v1/innovations/changes?updated_since=2026-01-01&limit=100" \
      -H "Authorization: Bearer $TW_API_KEY"
  2. Save the cursor

    Every response includes next_cursor, the position after the last change you received. Store it with your data. While has_more is true, call again straight away.

    Python
    import json, pathlib
    
    state = pathlib.Path("tw_cursor.json")
    cursor = json.loads(state.read_text())["cursor"] if state.exists() else None
    
    while True:
        page = (
            tw.innovations.changes(cursor=cursor)
            if cursor
            else tw.innovations.changes(updated_since="2026-01-01")
        )
        upsert(page.data)  # your database write, keyed on innovation_id
        cursor = page.next_cursor or cursor
        state.write_text(json.dumps({"cursor": cursor}))
        if not page.has_more:
            break
  3. Run it on a schedule

    Run the same script nightly. Each run starts from the saved cursor and receives only newer changes. Upsert on innovation_id, since an innovation reappears when its record is updated.

    cron
    0 3 * * *  python sync_trendwatching.py