← HomeFleetPay / API

Create an MDF-e draft

Parameters, data structure and responses from the versioned contract.

POST/fiscal/mdfe
createMdfeSandbox Base: https://api.fleetpay.site/v1

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

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

cte_uuidsarrayRequired

Public UUIDs of authorized and available CT-e documents.

minItems1
vehicle_idintegerRequired
minimum1
trailersarray | nullOptional
maxItems3
driver_user_idinteger | nullOptional
minimum1
starts_atstring | null · dateOptional
ends_atstring | null · dateOptional
origin_city_codestring | nullOptional
pattern"^\\d{7}$"
origin_citystring | nullOptional
maxLength80
origin_statestringRequired
minLength2
maxLength2
destination_city_codestring | nullOptional
pattern"^\\d{7}$"
destination_citystring | nullOptional
maxLength80
destination_statestringRequired
minLength2
maxLength2
salvar_seguro_padraoboolean | nullOptional
info_fiscostring | nullOptional
maxLength2000
observacoesstring | nullOptional
maxLength5000
seriestring | nullOptional
maxLength3

Responses

201 HTTP Response

Draft created.

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": [
    "MDF-e"
  ],
  "summary": "Criar rascunho de MDF-e",
  "operationId": "createMdfe",
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/MdfeDraftInput"
        }
      }
    }
  },
  "responses": {
    "201": {
      "description": "Rascunho criado.",
      "headers": {
        "X-Request-Id": {
          "$ref": "#/components/headers/RequestId"
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/MdfeEnvelope"
          }
        }
      },
      "links": {
        "ConsultarMdfe": {
          "operationId": "getMdfe",
          "parameters": {
            "mdfe_uuid": "$response.body#/data/id"
          }
        },
        "EmitirMdfe": {
          "operationId": "issueMdfe",
          "parameters": {
            "mdfe_uuid": "$response.body#/data/id"
          }
        }
      }
    },
    "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/mdfe",
  "parameters": []
}