---
agentTools:
  projectIndex: https://preemo.readme.io/llms.txt
---

# PDF extraction

Extracts content from the PDF.

# OpenAPI definition

```json
{
  "externalDocs": {
    "description": "Gradient AI documentation",
    "url": "https://docs.gradient.ai"
  },
  "info": {
    "contact": {
      "email": "support@gradient.ai",
      "name": "Gradient AI Support",
      "url": "https://docs.gradient.ai/discuss"
    },
    "description": "Interface for interacting with Gradient AI.",
    "title": "Gradient AI API",
    "version": "1.0.0"
  },
  "openapi": "3.0.3",
  "security": [
    {
      "AccessToken": []
    }
  ],
  "servers": [
    {
      "description": "Production endpoint",
      "url": "https://api.gradient.ai/api"
    },
    {
      "url": "http://localhost:3026/api"
    }
  ],
  "x-readme": {
    "samples-languages": [
      "curl",
      "python",
      "node"
    ],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "components": {
    "securitySchemes": {
      "AccessToken": {
        "scheme": "bearer",
        "type": "http"
      }
    },
    "schemas": {
      "ExtractPdfSuccess": {
        "type": "object",
        "properties": {
          "pages": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "images": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "data": {
                        "type": "string"
                      },
                      "format": {
                        "type": "string",
                        "enum": [
                          "base64-png"
                        ]
                      }
                    },
                    "required": [
                      "data",
                      "format"
                    ]
                  }
                },
                "pageNumber": {
                  "type": "integer",
                  "minimum": 0,
                  "exclusiveMinimum": true
                },
                "tables": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "tableRows": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "cells": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "cellValue": {
                                    "type": "string"
                                  },
                                  "colSpan": {
                                    "type": "integer",
                                    "nullable": true,
                                    "minimum": 0,
                                    "exclusiveMinimum": true
                                  },
                                  "rowSpan": {
                                    "type": "integer",
                                    "nullable": true,
                                    "minimum": 0,
                                    "exclusiveMinimum": true
                                  }
                                },
                                "required": [
                                  "cellValue",
                                  "colSpan",
                                  "rowSpan"
                                ]
                              }
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "table_data_row",
                                "table_header"
                              ]
                            }
                          },
                          "required": [
                            "cells",
                            "type"
                          ]
                        }
                      }
                    },
                    "required": [
                      "name",
                      "tableRows"
                    ]
                  }
                },
                "text": {
                  "type": "string"
                },
                "textBlocks": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "kind": {
                        "type": "string",
                        "enum": [
                          "footer",
                          "header",
                          "section_title",
                          "text",
                          "title"
                        ]
                      },
                      "texts": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "kind",
                      "texts"
                    ]
                  }
                }
              },
              "required": [
                "images",
                "pageNumber",
                "tables",
                "text",
                "textBlocks"
              ]
            }
          },
          "text": {
            "type": "string"
          },
          "title": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "pages",
          "text",
          "title"
        ]
      },
      "ExtractPdfError": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "minLength": 1
          }
        },
        "required": [
          "message"
        ]
      },
      "ExtractPdfBodyParams": {
        "type": "object",
        "properties": {
          "file": {
            "type": "string",
            "format": "binary"
          }
        },
        "required": [
          "file"
        ]
      }
    }
  },
  "paths": {
    "/blocks/extract-pdf": {
      "post": {
        "description": "Extracts content from the PDF.",
        "operationId": "ExtractPdf",
        "summary": "PDF extraction",
        "tags": [
          "Blocks"
        ],
        "parameters": [
          {
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true,
            "name": "x-gradient-workspace-id",
            "in": "header"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ExtractPdfBodyParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExtractPdfSuccess"
                }
              }
            }
          },
          "4XX": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExtractPdfError"
                }
              }
            }
          }
        }
      }
    }
  },
  "_id": {
    "buffer": {
      "0": 100,
      "1": 201,
      "2": 83,
      "3": 144,
      "4": 228,
      "5": 32,
      "6": 103,
      "7": 0,
      "8": 117,
      "9": 236,
      "10": 84,
      "11": 142
    }
  }
}
```