Docs menu

First stepsQuickstart

Quickstart

Your first PDF in three steps: export the key, send a markdown file, save the response.

Prerequisites#

There is no SDK. Every sample below is a plain HTTP request, so any language with an HTTP client works.

Render your first PDF#

  1. Set your API key

    export LEGIVEL_API_KEY="lgv_your_key_here"
  2. Write a markdown file

    hello.md
    # Hello, legivel
    
    This paragraph uses paragraph-wide line breaking. Set a document language to enable automatic hyphenation.
    
    - One list item
    - Another list item
    
    ```mermaid
    flowchart LR
      md[markdown] --> pdf[PDF]
    ```

    Open it in the editor to see the PDF before you have a key.

  3. Send it

    POST the file as the request body with Content-Type: text/markdown. The response body is the PDF.

    curl -X POST https://api.legivel.com/v1/render \
      -H "Authorization: Bearer $LEGIVEL_API_KEY" \
      -H "Content-Type: text/markdown" \
      --data-binary @hello.md \
      -o hello.pdf
  4. Check the result

    Open hello.pdf. Then read your usage; credits_used has increased by 1.

    curl https://api.legivel.com/v1/usage \
      -H "Authorization: Bearer $LEGIVEL_API_KEY"
    {
      "plan": "free",
      "period_start": "2026-09-09T00:00:00.000Z",
      "period_end": "2026-10-09T00:00:00.000Z",
      "credits_included": 100,
      "credits_granted": 0,
      "credits_used": 1,
      "limits": { "markdown_kb": 512, "resources_mb": 1.5, "pages_max": 20,
                  "timeout_s": 30, "concurrency": 1, "requests_per_min": 5, "previews_per_hour": 120 },
      "keys": [{ "id": "<id of the calling key>", "name": "CI", "credits": 1 }]
    }

    Sign in and this block shows your own account.

What happened#

  • The request used one of your period's documents. The Free plan includes 100 documents per period. A failed render returns the document to your period.
  • The PDF carries no watermark. Only the web editor's free preview does.
  • The response carries a Server-Timing header with the converter's own numbers in milliseconds: setup, render, serialize and total.

Next steps#

  • Render a PDF: the JSON body and the Idempotency-Key header for safe retries.
  • Errors and quota: every error code and what to do about it.
  • Limits: what each plan allows and what a refusal costs.
  • MCP server: the same render from an agent.