Ingest paginated API data into Postgres with retries and rate limiting
Quick overview
Description
Quick overview This workflow manually ingests data from any paginated HTTP API, normalizes each record, and upserts it into a PostgreSQL table, looping through pages with built-in retries and an optional wait between requests. How it works Starts when you run the workflow manually. Builds an API request configuration (URL, headers, pagination strategy, limits, retry settings) and initializes pagination state. Calls the API via HTTP Request and returns the full response while retrying on failures. Parses the response body, extracts the records from the configured JSON path, maps fields into the target database schema, and computes the next page/cursor/link to request. Upserts the normalized batch into PostgreSQL using an INSERT ... ON CONFLICT statement when the page contains records. Checks whether more pages remain (and the max-pages safety limit is not exceeded), waits briefly to respect rate limits, and repeats the fetch until pagination ends. Outputs a final summary with pages processed and total records ingested, then ends the workflow. Setup Update the API configuration in the code step (base URL, auth header/token, pagination type and parameters, response dataPath/cursorPath, and any static query parameters). Add a PostgreSQL credential, and ensure the target table and unique key column exist and match the configured tableName/uniqueKey and field mappings. Adjust operational limits such as limit, maxPages, maxRetries, retryWaitMs, and the wait delay between pages to fit the API’s rate limits and payload size. An n8n automation workflow template by Oneclick AI Squad.
Community Metrics
Author
Oneclick AI Squad
Platform
web
Pricing model
free
Categories
- Automation
Tags
- n8n
- workflow
- http-request
- postgres
- code
Capabilities
- 3 nodes