We’re dedicated to providing the simplest integration experience possible. If you encounter any challenges or have suggestions for improvement, please reach email dx@refile.co.

Your first PDF

  1. Sign up for refile to get your API key and use the playground
  2. Make your first call to the refile API
curl --request POST \
  --url https://www.refile.co/api/v1/pdf/markdown \
  --header "Authorization: Bearer <token>" \
  --data '{
  "markdown": "# My first PDF!\nThis is my first PDF."
}' --output ./output.pdf

Customizing your payload

You can enhance your PDF generation by customizing various properties in your API payload. These options allow you to control the appearance, formatting, and delivery of your documents.

Markdown

Markdown content is specified via the markdown property. We fully support GitHub Flavored Markdown (GFM), and inline HTML with custom CSS via <style> tags.

Themes

Enhance your document’s appearance by setting the theme property to one of our professionally designed options from the themes gallery. Each theme provides a unique visual style that can match your brand or content purpose. The default theme is modern.

Page numbers

Use the pageNumeration property to control page number placement in your PDF. Available options include "none" (default, no page numbers), "center" (centered at bottom), "left" (bottom left), and "right" (bottom right).

Output format

The output property determines how the generated PDF is returned:

  • "binary" (default): Returns the PDF as binary data in the response, which you can save directly to a file.
  • "url": Returns a URL to download the generated PDF. The URL is valid for at least 7 days.

Choose "url" for most web applications where you want to provide a download link, and "binary" when you need to process or store the PDF data directly in your application. When you choose URL, we will host your PDF on Vercel Blob Storage.

Page size

Control the dimensions of your PDF by setting the pageSize property. We support many standard paper sizes, including A0-A9, Letter, Legal and B1-B6.

For the full list of supported paper sizes, refer to the API reference.

Example payload

JSON
{
	"markdown": "# Example Document\n\nThis is a sample document created with refile.",
	"theme": "basic",
	"pageNumeration": "left",
	"output": "url",
	"pageSize": "Legal"
}

Further reading