> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fileloom.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Generate your first PDF with Fileloom in under 5 minutes.

## Prerequisites

Before you begin, you'll need:

* A Fileloom account — [Sign up free](https://app.fileloom.io/signup)
* An API key from your dashboard

## Step 1: Get Your API Key

<Steps>
  <Step title="Sign in to Dashboard">
    Go to [app.fileloom.io](https://app.fileloom.io) and sign in with Email, Google, or GitHub.
  </Step>

  <Step title="Navigate to API Keys">
    Click **API Keys** in the sidebar.
  </Step>

  <Step title="Create New Key">
    Click **Create API Key**, give it a name, and copy the key immediately — it won't be shown again.
  </Step>
</Steps>

<Warning>
  Store your API key securely. It provides full access to your workspace and cannot be retrieved after creation.
</Warning>

## Step 2: Generate Your First PDF

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.fileloom.io/v1/pdf/generate \
    -H "X-API-Key: fl_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "htmlContent": "<html><body><h1>My First PDF</h1><p>Generated with Fileloom!</p></body></html>"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.fileloom.io/v1/pdf/generate', {
    method: 'POST',
    headers: {
      'X-API-Key': 'fl_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      htmlContent: '<html><body><h1>My First PDF</h1><p>Generated with Fileloom!</p></body></html>'
    })
  });

  const result = await response.json();
  console.log(result.data.url); // URL to your PDF
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.fileloom.io/v1/pdf/generate',
      headers={
          'X-API-Key': 'fl_your_api_key',
          'Content-Type': 'application/json'
      },
      json={
          'htmlContent': '<html><body><h1>My First PDF</h1><p>Generated with Fileloom!</p></body></html>'
      }
  )

  result = response.json()
  print(result['data']['url'])  # URL to your PDF
  ```

  ```typescript TypeScript theme={null}
  interface FileloomResponse {
    success: boolean;
    data: {
      fileId: string;
      url: string;
      filename: string;
      size: number;
      processingTimeMs: number;
    };
  }

  const response = await fetch('https://api.fileloom.io/v1/pdf/generate', {
    method: 'POST',
    headers: {
      'X-API-Key': 'fl_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      htmlContent: '<html><body><h1>My First PDF</h1><p>Generated with Fileloom!</p></body></html>'
    })
  });

  const result: FileloomResponse = await response.json();
  console.log(result.data.url);
  ```

  ```php PHP theme={null}
  $ch = curl_init('https://api.fileloom.io/v1/pdf/generate');

  curl_setopt_array($ch, [
      CURLOPT_POST => true,
      CURLOPT_RETURNTRANSFER => true,
      CURLOPT_HTTPHEADER => [
          'X-API-Key: fl_your_api_key',
          'Content-Type: application/json'
      ],
      CURLOPT_POSTFIELDS => json_encode([
          'htmlContent' => '<html><body><h1>My First PDF</h1><p>Generated with Fileloom!</p></body></html>'
      ])
  ]);

  $response = curl_exec($ch);
  $result = json_decode($response, true);

  echo $result['data']['url']; // URL to your PDF
  ```

  ```go Go theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "net/http"
  )

  func main() {
      payload := map[string]string{
          "htmlContent": "<html><body><h1>My First PDF</h1><p>Generated with Fileloom!</p></body></html>",
      }
      body, _ := json.Marshal(payload)

      req, _ := http.NewRequest("POST", "https://api.fileloom.io/v1/pdf/generate", bytes.NewBuffer(body))
      req.Header.Set("X-API-Key", "fl_your_api_key")
      req.Header.Set("Content-Type", "application/json")

      client := &http.Client{}
      resp, _ := client.Do(req)
      defer resp.Body.Close()

      var result map[string]interface{}
      json.NewDecoder(resp.Body).Decode(&result)
      
      data := result["data"].(map[string]interface{})
      fmt.Println(data["url"])
  }
  ```
</CodeGroup>

## Step 3: View Your PDF

The response includes a `url` field with a direct link to your generated PDF:

```json Response theme={null}
{
  "success": true,
  "requestId": "req_1734012345_abc123",
  "data": {
    "fileId": "file_1734012345_xyz789",
    "url": "https://storage.googleapis.com/fileloom-prod/workspaces/ws_.../document.pdf",
    "signedUrl": "https://storage.googleapis.com/fileloom-prod/...",
    "filename": "document.pdf",
    "size": 8234,
    "processingTimeMs": 623,
    "generationMethod": "html"
  },
  "usage": {
    "remaining": 1999,
    "quotaUsed": 1,
    "quotaLimit": 2000
  }
}
```

* **url** — Permanent public URL (valid until retention period expires)
* **signedUrl** — Temporary secure URL (valid for 24 hours)

## Step 4: Add Dynamic Data

Use Handlebars syntax to inject dynamic content:

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.fileloom.io/v1/pdf/generate \
    -H "X-API-Key: fl_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "htmlContent": "<h1>Invoice #{{invoiceNumber}}</h1><p>Amount: {{currency amount \"USD\"}}</p><p>Due: {{formatDate dueDate \"MMMM D, YYYY\"}}</p>",
      "templateData": {
        "invoiceNumber": "INV-2024-001",
        "amount": 299.99,
        "dueDate": "2024-12-31"
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.fileloom.io/v1/pdf/generate', {
    method: 'POST',
    headers: {
      'X-API-Key': 'fl_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      htmlContent: '<h1>Invoice #{{invoiceNumber}}</h1><p>Amount: {{currency amount "USD"}}</p><p>Due: {{formatDate dueDate "MMMM D, YYYY"}}</p>',
      templateData: {
        invoiceNumber: 'INV-2024-001',
        amount: 299.99,
        dueDate: '2024-12-31'
      }
    })
  });

  const result = await response.json();
  console.log(result.data.url);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.fileloom.io/v1/pdf/generate',
      headers={
          'X-API-Key': 'fl_your_api_key',
          'Content-Type': 'application/json'
      },
      json={
          'htmlContent': '<h1>Invoice #{{invoiceNumber}}</h1><p>Amount: {{currency amount "USD"}}</p><p>Due: {{formatDate dueDate "MMMM D, YYYY"}}</p>',
          'templateData': {
              'invoiceNumber': 'INV-2024-001',
              'amount': 299.99,
              'dueDate': '2024-12-31'
          }
      }
  )

  result = response.json()
  print(result['data']['url'])
  ```
</CodeGroup>

This generates a PDF with:

* Invoice #INV-2024-001
* Amount: \$299.99
* Due: December 31, 2024

## Step 5: Create a Reusable Template

For repeated use, create a template in the dashboard:

<Steps>
  <Step title="Open Template Editor">
    Go to **Templates** → **Create Template** in the dashboard.
  </Step>

  <Step title="Design Your Template">
    Write HTML in the editor, add CSS styling, and use `{{variables}}` for dynamic content.
  </Step>

  <Step title="Test with Sample Data">
    Enter test JSON in the **Test Data** tab and preview your PDF in real-time.
  </Step>

  <Step title="Publish">
    Click **Publish** to make the template available via API.
  </Step>

  <Step title="Use via API">
    Reference your template by ID instead of sending raw HTML:
  </Step>
</Steps>

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.fileloom.io/v1/pdf/generate \
    -H "X-API-Key: fl_your_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "templateId": "tpl_your_template_id",
      "templateData": {
        "invoiceNumber": "INV-2024-002",
        "amount": 599.99,
        "dueDate": "2025-01-15"
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.fileloom.io/v1/pdf/generate', {
    method: 'POST',
    headers: {
      'X-API-Key': 'fl_your_api_key',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      templateId: 'tpl_your_template_id',
      templateData: {
        invoiceNumber: 'INV-2024-002',
        amount: 599.99,
        dueDate: '2025-01-15'
      }
    })
  });

  const result = await response.json();
  console.log(result.data.url);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.fileloom.io/v1/pdf/generate',
      headers={
          'X-API-Key': 'fl_your_api_key',
          'Content-Type': 'application/json'
      },
      json={
          'templateId': 'tpl_your_template_id',
          'templateData': {
              'invoiceNumber': 'INV-2024-002',
              'amount': 599.99,
              'dueDate': '2025-01-15'
          }
      }
  )

  result = response.json()
  print(result['data']['url'])
  ```
</CodeGroup>

## What's Next?

<CardGroup cols={2}>
  <Card title="Core Concepts" icon="lightbulb" href="/getting-started/concepts">
    Learn about workspaces, templates, and credits
  </Card>

  <Card title="Template Helpers" icon="wand-magic-sparkles" href="/helpers/overview">
    Explore 70+ built-in formatting helpers
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/generate-pdf">
    Full endpoint documentation with all options
  </Card>

  <Card title="Code Examples" icon="file-code" href="/code-examples/overview">
    Examples in 12 programming languages
  </Card>
</CardGroup>
