Make Your First API Request

After obtaining your API key, you can send your first request to the Davix H2I API.

A good first request is an HTML-to-image render using the public POST /v1/h2i endpoint. This is the fastest way to understand the Davix H2I request model because it shows the core flow clearly: send HTML, authenticate with your API key, and receive a generated output URL in the response.

What This Request Does #

This first request sends HTML content to the H2I rendering endpoint and asks the platform to render it as an image.

At a high level:

  • endpoint: POST /v1/h2i
  • action: image
  • authentication: API key in a request header
  • body: HTML content and render parameters.

First cURL Request #

curl -sS -X POST "https://pixlab.davix.dev/v1/h2i" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Idempotency-Key: h2i-image-001" \
-H "Content-Type: application/json" \
-d '{
"action": "image",
"html": "<div style=\"width:100%;height:100%;display:flex;align-items:center;justify-content:center\">Hello</div>",
"css": "body{margin:0}",
"width": 1200,
"height": 1600,
"format": "jpeg"
}'

This is the full public example pattern documented for /v1/h2i image rendering, including the optional css, width, height, format, and idempotency header.

Breakdown #

Endpoint #

/v1/h2i is the public HTML-rendering endpoint. It supports rendering HTML into either an image or a PDF depending on the action value.

Method #

The endpoint uses POST.

Authentication #

The request includes the API key in the X-Api-Key header. Public /v1/* routes also support Authorization: Bearer <key>.

Body #

The request body includes:

  • action: "image" to select image output
  • html containing the markup to render
  • css for additional styling
  • width and height for render size
  • format for the output image format.

Example Response #

A successful /v1/h2i request returns a 200 response with this shape:

{
"url": "https://pixlab.davix.dev/h2i/example-output.jpeg?exp=EXPIRES_AT&sig=SIGNATURE",
"request_id": "REQUEST_ID"
}

The public API reference defines the success output as:

  • 200: { url, request_id? }

Understanding the Response #

url #

The url field points to the generated output file created for the request. For /v1/h2i, the URL is signed under the /h2i/* output path.

request_id #

The request_id field is the request identifier attached by the platform. It is useful for tracing, debugging, and support.

What Happens Behind the Scenes #

When you send this request:

  1. the API key is validated
  2. the request body is validated
  3. the /v1/h2i route passes the work to the H2I engine (PixLab)
  4. the HTML is rendered as an image
  5. Davix H2I returns the signed output URL in the response.

This is the same core model that powers the broader platform: authenticate, process, and return the result through the Davix H2I interface.

Request Structure #

This first request shows the general structure used by Davix H2I requests:

  • endpoint path identifying the operation
  • headers for authentication and content type
  • body containing the parameters for the task.

For /v1/h2i, the request body is JSON. Other endpoints such as /v1/image, /v1/pdf, and /v1/tools use multipart/form-data because they work with uploaded files.

Where to Use This #

This request can be sent from secure server-side environments such as:

  • backend applications
  • scripts
  • automation workflows
  • serverless functions
  • other systems that can make authenticated HTTP requests securely.

Because the API key is sensitive, it should not be exposed in public client-side code.

Next Steps #

After this first request, the natural next steps are:

  • rendering HTML to PDF with /v1/h2i
  • processing uploaded images with /v1/image
  • working with PDF files through /v1/pdf
  • using /v1/tools for analysis-oriented tasks.

Summary #

Your first Davix H2I request can be a simple HTML-to-image render using POST /v1/h2i. You send authenticated JSON containing the HTML to render, the H2I engine (PixLab) performs the processing, and the platform returns a success response containing a signed output URL and request identifier.

Was it helpful ?
Scroll to Top