FeoPDF API Documentation

website·Indexed 30 days ago

https://feopdf.com/docs

A REST API for generating high-fidelity PDFs and images from HTML, URLs, or raw content. Features include template-based generation, a /pdf endpoint for PDF creation, and a /screenshot endpoint for high-quality image capture, all secured via Bearer Token authentication.

Tokens
2.2K
Snippets
12
Records
25
Agent score
50%

What's inside FeoPDF

  1. Overview of FeoPDF API

    The FeoPDF API is a REST-based service used to generate high-fidelity PDFs and images from HTML, URLs, or raw content. It uses JSON for request and response bodies.

    Base URL: https://feopdf.com/api

  2. Overview of FeoPDF API

    The FeoPDF API is a REST-based service used to generate high-fidelity PDFs and images from HTML, URLs, or raw content. It uses JSON for request and response bodies. The base URL for all API requests is https://feopdf.com/api.
  3. Create PDF templates using AI

    FeoPDF provides an AI-powered template generator within its console. Instead of writing HTML, users can provide a sample of their JSON data and a natural language prompt (e.g., "Create an invoice template" or "receipt template"). The AI generates a production-ready, responsive template that is saved to the console for further customization and immediate use via the API.
    // Example JSON data to provide to the AI generator
    {
      "customer": "Acme Corp",
      "items": [],
      "total": 1250.00
    }
  4. Authenticate API requests using Bearer Tokens

    Secure all API requests by providing your API key in the Authorization HTTP header as a Bearer token. API keys can be managed via the FeoPDF Dashboard. To prevent unauthorized access, do not expose secret API keys in client-side code or public repositories like GitHub.
    Authorization: Bearer feo_live_...
  5. Understand FeoPDF document privacy and storage

    FeoPDF does not store documents generated via the API by default. Documents are only stored if the user explicitly configures the service to do so for caching or debugging purposes. All data is encrypted while in transit.
  6. Generate a PDF from a URL using the /pdf endpoint

    To generate a PDF from a specific URL, send a POST request to https://feopdf.com/api/pdf. The request body should be JSON and can include a url and an options object (e.g., specifying the page format or whether to printBackground).
    curl -X POST https://feopdf.com/api/pdf \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "url": "https://example.com",
        "options": {
          "format": "A4",
          "printBackground": true
        }
      }' \
      --output document.pdf
  7. Handle failed API authentication errors

    When an invalid or missing API key is provided in the request header, the API returns a 401 Unauthorized HTTP status code with a JSON error body indicating the key is invalid.
    {
      "error": {
        "code": "unauthorized",
        "message": "Invalid API key provided."
      }
    }
  8. Configure screenshot capture options

    The /screenshot endpoint accepts an options object to control the rendering of the capture:

    • fullPage (boolean): If true, captures the entire page. Defaults to false.
    • width (integer): Viewport width in pixels. Defaults to 1920.
    • height (integer): Viewport height in pixels. Defaults to 1080.
  9. Generate a PDF using a template and JSON data

    To generate a PDF, send a POST request to the /api/v1/pdf endpoint. You must provide a template_id (created in the FeoPDF console) and a data object containing the JSON values to populate the template. Optional configuration can be passed in the options object, such as specifying the page format (e.g., 'A4').
    curl -X POST https://feopdf.com/api/v1/pdf \
      -H "Authorization: Bearer YOUR_API_KEY"\
      -H "Content-Type: application/json"\
      -d '{
        "template_id": "tmpl_invoice_001",
        "data": {
          "customer_name": "Acme Corp",
          "amount": "$1,250.00",
          "invoice_date": "2024-01-15"
        },
        "options": {
          "format": "A4"
        }
      }'
  10. Configure PDF rendering options

    The options object in the POST /pdf request body allows you to customize the output format and orientation:

    • format (string): The paper format. Supported values are A4 (default), Letter, and A3.
    • landscape (boolean): Set to true to print in landscape mode; defaults to false.
    {
      "options": {
        "format": "A3",
        "landscape": true
      }
    }
  11. Generate a PDF from a URL using the FeoPDF API

    To generate a PDF from a specific URL, send a POST request to https://feopdf.com/api/pdf. The request body should be JSON and can include an options object to specify the page format (e.g., 'A4') and whether to printBackground.
    curl -X POST https://feopdf.com/api/pdf \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "url": "https://example.com",
        "options": {
          "format": "A4",
          "printBackground": true
        }
      }' \
      --output document.pdf