This SDK provides a typesafe way to interact with the Parsedog API.
We use JSR, so you can checkout https://jsr.io/@parsedog/sdk for autogenerated docs.
To get API key, please visit the https://parsedog.io.
Note: This SDK is currently in beta, so the API may change before reaching a stable version.
You can install the SDK using your favorite package manager:
# bun
bunx jsr add @parsedog/sdk@latest
# pnpm
pnpm dlx jsr add @parsedog/sdk@latest
# deno
deno add @parsedog/sdk@latest
Obtain your API key from the Parsedog dashboard and following to your .env
file:
PARSEDOG_API_KEY="Your API key here"
// z is a zod instance
import {z, extractData} from "@parsedog/sdk"
// Document can be url PDF, PNG, JPEG, GIF or WEBP
const data = await extractData(z.object({
products: z.array(z.object({
name: z.string(),
price: z.number(),
}))
}), "https://example.com/receipt.pdf")
import {t, extractData} from "@parsedog/sdk"
const data = await extractData(t.Object({
products: t.Array(t.Object({
name: t.String(),
price: t.Number(),
}))
}), "https://example.com/receipt.pdf")
import {z, extractData} from "@parsedog/sdk"
const document = Buffer.from(await Bun.file("receipt.pdf").arrayBuffer()).toString("binary")
const data = await extractData(z.object({
products: z.array(z.object({
name: z.string(),
price: z.number(),
}))
}), document)