SWAP Barcode Injector API Documentation

Endpoint (file upload): POST /inject
Description: Upload a shipping label (PDF or GIF for UPS Saver US) and inject extra content (text and barcode) at the bottom or inside the label. Returns a new PDF.

Parameters

Example curl Usage

curl -X POST https://barcodeinjector.mikeilin.com/inject \
  -F "file=@your_label.pdf" \
  -F "barcode_text=CK-2618777-UK" \
  -F "placement=inside" \
  -F "type=fedex" \
  --output output.pdf
        

Endpoint (URL upload): POST /injecturl
Description: Provide a publicly accessible file URL instead of uploading a file. The server downloads the file in-memory only and applies the same processing as /inject. No source file is persisted on the server.

Parameters

Example curl Usage

curl -X POST https://barcodeinjector.mikeilin.com/injecturl \
  -H "Content-Type: application/json" \
  -d '{
    "file_url": "https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20250808/e805df5f33b27b468db70ea6827c13fbd9.pdf",
    "barcode_text": "CK-2618777-UK",
    "placement": "outside",
    "type": "fedex"
  }' \
  --output output.pdf
        

Endpoint (base64 image): POST /injectb64
Description: Provide an image as base64 in the payload. Designed for type=upssaverus and behaves like the GIF flow: rotates 90° clockwise, centers on A4 at 110mm width, puts text and barcode beneath, and draws a border around the block. Input is processed in-memory only.

Parameters

Example curl Usage

curl -X POST https://barcodeinjector.mikeilin.com/injectb64 \
  -H "Content-Type: application/json" \
  -d '{
    "image_b64": "PASTE_BASE64_HERE",
    "barcode_text": "CK-2618777-UK",
    "placement": "outside",
    "type": "upssaverus"
  }' \
  --output output.pdf
        

Example (base64 response):

curl -X POST https://barcodeinjector.mikeilin.com/injectb64 \
  -H "Content-Type: application/json" \
  -d '{
    "image_b64": "PASTE_BASE64_HERE",
    "barcode_text": "CK-2618777-UK",
    "placement": "outside",
    "type": "upssaverus",
    "response_b64": true
  }'
        

Response

Barcode Injector Test

Barcode Injector Test (via URL)

Barcode Injector Test (base64 image)