Get balance with the Melhor Envio API
Returns the balance of the Melhor Envio wallet in BRL, with the amount reserved and the debts. Purchase labels spends this balance.
- Identifier
- melhor_envio_get_balance
The request
POST https://connect.reportei.com/api/tools/melhor_envio_get_balance/execute
Authorization: Bearer <merchant token>
x-customer-token: <customer token>
Content-Type: application/json
Accept: application/json
{
"customer_toolkit": "<connection UUID>",
"arguments": {}
}Your system sends your customer's connection id and the tool arguments. The headers are the same as the rest of the Connect API: your product's token and your customer's token.
Parameters
This tool takes no arguments.
Supported connections
Your customer connects their Melhor Envio account once, with one of the modes below. The same connection serves every tool of the toolkit.
OAuth with your product's app
You register your product's OAuth app once, with POST /api/merchants/credentials/melhor_envio, and your customer authorizes the account on a consent screen. Connect renews the token when it is about to expire.
The response
On success, Connect preserves the app's response status and body. HTTP errors returned by the app use the {error, api_error} envelope; authentication or validation can fail before execution. The X-Toolkit-Execution-Id header identifies the recorded execution, available at GET /api/tools/executions/{uuid}.
Ready for AI agents
This tool's input is a JSON Schema, available at GET /api/tools/melhor_envio_get_balance. It becomes your agent's tool definition with no conversion.
Other Melhor Envio tools
- Calculate shippingPOSTQuotes the shipping of products between two CEPs and returns one entry per service, with id, carrier, price, delivery time, the packages and an error when the service does not serve the route. custom_price and custom_delivery_time include the fees and discounts of the account. Only the services enabled for the integration in the Melhor Envio panel are quoted.
- Create cart itemPOSTAdds a shipping label to the cart of the account and returns it. Its id is the id of the label in the other tools. Nothing is paid until Purchase labels. Correios, J&T and Loggi take one volume per call: for more packages, add one item per package.
- List cart itemsGETLists the labels in the cart that were not paid yet, with id, service, price, sender, recipient and volumes. Labels stay in the cart for 20 days. 10 per page: pass page for the next ones, up to last_page.
- Delete cart itemDELETERemoves a label that was not paid yet from the cart.
- Purchase labelsPOSTPays labels in the cart with the balance of the Melhor Envio wallet and returns the purchase, with the total and the labels, now released. The wallet needs enough balance: check it with Get balance. Paid labels still need Generate labels.
- Generate labelsPOSTGenerates paid labels, which is required before Print labels, and returns the result for each id. A generated label must be posted within 20 days, or 7 days with Correios.
- Print labelsPOSTReturns a link to print generated labels. A private link opens only for someone signed in to the Melhor Envio account; a public link opens for anyone who has it.
- List labelsGETLists the labels of the account with id, protocol, status, service, price, tracking code and the dates of payment, generation, posting and delivery. 10 per page: pass page for the next ones, up to last_page.
See Connect applied to your product.
Try it for 15 days with no card, or walk our team through your use case.
