@fillout/api
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

Fillout logo

Fillout API Client

TypeScript SDK for accessing forms and submissions 🚀



Connecting to the API

import { Fillout } from "@fillout/api"

const fillout = new Fillout(FILLOUT_API_KEY)

You can generate an API key for your organization at https://build.fillout.com/home/settings/developer. It should start with sk_prod_. Don't save secret keys in your code - use an environmental variable instead.

If you're on an Enterprise plan and you have Fillout submissions hosted in a different region, you'll need to use the region option, like so:

const fillout = new Fillout(FILLOUT_API_KEY, { region: "eu" })

The values currently available are us (default), eu and ca. Check the base URL in your developer settings.

Get started with these examples

Print a list of questions in a form:

const forms = await fillout.getForms()

const formName = "Fillout SDK"
const formId = forms.find((f) => f.name === formName)?.formId
if (!formId) throw new Error("Missing form")

const form = await fillout.getForm(formId)

console.log(`Questions available in ${formName}:

${form.questions.map((question) => `${question.name} (${question.type})`).join("\n")}`)

Get the ten most recent submissions of a form:

const submissions = await fillout.getSubmissions("foAdHjd1Duus", {
  includePreview: true,
  limit: 10,
  sort: "desc",
})

Documentation

To find out what you can do, take a look at our API documentation. This package also has TypeScript and JSDoc comments, so you should get some helpful hints in your editor :)

If you're looking to embed Fillout in a React project, try @fillout/react!

Readme

Keywords

none

Package Sidebar

Install

npm i @fillout/api

Weekly Downloads

114

Version

1.4.0

License

MIT

Unpacked Size

33.3 kB

Total Files

7

Last publish

Collaborators

  • xkcdstickfigure
  • dominicwhyte
  • antonytoron
  • danteissaias