<@U04S8PLJWMT>, using Airbyte Custom Builder I hav...
# ask-ai
x
@kapa.ai, using Airbyte Custom Builder I have a pagination Cursor Pagination that uses
{{ response.get("next_page_token", {}) }}
and it should stop when next_page_token is equal to the previous one Can we do it using custom builder ?
k
Yes, you can implement this logic in Airbyte, but not with the standard Cursor Pagination in the Connector Builder UI alone. The standard Cursor Pagination allows you to specify a stop condition using a Jinja template, but it does not provide a built-in way to compare the current cursor value to the previous one, as the context available in the template does not include the previous page token—only the current response, headers, last record, etc. are available for interpolation and stop conditions [Advanced Cursor Pagination Features](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/pagination#advanced-cursor-pagination-features). To achieve the behavior where pagination stops if the next page token is equal to the previous one, you would need to use a Custom Pagination Strategy. This approach allows you to write Python code that can maintain state between requests (such as tracking the previous page token) and implement any custom logic you need. You would: 1. Set the Pagination method to "Custom Pagination Strategy" in the Connector Builder. 2. Implement a custom class inheriting from
PaginationStrategy
in your connector code, where you can compare the current and previous tokens and decide when to stop paginating [Custom Pagination Strategy](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/pagination#custom-pagination-strategy). Summary: - Standard Cursor Pagination in the UI: Not possible, as you cannot access the previous token in the stop condition. - Custom Pagination Strategy: Yes, possible by writing custom Python code. If you need to implement this, refer to the [Custom Pagination Strategy documentation](https://docs.airbyte.com/platform/next/connector-development/connector-builder-ui/pagination#custom-pagination-strategy) for details and an example of how to set up your custom class.