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. You can also download OpenAPI schema from the https://api.parsedog.io/swagger.
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 of a PDF, PNG, JPEG, GIF or WEBP
const data = await extractData({
schema: z.object({
products: z.array(z.object({
name: z.string(),
price: z.number(),
}))
}),
document: "https://example.com/receipt.pdf"
})
import {t, extractData} from "@parsedog/sdk"
const data = await extractData({
schema: t.Object({
products: t.Array(t.Object({
name: t.String(),
price: t.Number(),
}))
}),
document: "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({
schema: z.object({
products: z.array(z.object({
name: z.string(),
price: z.number(),
}))
}),
document
})
// z is a zod instance
import {z, answerQuestions} from "@parsedog/sdk"
// Document can be url of a PDF, PNG, JPEG, GIF or WEBP
const data = await answerQuestions({
questions: ["What is the total amount?", "What is the total tax?"],
document: "https://example.com/receipt.pdf"
})
import {z, answerQuestions} from "@parsedog/sdk"
const document = Buffer.from(await Bun.file("receipt.pdf").arrayBuffer()).toString("binary")
const data = await answerQuestions({
questions: ["What is the total amount?", "What is the total tax?"],
document
})