loader

Filechips API Documentation

Overview

Filechips provides a powerful API that allows you to convert HTML documents to PDF format. This API is ideal for developers who need to generate PDFs from web pages, dynamic HTML content, or web applications.

Base URL

https://api.filechips.com/v1

Authentication

All requests to the Filechips API must be authenticated using an API key. You can obtain your API key by signing up on the Filechips website and navigating to the API section of your account settings.

Authorization: Bearer YOUR_API_KEY

Endpoints

Convert HTML to PDF

Request

URL: /convert/html-to-pdf

Method: POST

Headers:

  • Content-Type: application/json
  • Authorization: Bearer YOUR_API_KEY

Body Parameters

Parameter Type Required Description
html string Yes The HTML content to be converted into a PDF.
options object No Additional options for the PDF conversion (see below).

Options

Option Type Default Description
page_size string A4 The size of the PDF pages (e.g., A4, Letter).
orientation string portrait The orientation of the PDF pages (portrait or landscape).
margin_top number 10 The top margin of the pages in millimeters.
margin_bottom number 10 The bottom margin of the pages in millimeters.
margin_left number 10 The left margin of the pages in millimeters.
margin_right number 10 The right margin of the pages in millimeters.
header string null HTML content for the header of each page.
footer string null HTML content for the footer of each page.
timeout number 30 The timeout for the conversion process in seconds.

Example Request


{
    "html": "

Hello, World!

", "options": { "page_size": "A4", "orientation": "portrait", "margin_top": 20, "margin_bottom": 20 } }

Response

Field Type Description
status string The status of the conversion (success or error).
pdf_url string The URL to download the generated PDF file.
error string Error message (if any).

Example Response


{
    "status": "success",
    "pdf_url": "https://api.filechips.com/v1/download/pdf/12345"
}
                

Download PDF

Request

URL: /download/pdf/{pdf_id}

Method: GET

Headers:

  • Authorization: Bearer YOUR_API_KEY

Path Parameters

Parameter Type Required Description
pdf_id string Yes The ID of the PDF file to download.

Example Request


GET /download/pdf/12345
Authorization: Bearer YOUR_API_KEY
                

Response

The response will be the binary content of the PDF file. Set the appropriate headers to handle the PDF download in your application.

Error Handling

Filechips API uses standard HTTP status codes to indicate the success or failure of API requests. In addition, error messages are provided in the response body to help diagnose issues.

Common Error Codes

Status Code Meaning Description
400 Bad Request The request was invalid or cannot be served.
401 Unauthorized Authentication failed or API key is missing.
403 Forbidden You do not have permission to access the resource.
404 Not Found The requested resource could not be found.
500 Internal Server Error An error occurred on the server.

Example Error Response


{
    "status": "error",
    "error": "Invalid API key"
}
            

Rate Limits

The Filechips API enforces rate limits to ensure fair usage. By default, you can make up to 100 requests per minute. If you exceed this limit, you will receive a 429 Too Many Requests response.

Support

For further assistance, please contact Filechips support at [email protected].