๐Ÿ”ฎ Sanity Create is here. Writing is reinvented. Try now, no developer setup

Creating a POST Request to an External API with Next.js

2 replies
Last updated: Sep 24, 2022
Hello there. I have successfully extended the built-in actions of my docs to create a POST request to an external API. I am wondering if there is any risk to this method? I am using Next.js and could redirect to one of my API routes and handle the POST to external API there.
Sep 24, 2022, 1:37 AM
I would recommend your suggestion as well, because this would mean the POST is made from a server and not from the browser. This means you can safely secure API keys on your lambda without having to bundle them in the Sanity client-side studio.
Sep 24, 2022, 10:48 AM
thank you for your input! I will do that ๐Ÿ™‚
Sep 24, 2022, 4:25 PM

Sanityโ€“ build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?