← HomeFleetPay / Schema

InboundCte

Structure preserved from the versioned API contract.

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

idstringRequired

CT-e access key; it is the resource's public identifier.

pattern"^\\d{44}$"
access_keystringRequired
pattern"^\\d{44}$"
numberinteger | nullOptional
seriesstring | nullOptional
modelstringRequired

Document model; always 57 for CT-e.

service_typeinteger | nullOptional

Source CT-e tpServ: 0 normal, 1 subcontracting, 2 onward carriage, 3 intermediate onward carriage, 4 service linked to multimodal transport (this does not allow a counter-CT-e).

service_type_labelstring | nullOptional

Human-readable service_type label, for example Normal, Subcontratação; null when the XML does not contain tpServ.

source_service_valuenumber | nullOptional

The issuer's vTPrest: a reference, never your price. The subcontracted leg's price is negotiated separately and is not represented by this XML.

nfe_access_keysarrayOptional

Keys of the NF-e documents covering the cargo carried under the source CT-e.

carrier_role_labelstringOptional
allows_counter_ctebooleanRequired

Whether this document allows you to issue a counter-CT-e. true only when carrier_role is subcontracted, no counter-CT-e has yet been generated from the document, and the source service type permits it (a CT-e linked to multimodal transport, service_type 4, does not).

status_labelstringOptional
counter_cte_idstring | null · uuidOptional

UUID of the counter-CT-e generated from this document, when one exists.

originstringRequired

How the document was received. api means delivery from your system.

received_countintegerRequired

Number of times this same document has been delivered.

minimum1
first_received_atstring | null · date-timeOptional
last_received_atstring | null · date-timeOptional
addressesobjectOptional

Full addresses of the parties. Only available when querying by access key.

Original JSON Definition (Portuguese Descriptions)
{
  "type": "object",
  "required": [
    "id",
    "access_key",
    "model",
    "issuer",
    "carrier_role",
    "allows_counter_cte",
    "status",
    "origin",
    "received_count"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^\\d{44}$",
      "description": "Chave de acesso do CT-e; é o identificador público do recurso."
    },
    "access_key": {
      "type": "string",
      "pattern": "^\\d{44}$"
    },
    "number": {
      "type": [
        "integer",
        "null"
      ]
    },
    "series": {
      "type": [
        "string",
        "null"
      ]
    },
    "model": {
      "type": "string",
      "description": "Modelo do documento; sempre `57` para CT-e."
    },
    "service_type": {
      "type": [
        "integer",
        "null"
      ],
      "description": "`tpServ` do CT-e de origem: 0 normal, 1 subcontratação, 2 redespacho, 3 redespacho\nintermediário, 4 serviço vinculado a multimodal (este não admite contra-CT-e).\n"
    },
    "service_type_label": {
      "type": [
        "string",
        "null"
      ],
      "description": "Rótulo legível do `service_type` — ex.: `Normal`, `Subcontratação`; `null` quando o XML\nnão traz `tpServ`.\n"
    },
    "issuer": {
      "$ref": "#/components/schemas/InboundCteParty"
    },
    "sender": {
      "$ref": "#/components/schemas/InboundCteParty"
    },
    "recipient": {
      "$ref": "#/components/schemas/InboundCteParty"
    },
    "cargo": {
      "$ref": "#/components/schemas/InboundCteCargo"
    },
    "source_service_value": {
      "type": [
        "number",
        "null"
      ],
      "description": "O `vTPrest` de quem emitiu — **referência, nunca o seu preço**. O valor do trecho\nsubcontratado é negociação que este XML não presenciou.\n"
    },
    "nfe_access_keys": {
      "type": "array",
      "description": "Chaves das NF-e que o CT-e de origem transporta.",
      "items": {
        "type": "string",
        "pattern": "^\\d{44}$"
      }
    },
    "carrier_role": {
      "$ref": "#/components/schemas/InboundCteCarrierRole"
    },
    "carrier_role_label": {
      "type": "string"
    },
    "allows_counter_cte": {
      "type": "boolean",
      "description": "Se este documento admite um contra-CT-e seu. `true` apenas quando `carrier_role` é\n`subcontracted`, o documento ainda não originou contra-CT-e e o tipo de serviço da\norigem o admite (um CT-e vinculado a multimodal, `service_type` 4, não admite).\n"
    },
    "status": {
      "$ref": "#/components/schemas/InboundCteStatus"
    },
    "status_label": {
      "type": "string"
    },
    "counter_cte_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "UUID do contra-CT-e que este documento originou, quando já houver um."
    },
    "origin": {
      "type": "string",
      "description": "Por qual porta o documento entrou. `api` é a entrega pelo seu sistema."
    },
    "received_count": {
      "type": "integer",
      "minimum": 1,
      "description": "Quantas vezes este mesmo documento foi entregue."
    },
    "first_received_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "last_received_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "addresses": {
      "type": "object",
      "description": "Endereços completos das partes. Só na consulta por chave.",
      "properties": {
        "issuer": {
          "$ref": "#/components/schemas/InboundCteAddress"
        },
        "sender": {
          "$ref": "#/components/schemas/InboundCteAddress"
        },
        "recipient": {
          "$ref": "#/components/schemas/InboundCteAddress"
        }
      }
    }
  }
}