← HomeFleetPay / API

Submit a CT-e issued by your carrier

Parameters, data structure and responses from the versioned contract.

POST/fiscal/cte-emitidos
receiveEmittedCteSandbox Base: https://api.fleetpay.site/v1

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

Submits to FleetPay the XML of a CT-e issued by your own carrier. This brings the document into the platform's operational and financial workflow: service, delivery and receivable.

Purpose

Previously, this path depended on an external XML storage partner: our process fetched the document from that service. That process operates on a single CNPJ, so it serves only one company.

Here, your system submits the document, authenticated with your credentials. The document follows the same processing as before; only the delivery source changes.

Submission

Three forms are available, choose one:

  • application/json with the xml field: raw XML or base64. Encoding is detected from the content; no flag is required.
  • multipart/form-data with the arquivo field.

Accepts cteProc (with protocol) or raw CTe, up to 2 MB.

What FleetPay Reads from the XML

No additional payload is needed. FleetPay reads the access key, issue date, issuer (your carrier), freight service payer (using the toma code, whether sender, dispatcher, receiver, recipient or the toma4 group), route (origin and destination, including onward carriage), service amount and the transported NF-e access key.

Safe Resubmission

The operation is idempotent by access key. The first submission returns 201; subsequent submissions return 200 with first_reception: false and do not reprocess the document. Network retries and nightly reprocessing do not create duplicate services or errors.

Only Documents Issued by Your Carrier

cnpj_carrier is read from the XML emit group and must match the authenticated carrier. A CT-e from another company is rejected. The contracting carrier's CT-e, used as the source for your counter-CT-e, is submitted through POST /fiscal/cte-subcontratacao.

Authentication

[
  {
    "oauth2": []
  },
  {
    "chaveApi": []
  }
]
Availability depends on the environment, enabled scopes and provider. This reference does not execute requests or collect credentials.

Parameters

No parameters declared for this operation.

Request Body

Required

application/json

xmlstringRequired

CT-e XML, raw or base64-encoded. Accepts cteProc (with protocol) or CTe.

maxLength2097152

multipart/form-data

arquivostring · binaryRequired

CT-e XML, up to 2 MB.

Responses

200 HTTP Response

Document previously delivered. The operation is idempotent: nothing is reprocessed and first_reception is false.

application/json

Headers

X-Request-Id

Call correlation identifier.

201 HTTP Response

CT-e received for the first time and forwarded for processing.

application/json

Headers

X-Request-Id

Call correlation identifier.

400 HTTP Response

Invalid payload.

application/json

Headers

X-Request-Id

Call correlation identifier.

401 HTTP Response

FleetPay API key missing or invalid.

application/json

Headers

X-Request-Id

Call correlation identifier.

403 HTTP Response

Fiscal scope disabled for the key, or no active carrier associated with the key.

application/json

Headers

X-Request-Id

Call correlation identifier.

422 HTTP Response

Invalid payload, outstanding requirement or business rule.

application/json

Headers

X-Request-Id

Call correlation identifier.

429 HTTP Response

Per-carrier limit exceeded.

application/json

Headers

X-Request-Id

Call correlation identifier.

Retry-After

Seconds until another attempt.

500 HTTP Response

Internal failure without operational integration details.

application/json

Headers

X-Request-Id

Call correlation identifier.

Complete Operation Definition
{
  "tags": [
    "CT-e emitidos"
  ],
  "summary": "Entregar um CT-e emitido pela sua transportadora",
  "description": "Entrega à FleetPay o XML de um CT-e que a **sua própria transportadora emitiu**. É por\naqui que o documento entra no fluxo operacional e financeiro da plataforma: vira serviço,\nentrega e recebível.\n\n## Por que existe\n\nAté aqui esse caminho dependia de um parceiro externo de armazenamento de XML: um\nprocesso nosso ia buscar o documento lá e trazia para dentro. Aquele processo opera sobre\num único CNPJ, então atende uma empresa e mais nenhuma.\n\nAqui quem entrega é o **seu sistema**, autenticado pela sua credencial. O documento segue\nexatamente o mesmo processamento de sempre — o que muda é quem traz.\n\n## Como enviar\n\nTrês formas, escolha uma:\n\n- `application/json` com o campo `xml` — o XML cru **ou em base64**. A codificação é\n  detectada pelo conteúdo; não há flag a acertar.\n- `multipart/form-data` com o campo `arquivo`.\n\nAceita o `cteProc` (com protocolo) ou o `CTe` cru, até 2 MB.\n\n## O que a FleetPay lê do XML\n\nVocê não monta payload nenhum — o XML basta. São lidos: a chave de acesso, a data de\nemissão, o emitente (a sua transportadora), o **tomador do frete** (pelo código `toma`,\nseja ele remetente, expedidor, recebedor, destinatário ou o grupo `toma4`), a rota\n(origem e destino, inclusive nos casos de redespacho), o valor da prestação e a chave da\nNF-e transportada.\n\n## Reenviar é seguro\n\nA operação é **idempotente pela chave de acesso**. O primeiro envio responde `201`; os\nseguintes respondem `200` com `first_reception: false` e **não reprocessam** o documento.\nRetry de rede e reprocessamento noturno não criam serviço duplicado nem erro.\n\n## Só o CT-e em que você é a emitente\n\nO `cnpj_carrier` é lido do grupo `emit` do XML e precisa ser o da transportadora\nautenticada. Um CT-e de outra empresa é recusado — o CT-e da contratante, que dá origem\nao seu contra-CT-e, entra por `POST /fiscal/cte-subcontratacao`.\n",
  "operationId": "receiveEmittedCte",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/EmittedCteInput"
        }
      },
      "multipart/form-data": {
        "schema": {
          "type": "object",
          "required": [
            "arquivo"
          ],
          "properties": {
            "arquivo": {
              "type": "string",
              "format": "binary",
              "description": "XML do CT-e, até 2 MB."
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "$ref": "#/components/responses/EmittedCteAlreadyKnown"
    },
    "201": {
      "$ref": "#/components/responses/EmittedCteAccepted"
    },
    "400": {
      "$ref": "#/components/responses/ValidationFailed"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "422": {
      "$ref": "#/components/responses/ValidationOrBusinessRuleFailed"
    },
    "429": {
      "$ref": "#/components/responses/RateLimited"
    },
    "500": {
      "$ref": "#/components/responses/InternalError"
    }
  },
  "method": "POST",
  "path": "/fiscal/cte-emitidos",
  "parameters": []
}