DEV Community

Cover image for Handling form submissions via the Netlify API
Phil Hawksworth for Netlify

Posted on • Originally published at netlify.com

Handling form submissions via the Netlify API

Throughout December we'll be highlighting a different Netlify feature each day. It might just be the thing you need to unlock those creative juices, and dust off that domain you registered but never deployed! Keep an eye on the blog and on Twitter for each feature!

When using Netlify Forms, you can access your submissions via the UI under the Forms tab of your site, but if you'd like to
programmatically access them, you can use the Netlify API to do so.

A few endpoints and operations are available.

Note: All URLs start with https://api.netlify.com/api/v1. SSL only.

  • Get verified submissions for all forms of a site with a GET request to /sites/{site_id}/submissions.
  • Get verified submissions for a specific form of a site with a GET request to /forms/{form_id}/submissions.
  • Get spam submissions by adding the query parameter state=spam to the URLs mentioned above. For example /forms/{form_id}/submissions?state=spam.
  • Change submission state with the 2 following operations:
    • PUT request to /submissions/{submission_id}/spam to mark a submission as spam.
    • PUT request to /submissions/{submission_id}/ham to mark a submission as ham.
  • Delete submissions with a DELETE request to /submissions/{submission_id}

That's it! From there you can manage your submissions whichever way you want!

More information

Top comments (0)