Logo Parsio Knowledge Base
  1. Overview
  2. Public API
  3. Parse PDF and Files Using API

Parse PDF and Files Using API

In this article we'll see how to upload PDF and other files using Parsio API.

Related articles:

Authentication

To access the API, you will need the API key that you will find in your account:

This API key should be included in the X-API-Key HTTP header.

Unauthenticated responses will return in a HTTP 401 Unauthorized code.

Here's a request example using cURL:

curl -X GET https://api.parsio.io/mailboxes/ -H "X-API-Key: <YOUR_API_KEY>"

How to parse PDFs and files using Parsio API

API Endpont: POST https://api.parsio.io/mailboxes/<mailbox_id>/upload

Parameters:

  • file: Binary file object

Supported formats: PDF, HTML, CSV, TXT, DOCX, RTF or XML

Max. file size: 20MB

Request example

CURL:

curl \
-X POST \
https://api.parsio.io/mailboxes/<YOUR_MAILBOX_ID>/upload \
-F 'file=@./receipt.pdf' \
-H "X-API-Key: <YOUR_API_KEY>"

PHP:

<?php

$apikey = '<API_KEY>';
$url = 'https://api.parsio.io/mailboxes/<MAILBOX_ID>/upload';
$filepath = './invoice.pdf';

$curl = curl_init();

curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'X-API-Key: ' . $apikey
));
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, array(
    'file' => curl_file_create($filepath, 'application/pdf', 'invoice.pdf')
));

$response = curl_exec($curl);
curl_close($curl);

echo $response;

Was this article helpful?