---
title: "Create or update listing with smart Integrazu integration"
method: POST
path: "/api/listings/save"
tags: ["Listings - Admin"]
---

# Create or update listing with smart Integrazu integration

`POST /api/listings/save`

Unified save endpoint that:
1. IF listing_id is null: Creates new listing in ViaturasEasyDataGreen
   IF listing_id is provided: Updates existing listing
2. IF brands with platforms are provided:
   - Checks existing Integrazu state
   - Decides whether to start a job or send direct update
3. IF website_ids are provided:
   - Creates Z_WebsiteExports records

Decision Logic for Integrazu:
- No advert exists -> Start job (create + photos + publish)
- Advert exists + new platforms -> Start job (publish only)
- Advert exists + all platforms synced -> Direct PUT update (no job)

Args:
    request_body: ListingSaveRequest with listing_id (optional), listing_data, brands, website_ids, image_urls

Returns:
    ListingSaveResponse with results per brand

## Headers

- `x-api-token` string, nullable

## Request body

- ListingSaveRequest — Request body for POST /listings/save If listing_id is provided, updates existing listing. If listing_id is null/None, creates a new listing. Optionally handles Integrazu integration for brands with platforms.
  - `listing_id` integer, nullable — ViaturasEasyDataGreen.ID - if null, creates new listing
  - `vehicle_id` integer, nullable — Viatura.ID - used when creating new listing from vehicle
  - `listing_data` object, required — Listing data matching ViaturasEasyDataGreen columns
  - `brands` BrandExportConfig[], nullable — List of brands with platforms to publish to. If empty/None, no Integrazu processing.
    - `brand_id` integer, required — Z_Brands.id for Integrazu token lookup
    - `platforms` string[], required — List of platforms to publish to (e.g., 'carmine', 'standvirtual')
    - `website_ids` integer[], nullable — List of website IDs this brand exports to
    - `renew` boolean — If True, auto-renew on platforms. Stored in Z_PortalExports.renew
    - `export_olx_through_standvirtual` boolean, nullable — If true, promote OLX via StandVirtual after publishing
  - `website_ids` integer[], nullable — List of Websites.id to export listing to (Z_WebsiteExports)
  - `image_urls` string[], nullable — List of image URLs to upload to Integrazu

## Response `200`

Successful Response

- ListingSaveResponse — Response for PUT /listings/{listing_id}/save
  - `listing_id` integer, required
  - `listing_saved` boolean, required
  - `integrazu` IntegrazuResult — Aggregated result of Integrazu operations.
    - `brands` BrandActionResult[], required
      - `brand_id` integer, required
      - `action` string, required
      - `reason` string, required
      - `job_id` integer, nullable
      - `error` string, nullable
      - `platforms_to_publish` string[], nullable
      - `platforms_to_unpublish` string[], nullable
  - `website_exports_created` integer, nullable
  - `website_exports_removed` integer, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/multigest/apis/multigest-protected-api.md) · [All operations](https://skmtc.dev/multigest/apis/multigest-protected-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/multigest/multigest-protected-api/revisions/4b44eb76b3ee/schema)
