Skip to content

publish ​

Create a new listing from a JSON template file.

Usage ​

bash
willhaben publish <file> [options]

Arguments ​

ArgumentDescription
<file>Path to JSON template file

Options ​

OptionDescription
--draftSave as a draft without putting it live. Publish it later with willhaben activate <id>
--jsonOutput as JSON

How publishing works ​

  1. The listing is saved as a draft.
  2. The images from images are uploaded.
  3. The draft is put live, unless --draft is set.

If an image upload fails, the listing stays a draft and never goes live without its photos. The error message contains the draft ID.

Template Format ​

Required Fields ​

FieldTypeDescription
titlestringListing title (max 100 chars)
descriptionstringDetailed description
pricenumberPrice in EUR
postCodestringPostal code (e.g., "1010")
categoryPathstring[]Category path from root to leaf

Optional Fields ​

FieldTypeDescription
locationstringLocation name from locations. Needed if the postcode has several locations
locationIdnumberLocation id. Looked up from postCode and location if omitted
conditionstring"neu", "gebraucht", or "defekt"
deliverystring[]["PICKUP"], ["Versand"], or both
imagesstring[]Image files (jpg, png, gif, webp), relative to the template file. The first one is the cover image
attributesobjectCategory-specific attributes

Example Template ​

Create my-item.json:

json
{
  "title": "iPhone 14 Pro - Excellent Condition",
  "description": "Selling my iPhone 14 Pro 256GB in excellent condition. Always used with a case and screen protector.",
  "price": 799,
  "postCode": "1010",
  "categoryPath": ["MOBILE_ELECTRONICS", "MOBILE_PHONES", "IPHONE"],
  "condition": "gebraucht",
  "delivery": ["PICKUP", "Versand"],
  "images": ["front.jpg", "back.jpg"]
}

Then publish:

bash
willhaben publish my-item.json
# ✔ Listing published successfully!
#   ID: 123456789
#   Title: iPhone 14 Pro - Excellent Condition
#   Price: € 799
#   Images: 2

Or save it as a draft first, check it in the willhaben app, and put it live afterwards:

bash
willhaben publish my-item.json --draft
willhaben activate 123456789

Category Examples ​

Electronics - Printer
json
{
  "title": "HP LaserJet Pro - wie neu",
  "description": "Verkaufe meinen HP LaserJet Pro Drucker...",
  "price": 120,
  "postCode": "8010",
  "location": "Graz",
  "categoryPath": [
    "COMPUTER_SOFTWARE",
    "PRINTER_MONITORS_SPEAKER",
    "PRINTER",
    "LASER_PRINTER"
  ],
  "condition": "gebraucht",
  "delivery": ["PICKUP", "Versand"],
  "attributes": {
    "BRAND_PRINTER": "HP"
  }
}
Books
json
{
  "title": "Clean Code - Robert C. Martin",
  "description": "Buch in sehr gutem Zustand...",
  "price": 15,
  "postCode": "5020",
  "categoryPath": [
    "BOOKSFILMANDMUSIC",
    "NON_FICTION_BOOKS"
  ],
  "condition": "gebraucht",
  "delivery": ["Versand"]
}

Common Location IDs ​

CityLocation ID
Wien900
Graz117458
Salzburg30501
Linz40101
Innsbruck70101

Requires Authentication ​

You must be logged in to use this command.

Released under the MIT License. Not affiliated with willhaben.