[bug report] GetClips endpoint before parameter causes 400

So I’m trying to paginate back to previous clips using this endpoint: https://api.twitch.tv/helix/clips?broadcaster_id=52385053&first=20&before=eyJiIjpudWxsLCJhIjp7IkN1cnNvciI6Ik5EQT0ifX0

The pagination cursor is retrieved from the previous call I did to get results. Moving forward works as expected, go back on the other end gives me this error:

{
“error”: “Bad Request”,
“status”: 400,
“message”: “The cursor specified in the before or after query parameter is not valid.”
}

I’m using the same code logic on Twitch videos, and that seems to work just fine.

Is this a problem with the API or am I doing something wrong?

Then logically you are trying to get page -1 as you got the cursor for page 0

And you can’t go backwards from page 0

Pages being zero indexed here

I understand that I can’t go back if I’m on the first page, but I also get the error when going back from page 2 to 1, or 3 to 2 etc.

i.e:
Using the after param to go to page 2:
https://api.twitch.tv/helix/clips?broadcaster_id=52385053&first=20&after=eyJiIjpudWxsLCJhIjp7IkN1cnNvciI6Ik1qQT0ifX0

Result:
data: […],
pagination: {
“cursor”: “eyJiIjpudWxsLCJhIjp7IkN1cnNvciI6Ik5EQT0ifX0”
}

Then with the returned cursor going back to page 1:

https://api.twitch.tv/helix/clips?broadcaster_id=52385053&first=20&before=eyJiIjpudWxsLCJhIjp7IkN1cnNvciI6Ik5EQT0ifX0

Stil got the error.

Then looks like you found a bug to report

Created this issue on GitHub.