Gerar etiqueta (Correios)
generate_labelCreate a Correios pré-postagem and generate its shipping label (etiqueta) as a PDF. Returns the tracking code and a clickable link to the label PDF — share that link with the merchant/customer in chat so they can open/print it (it works even if Correios is still rendering). Supply invoiceKey for NF-e or declaredItems for DC-e. Requires the store's own authenticated Correios contract. Never use this tool to retry an uncertain emission or recover a PDF; use diagnose_label_issue and recover_label_pdf when available.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sender | Yes | Remetente (sender / store). | |
| recipient | Yes | Destinatário (recipient / customer). | |
| dimensions | No | Package dimensions in centimeters. Optional: when omitted, the store's own registered packaging box is used if it has exactly one; ask the merchant for dimensions when the store has none or more than one box registered (the call fails with reason dimensions_required_no_box / dimensions_required_multiple_boxes). | |
| instanceId | No | Merchant/store id. Ignored on authenticated servers (the merchant comes from the API key); used only on local/unauthenticated servers. | |
| invoiceKey | No | Complete NF-e access key (44 digits). Spaces, dots, hyphens and slashes are ignored. When supplied, emits with NF-e instead of DC-e; never invent or complete missing digits. | |
| serviceCode | Yes | Correios product code, e.g. '03220' (SEDEX) or '03298' (PAC). | |
| weightGrams | Yes | Package weight in grams. | |
| objectFormat | No | Object format: '1' envelope, '2' package/box (default), '3' roll. | |
| declaredItems | No | Declaração de conteúdo — required when invoiceKey is omitted (at least one item). Ignored when a valid NF-e is supplied. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| reason | No | Why the label wasn't (fully) produced. | |
| status | No | Correios pré-postagem status. | |
| actionUrl | No | When set (e.g. reason=subscription_required), send the merchant here to finish setup. | |
| labelPdfUrl | No | Clickable link to download the label PDF — share this with the merchant/customer in chat. Works even before the PDF finishes rendering (it waits and streams it once ready). | |
| supportCode | No | Código de atendimento para diagnose_label_issue. | |
| trackingCode | No | Código de rastreamento, once the pré-postagem exists. | |
| prepostagemId | No | Correios pré-postagem id. Pass it to get_label_pdf to fetch the PDF later if it wasn't ready. | |
| labelPdfBase64 | No | Base64-encoded label PDF, once ready. | |
| recoveryAction | No | ||
| journalUnavailable | No |