> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gohusky.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Cotação de entrega

> Verifica a disponibilidade de veículos e calcula os preços de entrega para uma rota específica.

Este endpoint permite verificar se há veículos disponíveis para realizar uma entrega e obter informações sobre os preços antes de criar uma nova solicitação de entrega.

**Informações retornadas:**

* Preço de entrega calculado
* Veículos disponíveis e seus tipos
* Quantidade total de veículos disponíveis


## OpenAPI

````yaml POST /v1/logistics/availability
openapi: 3.1.0
info:
  title: API Módulo Logístico
  description: >
    API para integração com o módulo logístico do OpenDelivery.


    Esta API utiliza autenticação OAuth 2.0 com o fluxo Client Credentials para
    obter tokens de acesso.

    Todos os endpoints protegidos requerem o token de acesso no header
    Authorization.
  version: 1.2.0
  contact:
    name: Suporte OpenDelivery
servers:
  - url: https://opendelivery.gohusky.net/logistic
    description: Servidor de produção
  - url: https://sandbox.opendelivery.gohusky.net/logistic
    description: Servidor Homologação
security: []
tags:
  - name: Autenticação
    description: Endpoints relacionados à autenticação e obtenção de tokens de acesso
  - name: Entregas
    description: Endpoints relacionados à gestão de entregas e pedidos logísticos
paths:
  /v1/logistics/availability:
    post:
      tags:
        - Entregas
      summary: Verificar disponibilidade e preços de entrega
      description: >-
        Verifica a disponibilidade de veículos e calcula os preços de entrega
        para uma rota específica.
      operationId: checkDeliveryAvailability
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckAvailabilityRequest'
            examples:
              basic_check:
                summary: Verificação básica
                value:
                  merchant:
                    id: MERCHANT-001
                    name: Restaurante Exemplo
                  pickupAddress:
                    country: Brasil
                    state: SP
                    city: São Paulo
                    district: Centro
                    street: Rua Exemplo
                    number: '123'
                    postalCode: 01310-100
                    latitude: -23.5505
                    longitude: -46.6333
                  returnToMerchant: false
                  canCombine: false
                  deliveryAddress:
                    country: Brasil
                    state: SP
                    city: São Paulo
                    district: Pinheiros
                    street: Av. Exemplo
                    number: '456'
                    postalCode: 05433-000
                    latitude: -23.5675
                    longitude: -46.6925
                  vehicle:
                    type:
                      - MOTORBIKE_BAG
                    container: NORMAL
                    containerSize: null
                    instruction: null
                  limitTimes:
                    pickupLimit: 30
                    deliveryLimit: 60
                    orderCreatedAt: '2024-01-15T10:30:00.000Z'
                  totalOrderPrice:
                    value: 45.5
                    currency: BRL
                  orderDeliveryFee:
                    value: 8.5
                    currency: BRL
                  totalWeight: 500
                  packageVolume: 2000
                  packageQuantity: 1
                  specialInstructions: null
                  additionalPricePercentual: null
                  onlinePayment: true
      responses:
        '200':
          description: Disponibilidade e preços calculados com sucesso
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckAvailabilityResponse'
              examples:
                success:
                  summary: Resposta de sucesso
                  value:
                    deliveryPrice:
                      value: 8.5
                      currency: BRL
                    vehicles:
                      availableVehicles: 15
                      vehiclesAvailable:
                        type:
                          - MOTORBIKE_BAG
                          - CAR
                        container: NORMAL
        '400':
          description: Requisição inválida
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: Erro inesperado
                  value:
                    title: Erro inesperado.
                    status: 400
        '401':
          description: Não autorizado - Token inválido ou ausente
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    CheckAvailabilityRequest:
      type: object
      required:
        - pickupAddress
        - returnToMerchant
        - canCombine
        - deliveryAddress
        - vehicle
        - limitTimes
        - totalOrderPrice
        - totalWeight
      properties:
        merchant:
          $ref: '#/components/schemas/MerchantData'
        pickupAddress:
          $ref: '#/components/schemas/AddressData'
          description: Endereço de coleta do pedido.
        returnToMerchant:
          type: boolean
          description: >-
            Informa se o entregador deve retornar ao endereço de coleta após a
            entrega ter sido efetuada.
          example: false
        canCombine:
          type: boolean
          description: Se a entrega pode ser combinada com outras
          example: false
        deliveryAddress:
          $ref: '#/components/schemas/AddressData'
          description: Endereço de entrega do pedido.
        vehicle:
          $ref: '#/components/schemas/VehicleData'
        limitTimes:
          $ref: '#/components/schemas/LimitTimesData'
        totalOrderPrice:
          $ref: '#/components/schemas/PriceData'
        orderDeliveryFee:
          $ref: '#/components/schemas/PriceData'
        totalWeight:
          type: integer
          description: Peso total do pedido em gramas
          minimum: 0
          example: 500
        packageVolume:
          type: integer
          description: Volume do pacote em centímetros cúbicos
          minimum: 0
          example: 2000
        packageQuantity:
          type: integer
          description: Quantidade de pacotes
          minimum: 1
          example: 1
        specialInstructions:
          type: string
          description: Instruções especiais para a entrega
          example: Produto frágil
        additionalPricePercentual:
          type: number
          format: float
          description: Percentual adicional no preço (0-100)
          minimum: 0
          maximum: 100
          example: 10.5
        onlinePayment:
          type: boolean
          description: Se o pagamento é online
          example: true
    CheckAvailabilityResponse:
      type: object
      required:
        - deliveryPrice
        - vehicles
      properties:
        deliveryPrice:
          $ref: '#/components/schemas/PriceData'
        vehicles:
          type: object
          required:
            - availableVehicles
            - vehiclesAvailable
          properties:
            availableVehicles:
              type: integer
              description: Quantidade total de veículos disponíveis
              minimum: 0
              example: 15
            vehiclesAvailable:
              type: object
              required:
                - type
                - container
              properties:
                type:
                  type: array
                  description: Tipos de veículos disponíveis
                  items:
                    type: string
                    enum:
                      - MOTORBIKE_BAG
                      - MOTORBIKE_BOX
                      - CAR
                      - BICYCLE
                      - SCOOTER
                      - VUC
                  example:
                    - MOTORBIKE_BAG
                    - CAR
                container:
                  type: string
                  enum:
                    - NORMAL
                    - THERMIC
                  description: Tipo de container disponível
                  example: NORMAL
    ErrorResponse:
      type: object
      required:
        - title
        - status
      properties:
        title:
          type: string
          description: Mensagem de erro descritiva
          example: Não autorizado
        status:
          type: integer
          description: Código de status HTTP
          example: 401
    MerchantData:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: string
          description: Identificador único do merchant
          example: MERCHANT-001
        name:
          type: string
          description: Nome do merchant
          example: Restaurante Exemplo
    AddressData:
      type: object
      required:
        - country
        - state
        - city
        - district
        - street
        - number
      properties:
        country:
          type: string
          description: País (sigla). Padrão ISO 3166-1.
          minLength: 2
          maxLength: 2
          exclusiveMinimum: true
          example: BR
        state:
          type: string
          description: Estado (sigla). Padrão ISO 3166-2.
          example: SP
        city:
          type: string
          description: Cidade
          example: São Paulo
        district:
          type: string
          description: Bairro
          example: Centro
        street:
          type: string
          description: Rua
          example: Rua Exemplo
        number:
          type: string
          description: Número
          example: '123'
        postalCode:
          type: string
          description: CEP
          example: 01310-100
        complement:
          type: string
          description: Complemento
          example: Apto 45
        reference:
          type: string
          description: Ponto de referência
          example: Próximo ao metrô
        latitude:
          type: number
          format: float
          description: Latitude do endereço
          example: -23.5505
        longitude:
          type: number
          format: float
          description: Longitude do endereço
          example: -46.6333
        pickupLocation:
          type: string
          description: Local de coleta específico
          example: Balcão
        parkingSpace:
          type: boolean
          description: Se há espaço para estacionamento
          example: true
        instructions:
          type: string
          description: Instruções específicas para o endereço
          example: Entregar na recepção
    VehicleData:
      allOf:
        - $ref: '#/components/schemas/VehicleRequiredData'
      properties:
        containerSize:
          type: string
          enum:
            - SMALL
            - MEDIUM
            - LARGE
            - EXTRA_LARGE
          description: Tamanho do container (opcional, apenas para container térmico)
          example: MEDIUM
        instruction:
          type: string
          description: Instruções específicas sobre o veículo/container
          example: Manter refrigerado
    LimitTimesData:
      type: object
      properties:
        pickupLimit:
          type: integer
          description: Tempo limite para coleta em minutos
          minimum: 0
          example: 30
        deliveryLimit:
          type: integer
          description: Tempo limite para entrega em minutos
          minimum: 0
          example: 60
        orderCreatedAt:
          type: string
          format: date-time
          description: Data e hora de criação do pedido (ISO 8601)
          example: '2024-01-15T10:30:00.000Z'
    PriceData:
      type: object
      required:
        - value
        - currency
      properties:
        value:
          type: number
          format: float
          description: Valor monetário
          minimum: 0
          example: 45.5
        currency:
          type: string
          enum:
            - BRL
            - USD
            - EUR
          description: Moeda. Padrão ISO 4217.
          minLength: 3
          maxLength: 3
          exclusiveMinimum: true
          example: BRL
    VehicleRequiredData:
      type: object
      required:
        - type
        - container
      properties:
        type:
          type: array
          description: Tipos de veículo aceitos para a entrega
          items:
            type: string
            enum:
              - MOTORBIKE_BAG
              - MOTORBIKE_BOX
              - CAR
              - BICYCLE
              - SCOOTER
              - VUC
          minItems: 1
          example:
            - MOTORBIKE_BAG
        container:
          type: string
          enum:
            - NORMAL
            - THERMIC
          description: Tipo de container necessário
          example: NORMAL
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >
        Token de acesso OAuth 2.0 obtido através do endpoint `/oauth/token`.


        Use o formato: `Authorization: Bearer {access_token}`


        O token deve ser incluído em todas as requisições aos endpoints
        protegidos.

````