ImportOS · Документація
Довідник API

POST /v1/deals/{id}/stage

Move a deal to another stage

Move a deal to another stage

Applies the transition through the deal state machine (required fields, automatic tasks, client notifications and the stage_changed event for webhooks). A blocked transition is 409 transition_blocked with missing[]. With dry_run=true nothing is changed and the response says what is missing and shows the client message preview. Supports Idempotency-Key. The key acts with the manager role: stages reserved for other roles (e.g. accountant, logistics) are blocked. Requires scope write:deals.

  • Автентифікація: заголовок Authorization: Bearer rv_live_... (API-ключі та scopes)
  • Потрібний scope: write:deals
Опис операції, параметрів і полів походить зі специфікації OpenAPI (openapi.json) і подається англійською, як у самому API.

Параметри

ПолеДеТипОбов’язк.Опис
idpathstring (uuid)такResource id (UUID).
dry_runquery"true" | "false"ніtrue: do not change anything, return what is missing and the client message preview (always 200).
idempotency-keyheaderstringніMakes a retry of this POST safe for 24 hours: the same key and body returns the stored response (Idempotent-Replay: true).

Тіло запиту

ПолеТипОбов’язк.Опис
notestring | nullні
fieldsobjectні
fields.vehicleobjectні
fields.vehicle.vinstring | nullні
fields.vehicle.makestring | nullні
fields.vehicle.modelstring | nullні
fields.vehicle.trimstring | nullні
fields.vehicle.yearinteger | nullні
fields.vehicle.body"sedan" | "hatchback" | "wagon" | "suv" | "crossover" | "coupe" | "convertible" | "minivan" | "van" | "pickup" | "truck" | "motorcycle" | "other" | nullні
fields.vehicle.fuel"petrol" | "diesel" | "hybrid" | "phev" | "ev" | "lpg" | "cng" | "hydrogen" | "other" | nullні
fields.vehicle.enginestring | nullні
fields.vehicle.engineCcinteger | nullні
fields.vehicle.powerKwinteger | nullні
fields.vehicle.gearbox"manual" | "automatic" | "cvt" | "robot" | "other" | nullні
fields.vehicle.mileageKminteger | nullні
fields.vehicle.colorstring | nullні
fields.vehicle.sourcestringні
fields.vehicle.sourceUrlstring | null (uri)ні
fields.vehicle.lotIdstring | nullні
fields.vehicle.titleStatus"clean" | "salvage" | "rebuilt" | "flood" | "junk" | "parts_only" | "certificate" | "unknown" | nullні
fields.itemsobject[]ні
fields.items[].idstring (uuid)ні
fields.items[].kind"lot_price" | "auction_fee" | "broker_fee" | "inland_us" | "ocean" | "port" | "inland_eu" | "customs_duty" | "excise" | "vat" | "broker_customs" | "certification" | "pension_fund" | "registration" | "repair" | "detailing" | "insurance" | "our_fee" | "other"ні
fields.items[].labelstring | nullні
fields.items[].plannednumber | string | nullні
fields.items[].actualnumber | string | nullні
fields.items[].currency"UAH" | "USD" | "EUR" | "PLN" | "GEL"ні
fields.items[].paidBy"client" | "company"ні
fields.items[].paidAtstring | null (date-time)ні
fields.items[].documentIdstring | null (uuid)ні
fields.items[].notestring | nullні
fields.items[].sortintegerні
fields.shipmentobjectні
fields.shipment.mode"container" | "roro" | "truck"ні
fields.shipment.carrierstring | nullні
fields.shipment.containerNostring | nullні
fields.shipment.billOfLadingstring | nullні
fields.shipment.bookingNostring | nullні
fields.shipment.vesselstring | nullні
fields.shipment.voyagestring | nullні
fields.shipment.portFromstring | nullні
fields.shipment.portTostring | nullні
fields.shipment.warehousestring | nullні
fields.shipment.etdstring | null (date-time)ні
fields.shipment.etastring | null (date-time)ні
fields.shipment.atdstring | null (date-time)ні
fields.shipment.atastring | null (date-time)ні
fields.shipment.pickupAtstring | null (date-time)ні
fields.shipment.deliveredAtstring | null (date-time)ні
fields.shipment.status"planned" | "booked" | "loaded" | "in_transit" | "at_port" | "discharged" | "released" | "delivered"ні
fields.customsobjectні
fields.customs.status"draft" | "documents_sent" | "declared" | "paid" | "cleared" | "rejected"ні
fields.customs.declarantstring | nullні
fields.customs.declarationNostring | nullні
fields.customs.dutynumber | string | nullні
fields.customs.excisenumber | string | nullні
fields.customs.vatnumber | string | nullні
fields.customs.pensionFundnumber | string | nullні
fields.customs.currency"UAH" | "USD" | "EUR" | "PLN" | "GEL"ні
fields.customs.paidAtstring | null (date-time)ні
fields.customs.clearedAtstring | null (date-time)ні
fields.customs.notesstring | nullні
fields.etaDeliverystring | null (date-time)ні
fields.route"sea" | "land"ні
fields.destinationCountrystring | nullні
fields.destinationCitystring | nullні
fields.lostReasonstring | nullні
attachmentsstring (uuid)[]ні
notifyClientbooleanні
messageOverridestring | nullні
channel"telegram" | "viber" | "email" | "sms" | "webhook" | "in_app"ні
to"lead" | "consult" | "contract_signed" | "deposit_paid" | "searching" | "bid_approved" | "won" | "paid_to_auction" | "pickup_scheduled" | "at_us_warehouse" | "loaded" | "in_transit_sea" | "at_eu_port" | "inland_to_border" | "customs_clearing" | "customs_cleared" | "certification" | "registration" | "ready_for_handover" | "handed_over" | "closed" | "lost" | "cancelled" | "on_hold" | "dispute"такTarget stage.

Відповіді

200

The transition was applied (or previewed with dry_run).

application/json · Схема: StageResult

ПолеТипОбов’язк.Опис
dryRunbooleanтак
appliedbooleanтакtrue: the deal was moved. false only for dry_run.
from"lead" | "consult" | "contract_signed" | "deposit_paid" | "searching" | "bid_approved" | "won" | "paid_to_auction" | "pickup_scheduled" | "at_us_warehouse" | "loaded" | "in_transit_sea" | "at_eu_port" | "inland_to_border" | "customs_clearing" | "customs_cleared" | "certification" | "registration" | "ready_for_handover" | "handed_over" | "closed" | "lost" | "cancelled" | "on_hold" | "dispute"так
to"lead" | "consult" | "contract_signed" | "deposit_paid" | "searching" | "bid_approved" | "won" | "paid_to_auction" | "pickup_scheduled" | "at_us_warehouse" | "loaded" | "in_transit_sea" | "at_eu_port" | "inland_to_border" | "customs_clearing" | "customs_cleared" | "certification" | "registration" | "ready_for_handover" | "handed_over" | "closed" | "lost" | "cancelled" | "on_hold" | "dispute"так
okbooleanтакThe transition is possible (always true when applied).
kindstring | nullтак
skipped"lead" | "consult" | "contract_signed" | "deposit_paid" | "searching" | "bid_approved" | "won" | "paid_to_auction" | "pickup_scheduled" | "at_us_warehouse" | "loaded" | "in_transit_sea" | "at_eu_port" | "inland_to_border" | "customs_clearing" | "customs_cleared" | "certification" | "registration" | "ready_for_handover" | "handed_over" | "closed" | "lost" | "cancelled" | "on_hold" | "dispute"[]такStages skipped on the way (e.g. sea stages for a land route).
missingstring[]так
reasonKeystring | nullтак
reasonRequiredbooleanтак
notificationsobject[]так
notifications[].eventstringні
notifications[].tostringні
taskIdsstring (uuid)[]так
clientMessageobjectтакPreview of the message the client gets (dry_run only).
clientMessage.channelstringтак
clientMessage.localestringтак
clientMessage.titlestring | nullтак
clientMessage.textstringтак
clientMessage.warningsstring[]так
dealobjectтакThe updated deal (null for dry_run).
deal.idstring (uuid)так
deal.numberstringтак
deal.status"lead" | "consult" | "contract_signed" | "deposit_paid" | "searching" | "bid_approved" | "won" | "paid_to_auction" | "pickup_scheduled" | "at_us_warehouse" | "loaded" | "in_transit_sea" | "at_eu_port" | "inland_to_border" | "customs_clearing" | "customs_cleared" | "certification" | "registration" | "ready_for_handover" | "handed_over" | "closed" | "lost" | "cancelled" | "on_hold" | "dispute"так
deal.pausedFrom"lead" | "consult" | "contract_signed" | "deposit_paid" | "searching" | "bid_approved" | "won" | "paid_to_auction" | "pickup_scheduled" | "at_us_warehouse" | "loaded" | "in_transit_sea" | "at_eu_port" | "inland_to_border" | "customs_clearing" | "customs_cleared" | "certification" | "registration" | "ready_for_handover" | "handed_over" | "closed" | "lost" | "cancelled" | "on_hold" | "dispute" | nullтак
deal.type"full_service" | "auction_only" | "logistics_only" | "resale"так
deal.route"sea" | "land"так
deal.currency"UAH" | "USD" | "EUR" | "PLN" | "GEL"так
deal.contactIdstring (uuid)так
deal.managerIdstring | null (uuid)так
deal.vehicleIdstring | null (uuid)так
deal.destinationCountrystring | nullтак
deal.destinationCitystring | nullтак
deal.etaDeliverystring | nullтакISO 8601 date-time (UTC).
deal.stageDatesobjectтакstage -> time of entering it.
deal.trackingTokenstring (uuid)такToken of the public tracking page (Track).
deal.trackingEnabledbooleanтак
deal.lostReasonstring | nullтак
deal.closedAtstring | nullтакISO 8601 date-time (UTC).
deal.createdAtstringтакISO 8601 date-time (UTC).
deal.updatedAtstringтакISO 8601 date-time (UTC).

400

Invalid request parameters or body (code validation_error).

application/problem+json · Схема: Problem

401

Missing, malformed, unknown, revoked or expired API key (code unauthorized).

application/problem+json · Схема: Problem

403

The API key lacks the scope required by this endpoint (code insufficient_scope).

application/problem+json · Схема: Problem

404

No such deal in this tenant.

application/problem+json · Схема: Problem

409

Conflict: duplicate contact (duplicate_ids), a request with this Idempotency-Key is still being processed, or the stage transition is blocked (missing[]).

application/problem+json · Схема: Problem

422

Well-formed but not acceptable data (unprocessable_input), or Idempotency-Key reused with a different request.

application/problem+json · Схема: Problem

429

Rate limit exceeded for the tenant plan (code rate_limited). Wait Retry-After seconds.

application/problem+json · Схема: Problem

На цій сторінці