{
  "openapi": "3.1.0",
  "info": {
    "title": "bitpdf API",
    "version": "1.0.0",
    "summary": "Free PDF merge, split and compress for agents and scripts.",
    "description": "No account and no API key. Each address gets 60 jobs an hour. A job carries up to 50 MiB and 20 files. Documents stay in RAM for the length of the job and are never written to disk.",
    "contact": {
      "name": "Bitnoda",
      "email": "hello@bitnoda.team",
      "url": "https://bitnoda.team"
    }
  },
  "servers": [
    {
      "url": "https://bitpdf.bitnoda.team"
    }
  ],
  "paths": {
    "/v1/merge": {
      "post": {
        "summary": "Merge PDFs into one",
        "operationId": "mergePdfs",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "binary"
                    },
                    "description": "Repeat the field once per PDF."
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "light",
                      "balanced",
                      "strong"
                    ],
                    "default": "balanced"
                  }
                },
                "required": [
                  "file"
                ]
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "files": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "description": "One PDF: a public https URL, or the file as base64.",
                      "properties": {
                        "url": {
                          "type": "string",
                          "format": "uri"
                        },
                        "base64": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    },
                    "minItems": 2,
                    "maxItems": 20
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "light",
                      "balanced",
                      "strong"
                    ],
                    "default": "balanced"
                  }
                },
                "required": [
                  "files"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A multipart request gets the file. A JSON request gets a download link.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/split": {
      "post": {
        "summary": "Pull page ranges out of a PDF",
        "operationId": "splitPdf",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "ranges": {
                    "type": "string",
                    "examples": [
                      "1-5,10-12,20"
                    ]
                  },
                  "together": {
                    "type": "boolean",
                    "default": false
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "light",
                      "balanced",
                      "strong"
                    ],
                    "default": "balanced"
                  }
                },
                "required": [
                  "file",
                  "ranges"
                ]
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "object",
                    "description": "One PDF: a public https URL, or the file as base64.",
                    "properties": {
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "base64": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  },
                  "ranges": {
                    "type": "string",
                    "examples": [
                      "1-5,10-12,20"
                    ]
                  },
                  "together": {
                    "type": "boolean",
                    "default": false
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "light",
                      "balanced",
                      "strong"
                    ],
                    "default": "balanced"
                  }
                },
                "required": [
                  "file",
                  "ranges"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A multipart request gets the file. A JSON request gets a download link.",
            "content": {
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/compress": {
      "post": {
        "summary": "Make a PDF smaller",
        "operationId": "compressPdf",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "light",
                      "balanced",
                      "strong"
                    ],
                    "default": "balanced"
                  }
                },
                "required": [
                  "file"
                ]
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "object",
                    "description": "One PDF: a public https URL, or the file as base64.",
                    "properties": {
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "base64": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  },
                  "level": {
                    "type": "string",
                    "enum": [
                      "light",
                      "balanced",
                      "strong"
                    ],
                    "default": "balanced"
                  }
                },
                "required": [
                  "file"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A multipart request gets the file. A JSON request gets a download link.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/info": {
      "post": {
        "summary": "Count the pages of a PDF",
        "operationId": "pdfInfo",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary"
                  }
                },
                "required": [
                  "file"
                ]
              }
            },
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "object",
                    "description": "One PDF: a public https URL, or the file as base64.",
                    "properties": {
                      "url": {
                        "type": "string",
                        "format": "uri"
                      },
                      "base64": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false
                  }
                },
                "required": [
                  "file"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A multipart request gets the file. A JSON request gets a download link.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/Error"
          },
          "413": {
            "$ref": "#/components/responses/Error"
          },
          "422": {
            "$ref": "#/components/responses/Error"
          },
          "429": {
            "$ref": "#/components/responses/Error"
          },
          "503": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    },
    "/v1/limits": {
      "get": {
        "summary": "Read the current limits",
        "operationId": "limits",
        "responses": {
          "200": {
            "description": "The limits, as numbers.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/v1/results/{token}": {
      "get": {
        "summary": "Download a result",
        "operationId": "downloadResult",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The file.",
            "content": {
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "application/zip": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/Error"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Result": {
        "type": "object",
        "properties": {
          "download_url": {
            "type": "string",
            "format": "uri"
          },
          "expires_at": {
            "type": "integer",
            "description": "Unix time when the link stops working."
          },
          "file_name": {
            "type": "string"
          },
          "mime_type": {
            "type": "string"
          },
          "pages": {
            "type": "integer"
          },
          "bytes_in": {
            "type": "integer"
          },
          "bytes_out": {
            "type": "integer"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ]
          }
        },
        "required": [
          "error"
        ]
      }
    },
    "responses": {
      "Error": {
        "description": "What went wrong.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    }
  }
}
