Welcome to Anvil API usage examples in TypeScript! There are example scripts for the following API actions:
- Filling a PDF template with your own data
- Generating a PDF from HTML and CSS
- Generating a PDF from Markdown
- Creating an e-sign packet
- Starting a workflow and updating workflow submissions
- Making an arbitrary GraphQL request
All scripts will require that you have an Anvil API key. See the getting started documentation for help grabbing your API key.
When you have your API key, copy .env.example
in this folder to .env
, then set ANVIL_API_KEY to your API key. Your .env
will look like this:
ANVIL_API_KEY=yourAPIKey2uzgMH0ps4cyQyadhA2Wdt
Each script is set up to be runnable with minimal input. Once you have an API key, you can clone this repo and run the example scripts from this directory.
Once you have this repo cloned, cd into this typescript
directory and install the dependencies:
cd typescript
yarn install
Scripts will output filled and generated PDFs into the output directory.
$ yarn ts-node examples/fill-pdf.ts
Generate a PDF from HTML and CSS:
$ yarn ts-node examples/generate-html-to-pdf.ts
$ yarn ts-node examples/generate-markdown-to-pdf.ts
$ yarn ts-node examples/create-etch-e-sign-packet.ts <[email protected]>
Start and update workflow submissions:
$ yarn ts-node examples/create-update-workflow-submission.ts <your-org-slug>
Make an arbitrary GraphQL request:
$ yarn ts-node examples/make-graphql-request.ts