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

# Convert to PDF

> Convert URLs or uploads into PDF documents using DumplingAI's conversion pipeline.

## Description

This endpoint converts various document formats to PDF. It supports a wide range of input formats including office documents, images, and web formats.

## Endpoint

```
POST https://app.dumplingai.com/api/v1/convert-to-pdf
```

## Headers

* **Content-Type:** `application/json`
* **Authorization:** Bearer `<API_KEY>` (required)

## Request Body

```json theme={null}
{
  "inputMethod": "string", // Required. Either "url" or "base64"
  "file": "string" // Required. URL or base64-encoded file content
}
```

## Responses

### Success (200)

Returns the URL of the converted PDF.

```json theme={null}
{
  "url": "string" // URL to the converted PDF file
}
```

* **X-RateLimit-Limit:** The rate limit for the user.
* **X-RateLimit-Remaining:** The remaining number of requests for the user.

### Bad Request (400)

Returned if the request is invalid or the file format is unsupported.

```json theme={null}
{
  "error": "Error message describing the issue"
}
```

### Internal Server Error (500)

Returned if there's an error during the conversion process.

```json theme={null}
{
  "error": "Failed to convert to PDF: [error details]"
}
```

## Example Request

```bash theme={null}
curl -X POST https://app.dumplingai.com/api/v1/convert-to-pdf \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
  "inputMethod": "url",
  "file": "https://example.com/document.docx"
}'
```

## Notes

* Credit usage: 50 credits per 100MB of output PDF size
* The converted PDF is temporarily stored (24-hour retention)
* You can get a list of supported formats by calling:

```
GET /api/v1/convert-to-pdf
```

## Supported Formats

".123",
".602",
".abw",
".bib",
".bmp",
".cdr",
".cgm",
".cmx",
".csv",
".cwk",
".dbf",
".dif",
".doc",
".docm",
".docx",
".dot",
".dotm",
".dotx",
".dxf",
".emf",
".eps",
".epub",
".fodg",
".fodp",
".fods",
".fodt",
".fopd",
".gif",
".htm",
".html",
".hwp",
".jpeg",
".jpg",
".key",
".ltx",
".lwp",
".mcw",
".met",
".mml",
".mw",
".numbers",
".odd",
".odg",
".odm",
".odp",
".ods",
".odt",
".otg",
".oth",
".otp",
".ots",
".ott",
".pages",
".pbm",
".pcd",
".pct",
".pcx",
".pdb",
".pgm",
".png",
".pot",
".potm",
".potx",
".ppm",
".pps",
".ppt",
".pptm",
".pptx",
".psd",
".psw",
".pub",
".pwp",
".pxl",
".ras",
".rtf",
".sda",
".sdc",
".sdd",
".sdp",
".sdw",
".sgl",
".slk",
".smf",
".stc",
".std",
".sti",
".stw",
".svg",
".svm",
".swf",
".sxc",
".sxd",
".sxg",
".sxi",
".sxm",
".sxw",
".tga",
".tif",
".tiff",
".txt",
".uof",
".uop",
".uos",
".uot",
".vdx",
".vor",
".vsd",
".vsdm",
".vsdx",
".webp",
".wb2",
".wk1",
".wks",
".wmf",
".wpd",
".wpg",
".wps",
".xbm",
".xhtml",
".xls",
".xlsb",
".xlsm",
".xlsx",
".xlt",
".xltm",
".xltx",
".xlw",
".xml",
".xpm",
".zabw",

## Rate Limiting

Rate limit headers (`X-RateLimit-Limit` and `X-RateLimit-Remaining`) are included in the response.


## OpenAPI

````yaml POST /api/v1/convert-to-pdf
openapi: 3.0.3
info:
  title: DumplingAI API
  version: 1.0.0
  description: >
    REST API for DumplingAI's content intelligence and automation platform.

    All endpoints are grouped under `/api/v1`; most are secured via Bearer API
    keys unless an operation explicitly sets `security: []`.
servers:
  - url: https://app.dumplingai.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: YouTube
    description: Access metadata, search results, and transcripts from YouTube.
  - name: TikTok
    description: Retrieve TikTok profile, video, follower, and transcript data.
  - name: LinkedIn
    description: Programmatically fetch LinkedIn company and profile data.
  - name: Search
    description: Search-orientated endpoints spanning web, news, maps, and autocomplete.
  - name: Google
    description: Integrations with Google business listings and location data.
  - name: Scraping
    description: Webpage capture, crawling, and structured content extraction utilities.
  - name: Documents
    description: Document processing, conversion, and metadata utilities.
  - name: AI
    description: DumplingAI agent and knowledge base endpoints.
  - name: Developer Tools
    description: Utilities for executing sandboxed code via API.
paths:
  /api/v1/convert-to-pdf:
    post:
      tags:
        - Documents
      summary: Convert to PDF
      description: >-
        Convert URLs or uploads into PDF documents using DumplingAI's conversion
        pipeline.
      operationId: convertToPdf
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConvertToPdfRequest'
            examples:
              default:
                value:
                  inputMethod: url
                  file: https://example.com/brochure.html
      responses:
        '200':
          description: PDF conversion job accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConvertToPdfResponse'
        '400':
          description: Invalid request payload.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Missing or invalid API key.
        '500':
          description: Unexpected server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ConvertToPdfRequest:
      type: object
      required:
        - inputMethod
        - file
      properties:
        inputMethod:
          $ref: '#/components/schemas/FileInputMethod'
        file:
          type: string
          description: Document URL or base64-encoded content to convert to PDF.
      additionalProperties: false
    ConvertToPdfResponse:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          description: Temporary download URL for the converted PDF.
      additionalProperties: false
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable description of what went wrong.
      required:
        - error
    FileInputMethod:
      type: string
      description: >-
        Indicates whether binary content is supplied via URL or base64-encoded
        string.
      enum:
        - url
        - base64
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````