Skip to main content

Documentation

This guide details the available endpoints for the Docs Render API. All requests should be made to your deployed base URL.

https://docs-render-api-307616438192.europe-west1.run.app

Authentication

Most endpoints require an API Key. You can pass it in two ways:

  • Header: x-api-key: YOUR_KEY (Recommended)
  • Query Parameter: ?api_key=YOUR_KEY

1. System Status

Check Health

GET /health

Returns the current server status and environment.


2. User Account

Get Profile

GET /me

Returns your customer ID, email, remaining credits, and Google connection status.


3. Google Connection

Connect Google Account

GET /auth/google/start

Initiates the OAuth flow to connect a Google Workspace account.


4. Templates

Register a Template

POST /templates

Aliases a Google Doc ID to a friendly key (e.g., "invoice").

Body Parameters

  • key (string): Unique alias (letters, numbers, underscores).
  • google_doc_id (string): The ID from the Google Doc URL.

List Templates

GET /templates

Lists all your registered templates.


5. Rendering Documents

Render PDF

POST /docs/render

Merges variables into a Google Doc template and returns a PDF.

Body Parameters

  • template (string): Your registered template alias.
  • variables (object): Key-value pairs matching {{brackets}} in your doc.
  • output_title (string, optional): Filename for the PDF.
  • return (string, optional): pdf_stream (default) or pdf_base64.
curl -X POST https://docs-render-api-307616438192.europe-west1.run.app/docs/render \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "template": "invoice_v1",
    "variables": {
      "customer_name": "Acme Corp",
      "total": "$500.00"
    }
  }' \
  --output invoice.pdf

6. Billing

Purchase Credits

POST /billing/checkout

Creates a Stripe Checkout session.

Body Parameters

  • email (string)
  • pack (enum): "100", "300", "1000"