To my knowledge besides the old experiments with client side search, Google has never allowed (even paid) api access to their search. I thought they did not do this, because it would have allowed somebody to jump start a search engine that might eventually become a competitor.
Kagi seems to be open about their Google relationship, so I assume they have agreement in place.
This even feels like some experiment from Google to create a premium, paid, search product (like what they did with YouTube).