Free plan

Attachments

See, add, take out or remove files hidden inside a PDF
POST
/v1/pdfs/attachments

About this tool

A PDF can carry other files inside it, a bit like attachments in an e-mail. This tool can list those files, add a new one, take one out so you can download it, or remove one. To take out or remove a file, use its key from the list. To add a file, you also upload the file to attach.
For example, you pull out the invoice data file that is attached to a PDF invoice.

How to use it

  1. Choose this tool.
  2. Add your PDF with Upload or drag and drop.
  3. Choose what to do: list, add, extract or remove.
  4. For add, upload the file to attach. For extract or remove, enter the key of the file.
  5. Press Generate, then download the result.

What you get back

You get a list of the attached files, the extracted file, or a new PDF with the change, depending on what you chose.
TEST IT LIVE

Try Attachments in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
PDFs
Plan
Free
Method
POST
Endpoint
/v1/pdfs/attachments
Tool ID
pdfs.attachments
Authentication
API key
Accepts
PDF
Background jobs
Yes
Usage group
Pdf
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/pdfs/attachments" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'operation=list' \
  -F 'output_bundle=zip' \
  -F 'response=url'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.pdfs.attachments({
    "file": 'document.pdf',
    "operation": "list",
    "output_bundle": "zip",
    "response": "url"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->pdfs()->attachments([
    'file' => 'document.pdf',
    'operation' => 'list',
    'output_bundle' => 'zip',
    'response' => 'url',
]);
echo $result->requestId;
FAQ

Frequently asked questions

See, add, take out or remove files hidden inside a PDF. It can do several jobs from one endpoint: operation, enum-field, items.

Attachments accepts PDF. You can send several files in one request.

Attachments is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/pdfs/attachments with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.