← HomeFleetPay / API

Review demand schedule and synchronize with the central offer service

Parameters, data structure and responses from the versioned contract.

POST/embarcador/solicitacoes-transporte/{id}/revisar-demanda
revisarDemandaSolicitacaoTransporteEmbarcadorSandbox Base: https://api.fleetpay.site/v1

Technical descriptions are translated from the versioned contract. Original identifiers and JSON are preserved; data examples are omitted.

Integrates demand revisions received via API, file or UI with the central offer dispatch schedule in Offers & Negotiations Management, distinguishing:

  • Demand addition (demand_revision_mode: complement): adds extra deliveries and/or slots to the active schedule and increments demand_version.
  • Total replacement (demand_revision_mode: total_revision): replaces planned window/shift totals. If reduced below the number of executors with active acceptance/allocation, it never silently cancels accepted work: it preserves active allocations and flags reduction_after_acceptance = true and cancellation_requested_after_acceptance = true for explicit handling.
  • Incorporation into same work unit (demand_revision_mode: incorporate_into_work_unit): appends deliveries to an already-accepted day-rate/shift (work_unit_key) without opening new slots and without creating a duplicate day-rate (ShipperManagedOperation) for the same driver/shift.
  • Replay idempotency: resending the exact same revision payload for the same state returns 200 with data.demand_offer_integration.idempotent_replay = true without incrementing demand_version.
  • Optimistic concurrency control: if expected_demand_version differs from the schedule's current version, returns 409 DEMAND_VERSION_CONFLICT.
  • Explicit deliveries-to-slots rule: when deliveries_count is supplied without required_vacancies_count, requires a positive deliveries_per_driver_rule (422 DELIVERIES_TO_DRIVERS_RULE_REQUIRED).

Authentication

Required Scope
operacao — Operations
Module
Direct Contracting (Shipper)
Target Profiles
Shipper · Transport Manager · Dedicated Fleet Contractor
Schemes
OAuth2 client_credentials (POST /oauth/token) or API Key via Authorization: Bearer / X-Api-Key
[
  {
    "oauth2": []
  },
  {
    "chaveApi": []
  }
]
Availability depends on the environment, enabled scopes and provider. This reference does not execute requests or collect credentials.

Parameters

idpath · stringRequired
Constraints
{
  "type": "string"
}

Request Body

Required

application/json

demand_revision_modestringOptional

complement adds deliveries/vacancies; total_revision replaces the window's planned total without silently cancelling active acceptances; incorporate_into_work_unit incorporates deliveries into the same day-rate/shift without generating duplicate day-rate.

"complement" · "total_revision" · "incorporate_into_work_unit"
expected_demand_versioninteger | nullOptional

Expected current version of the demand schedule for concurrency control (409 DEMAND_VERSION_CONFLICT if mismatched).

demand_schedule_typestring | nullOptional
"variable" · "fixed_scheduled" · "mixed" · null
operational_base_codestring | nullOptional
window_shift_codestring | nullOptional
deliveries_countinteger | nullOptional
minimum0
required_vacancies_countinteger | nullOptional
minimum0
deliveries_per_driver_ruleinteger | nullOptional

Explicit conversion rule from delivery count to vacancies/drivers when required_vacancies_count is not provided directly.

minimum1
work_unit_keystring | nullOptional

Responses

200 HTTP Response

Demand schedule synchronized (or idempotent replay recognized)

application/json

successbooleanOptional
commercial_resolutionobject | nullOptional
404 HTTP Response

Request not found

application/json

errorobjectOptional
409 HTTP Response

Concurrent demand schedule version conflict (DEMAND_VERSION_CONFLICT)

application/json

errorobjectOptional
422 HTTP Response

Missing explicit deliveries-to-drivers conversion rule (DELIVERIES_TO_DRIVERS_RULE_REQUIRED) or invalid parameters

application/json

errorobjectOptional
Complete Operation Definition
{
  "tags": [
    "Solicitações e Contratação de Transporte (Embarcador)"
  ],
  "summary": "Revisar programação de demanda e sincronizar com o serviço central de ofertas",
  "description": "Integra alterações de demanda recebidas por API, arquivo ou interface com a programação central de envio de ofertas da sessão **Gestão de Ofertas e Negociações**, diferenciando:\n- **Acréscimo de demanda (`demand_revision_mode: complement`)**: soma entregas e/ou vagas adicionais à programação vigente e incrementa `demand_version`.\n- **Substituição do total (`demand_revision_mode: total_revision`)**: substitui os totais planejados da janela/turno. Se houver redução abaixo do número de executores já com aceite/alocação ativa, **não cancela silenciosamente** o trabalho já aceito: preserva as alocações ativas e sinaliza `reduction_after_acceptance = true` e `cancellation_requested_after_acceptance = true` para tratativa explícita.\n- **Incorporação à mesma unidade de trabalho (`demand_revision_mode: incorporate_into_work_unit`)**: adiciona entregas à diária/turno já aceito (`work_unit_key`) sem abrir novas vagas e **sem gerar diária duplicada** (`ShipperManagedOperation`) para o mesmo motorista/turno.\n- **Idempotência de reenvio**: reenviar o mesmo payload de revisão para o mesmo estado retorna `200` com `data.demand_offer_integration.idempotent_replay = true` sem incrementar `demand_version`.\n- **Controle de revisão concorrente**: se `expected_demand_version` divergir da versão atual da programação, responde `409 DEMAND_VERSION_CONFLICT`.\n- **Regra explícita entregas -> vagas**: quando `deliveries_count` é informado sem `required_vacancies_count`, exige `deliveries_per_driver_rule` positivo (`422 DELIVERIES_TO_DRIVERS_RULE_REQUIRED`).\n",
  "operationId": "revisarDemandaSolicitacaoTransporteEmbarcador",
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/RevisarDemandaSolicitacaoTransporteRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Programação de demanda sincronizada (ou replay idempotente reconhecido)",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SolicitacaoTransporteResponse"
          }
        }
      }
    },
    "404": {
      "description": "Solicitação não encontrada",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Erro"
          }
        }
      }
    },
    "409": {
      "description": "Conflito de versão concorrente da programação de demanda (`DEMAND_VERSION_CONFLICT`)",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Erro"
          }
        }
      }
    },
    "422": {
      "description": "Ausência de regra explícita de conversão entregas -> motoristas (`DELIVERIES_TO_DRIVERS_RULE_REQUIRED`) ou parâmetros inválidos",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Erro"
          }
        }
      }
    }
  },
  "x-fleetpay-scope": "operacao",
  "x-fleetpay-module": "contratacao-direta",
  "x-fleetpay-profiles": [
    "embarcador",
    "gestor",
    "agregado_empresarial"
  ],
  "method": "POST",
  "path": "/embarcador/solicitacoes-transporte/{id}/revisar-demanda"
}