### Sandbox Environment Source: https://superfrete.readme.io/reference/index Information on using the Sandbox environment for testing, including how to generate a token and add credits to your test wallet. ```APIDOC ## Sandbox Environment ### Description The Sandbox environment is for testing API integrations. Requests made here use a specific URL and token. Labels generated in Sandbox are not valid for actual shipping. To simulate purchase and label generation scenarios, you need to add credits to your test wallet using a simulated PIX payment. ### Method Not Applicable (This section describes environment setup) ### Endpoint - **Sandbox URL:** `https://sandbox.superfrete.com/` - **Production URL:** `https://api.superfrete.com/` ### Procedures #### Token Generation (Sandbox): 1. Access: `https://sandbox.superfrete.com/#/integrations` 2. Click 'Integrar em Desenvolvedores'. 3. Click 'Confirmar'. 4. Copy the displayed token. #### Adding Credits (Sandbox): 1. Access: `https://sandbox.superfrete.com/#/account/credits` 2. Click 'Recarregue com Pix'. 3. Select a recharge amount. 4. Click 'Recarregar com Pix'. 5. Click 'Copiar código PIX'. 6. Paste the PIX code into your browser's address bar and press Enter to simulate payment. ``` -------------------------------- ### Authentication Source: https://superfrete.readme.io/reference/index Learn how to authenticate your requests using a Bearer token and the required User-Agent header for technical contact. ```APIDOC ## Authentication ### Description To interact with the SuperFrete API, you need an authentication token specific to the environment you are using (Sandbox or Production). Include the generated token in the `Authorization` header using the Bearer schema. Additionally, provide application information in the `User-Agent` header for technical contact. ### Method Not Applicable (This section describes header usage for all requests) ### Endpoint Not Applicable ### Parameters #### Headers - **Authorization** (string) - Required - The authentication token in the format `Bearer {token}`. - **User-Agent** (string) - Required - Application information in the format `Nome da sua aplicação e versão (seu_email@para_contato.com)`. ### Request Example ```curl curl --request POST \ --url https://sandbox.superfrete.com/api/v0/calculator \ --header 'Authorization: Bearer {token}' \ --header 'User-Agent: Superfrete (integracao@superfrete.com)' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ ``` ### Response Not Applicable (Authentication is handled via headers) ``` -------------------------------- ### Error Codes Source: https://superfrete.readme.io/reference/index A list of possible error codes that may be returned by the API. ```APIDOC ## Errors ### Description This section lists the potential error codes you might receive from the API, indicating the nature of the issue encountered during a request. ### Method Not Applicable (This section lists error codes) ### Endpoint Not Applicable ### Error Codes - `cancelled` - `unknown` - `invalid-argument` - `deadline-exceeded` - `not-found` - `already-exists` - `permission-denied` - `resource-exhausted` - `failed-precondition` - `aborted` - `out-of-range` - `unimplemented` - `internal` - `unavailable` - `data-loss` - `unauthenticated` ``` -------------------------------- ### Shipping Request Example Source: https://superfrete.readme.io/reference/adicionar-frete-carrinho This example demonstrates a typical request payload for calculating shipping costs. It includes sender and recipient details, service type, product information, package dimensions, and optional settings like insurance or invoice details. Ensure all required fields are populated for accurate calculations. ```json { "from": { "name": "Nome do remetente", "address": "Rua do remetente", "district": "Bairro", "state_abbr": "RJ", "postal_code": "20020050", "city": "Cidade" }, "to": { "name": "Nome do destinatário", "address": "Rua do destinatário", "district": "Bairro", "city": "Cidade", "state_abbr": "SP", "postal_code": "01153000", "email": "email@mail.com" }, "service": 1, "products": [ { "name": "Produto 1", "quantity": 1, "unitary_value": 100 }, { "name": "Produto 2", "quantity": 2, "unitary_value": 200 } ], "volumes": { "height": 2, "width": 11, "length": 16, "weight": 0.3 }, "options": { "invoice": { "key": "123456" } }, "platform": "Insira aqui o nome da sua plataforma" } ``` -------------------------------- ### cURL Request with Bearer Token Authentication Source: https://superfrete.readme.io/reference/index This cURL example demonstrates how to make a POST request to the SuperFrete API calculator endpoint. It includes the necessary Authorization header with a Bearer token and the User-Agent header for application identification. The request specifies JSON content type and accepts JSON responses. ```bash curl --request POST \ --url https://sandbox.superfrete.com/api/v0/calculator \ --header 'Authorization: Bearer {token}' \ --header 'User-Agent: Superfrete (integracao@superfrete.com)' \ --header 'accept: application/json' \ --header 'content-type: application/json' ``` -------------------------------- ### Sandbox Environment - Adding Balance Source: https://superfrete.readme.io/reference/primeiros-passos Instructions on how to add balance to your test wallet in the Sandbox environment to simulate purchase and label generation scenarios. ```APIDOC ## Add Balance in Sandbox To simulate purchase and label generation scenarios in the Sandbox environment, you need to add balance to your test wallet. 1. Access the Sandbox environment: `https://sandbox.superfrete.com/#/account/credits` 2. Click on **Recarregue com Pix**. 3. Select a recharge amount. 4. Click on **Recarregar com Pix**. 5. Click on **Copiar código PIX**. 6. Paste the copied PIX code into the address bar of your browser and press Enter. This will simulate the payment, and the credit will be added to your Sandbox wallet. :information_source: **Video tutorial available:** ``` -------------------------------- ### Webhook Event Notification Example Source: https://superfrete.readme.io/reference/webhook An example JSON payload received when an 'order.delivered' event occurs. It includes details about the order and timestamps for various stages. Note that 'tracking' and 'tracking_url' are only available from the 'order.generated' event onwards. ```json { "event": "order.delivered", "data": { "protocol":null, "id": "[id]", "status": "delivered", "tracking": "[tracking]", "self_tracking":null, "user_id": "[uid]", "tags": [ { "tag": "tag1", "url": "www.url1.com" } ], "created_at": "2024-03-29T23:49:26+00:00", "paid_at": "2024-03-29T23:50:47+00:00", "generated_at": "2024-03-29T23:51:47+00:00", "posted_at": "2024-03-29T23:55:00+00:00", "delivered_at": "2024-03-29T23:57:47+00:00", "canceled_at": null, "expired_at": null, "tracking_url": "rastreio.superfrete.com/#/tracking/[tracking_id]" } } ``` -------------------------------- ### Get Order Information by ID (OpenAPI) Source: https://superfrete.readme.io/reference/tag-informa%C3%A7%C3%B5es-do-pedido This snippet defines the OpenAPI specification for retrieving detailed information about a specific Superfrete order using its unique ID. It outlines the request method (GET), parameters, and the structure of the JSON response, including order details, sender and receiver information, and product specifics. Authentication is handled via an API key in the header. ```json { "openapi": "3.1.0", "info": { "title": "Integration", "version": "0" }, "servers": [ { "url": "https://sandbox.superfrete.com" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "name": "Authorization", "in": "header", "x-bearer-format": "bearer", "x-default": "" } } }, "security": [ { "sec0": [] } ], "paths": { "/api/v0/order/info/{id}": { "get": { "summary": "Informações do pedido", "description": "", "operationId": "tag-informações-do-pedido", "parameters": [ { "name": "id", "in": "path", "description": "Id do pedido SuperFrete", "schema": { "type": "string" }, "required": true } ], "responses": { "200": { "description": "200", "content": { "application/json": { "examples": { "Result": { "value": "{\n \"id\": \"JlmCKlsK7G471C4ChJYX\",\n \"format\": \"box\",\n \"delivery\": 5,\n \"delivery_min\": 5,\n \"delivery_max\": 5,\n \"discount\": 5.01,\n \"height\": 2,\n \"width\": 11,\n \"length\": 16,\n \"weight\": 0.3,\n \"from\": {\n \"address\": \"Rua do remetente\",\n \"city\": \"Cidade\",\n \"complement\": null,\n \"district\": \"Bairro\",\n \"document\": null,\n \"name\": \"Nome do remetente\",\n \"location_number\": \"S/N\",\n \"postal_code\": \"20020050\",\n \"state_abbr\": \"RJ\",\n \"country_id\": \"BR\"\n },\n \"to\": {\n \"address\": \"Rua do destinatário\",\n \"city\": \"Cidade\",\n \"complement\": null,\n \"district\": \"Bairro\",\n \"document\": null,\n \"name\": \"Nome do destinatário\",\n \"location_number\": \"S/N\",\n \"postal_code\": \"01153000\",\n \"state_abbr\": \"SP\",\n \"country_id\": \"BR\"\n },\n \"invoice\": \"123456\",\n \"own_hand\": false,\n \"receipt\": false,\n \"price\": 19.79,\n \"tracking\": \"EC451638075BR\",\n \"status\": \"pending\",\n \"service_id\": 1,\n \"products\": [\n {\n \"name\": \"Produto 1\",\n \"quantity\": \"1\",\n \"unitary_value\": \"100\"\n },\n {\n \"name\": \"Produto 2\",\n \"quantity\": \"2\",\n \"unitary_value\": \"200\"\n }\n ],\n \"insurance_value\": null,\n \"generated_at\": \"2022-12-03T17:36:01.159Z\",\n \"posted_at\": \"2022-12-03T17:36:01.159Z\",\n \"created_at\": \"2022-12-03T17:34:39.399Z\",\n \"updated_at\": \"2022-12-03T17:36:04.481Z\"\n}" } }, "schema": { "type": "object", "properties": { "id": { "type": "string", "example": "JlmCKlsK7G471C4ChJYX" }, "format": { "type": "string", "example": "box" }, "delivery": { "type": "integer", "example": 5, "default": 0 }, "delivery_min": { "type": "integer", "example": 5, "default": 0 }, "delivery_max": { "type": "integer", "example": 5, "default": 0 }, "discount": { "type": "number", "example": 5.01, "default": 0 }, "height": { "type": "integer", "example": 2, "default": 0 }, "width": { "type": "integer", "example": 11, "default": 0 }, "length": { "type": "integer", "example": 16, "default": 0 }, "weight": { "type": "number", "example": 0.3, "default": 0 }, "from": { "type": "object", "properties": { "address": { "type": "string", "example": "Rua do remetente" }, "city": { "type": "string", "example": "Cidade" }, "complement": {}, "district": { "type": "string", "example": "Bairro" }, "document": {}, "name": { "type": "string", "example": "Nome do remetente" }, "location_number": { "type": "string", "example": "S/N" }, "postal_code": { "type": "string", "example": "20020050" }, "state_abbr": { "type": "string", "example": "RJ" }, "country_id": { "type": "string", "example": "BR" } } }, "to": { "type": "object", "properties": { "address": { "type": "string", "example": "Rua do destinatário" }, "city": { "type": "string", "example": "Cidade" }, "complement": {}, "district": { "type": "string", "example": "Bairro" }, "document": {}, "name": { "type": "string", "example": "Nome do destinatário" }, "location_number": { "type": "string", "example": "S/N" }, "postal_code": { "type": "string", "example": "01153000" }, "state_abbr": { "type": "string", "example": "SP" }, "country_id": { "type": "string", "example": "BR" } } }, "invoice": { "type": "string", "example": "123456" }, "own_hand": { "type": "boolean", "example": false }, "receipt": { "type": "boolean", "example": false }, "price": { "type": "number", "example": 19.79 }, "tracking": { "type": "string", "example": "EC451638075BR" }, "status": { "type": "string", "example": "pending" }, "service_id": { "type": "integer", "example": 1 }, "products": { "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string", "example": "Produto 1" }, "quantity": { "type": "string", "example": "1" }, "unitary_value": { "type": "string", "example": "100" } } } }, "insurance_value": {}, "generated_at": { "type": "string", "format": "date-time", "example": "2022-12-03T17:36:01.159Z" }, "posted_at": { "type": "string", "format": "date-time", "example": "2022-12-03T17:36:01.159Z" }, "created_at": { "type": "string", "format": "date-time", "example": "2022-12-03T17:34:39.399Z" }, "updated_at": { "type": "string", "format": "date-time", "example": "2022-12-03T17:36:04.481Z" } } } } } } } } } } } ``` -------------------------------- ### cURL Request Example for Shipping Calculation Source: https://superfrete.readme.io/reference/calculator This example demonstrates how to make a POST request to the Superfrete API's calculator endpoint using cURL. It includes essential headers like User-Agent, Accept, and Content-Type, along with a JSON payload specifying origin, destination, services, options, and package details. ```shell curl --request POST \ --url https://sandbox.superfrete.com/api/v0/calculator \ --header 'User-Agent: Nome e versão da aplicação (email para contato técnico)' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "from": { "postal_code": "01153000" }, "to": { "postal_code": "20020050" }, "services": "1,2,17", "options": { "own_hand": false, "receipt": false, "insurance_value": 0, "use_insurance_value": false }, "package": { "height": 2, "width": 11, "length": 16, "weight": 0.3 } }' ``` -------------------------------- ### Create Shipping Cart Request (Node.js) Source: https://superfrete.readme.io/reference/etiquetas This Node.js example shows how to make a POST request to the Superfrete API to create a shipping cart. It utilizes the 'node-fetch' library for making HTTP requests. ```javascript const fetch = require('node-fetch'); const url = 'https://sandbox.superfrete.com/api/v0/cart'; const options = { method: 'POST', headers: { 'User-Agent': 'Nome e versão da aplicação (email para contato técnico)', 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({ "platform": "Documentação" }) }; fetch(url, options) .then(res => res.json()) .then(json => console.log(json)) .catch(err => console.error('error:' + err)); ``` -------------------------------- ### Create Shipping Cart Request (Ruby) Source: https://superfrete.readme.io/reference/etiquetas This Ruby example illustrates how to send a POST request to the Superfrete API to create a shipping cart. It uses the built-in 'Net::HTTP' library for HTTP communication. ```ruby require 'net/http' require 'uri' require 'json' uri = URI.parse('https://sandbox.superfrete.com/api/v0/cart') request = Net::HTTP::Post.new(uri) request['User-Agent'] = 'Nome e versão da aplicação (email para contato técnico)' request['Accept'] = 'application/json' request['Content-Type'] = 'application/json' request.body = JSON.dump({ "platform": "Documentação" }) response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end puts response.body ``` -------------------------------- ### Create Shipping Cart Request (cURL) Source: https://superfrete.readme.io/reference/etiquetas This example demonstrates how to create a shipping cart request using cURL. It includes setting the platform and other necessary headers for the API call. ```shell curl --request POST \ --url https://sandbox.superfrete.com/api/v0/cart \ --header 'User-Agent: Nome e versão da aplicação (email para contato técnico)' \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data '{ "platform": "Documentação" }' ``` -------------------------------- ### Authentication Source: https://superfrete.readme.io/reference/primeiros-passos Learn how to authenticate your requests to the SuperFrete API using Bearer tokens and the required User-Agent header. ```APIDOC ## Authentication To interact with the SuperFrete API, you will need an authentication token specific to the environment you are using (Sandbox or Production). ### Token Generation **For Sandbox environment (testing):** * URL: `https://sandbox.superfrete.com/` * Access: `https://sandbox.superfrete.com/#/integrations` * Click 'Integrar em Desenvolvedores'. * Click 'Confirmar'. * The token will be generated and displayed. Copy this token. **For Production environment (real):** * URL: `https://api.superfrete.com/` * Access: `https://web.superfrete.com/#/integrations` * Click 'Integrar em Desenvolvedores'. * Click 'Confirmar'. * The token will be generated and displayed. Copy this token. ### Token Usage Include the generated token in the header of your HTTP request using the Bearer authentication scheme. * **Header Name:** `Authorization` * **Format:** `Bearer {token}` **Additional Header Information:** It is mandatory to include information about your application for technical contact using the `User-Agent` header. * **Format:** `User-Agent: Nome da sua aplicação e versão ()` ### Request Example ```curl curl --request POST \ --url https://sandbox.superfrete.com/api/v0/calculator \ --header 'Authorization: Bearer {token}' \ --header 'User-Agent: Superfrete (integracao@superfrete.com)' \ --header 'accept: application/json' \ --header 'content-type: application/json' ``` ``` -------------------------------- ### Create Shipping Cart Request (PHP) Source: https://superfrete.readme.io/reference/etiquetas This PHP example shows how to make a POST request to the Superfrete API to create a shipping cart using cURL. It sets the necessary headers and sends the JSON payload. ```php 'Documentação']); $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'User-Agent: Nome e versão da aplicação (email para contato técnico)', 'Accept: application/json', 'Content-Type: application/json' ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { echo $response; } c_url_close($ch); ?> ``` -------------------------------- ### Webhook Authentication Header Example Source: https://superfrete.readme.io/reference/webhook Demonstrates how to include the JWT token in the Authorization header for API requests. The token is obtained from the SuperFrete integration panel. ```http Authorization: Bearer {token} ``` -------------------------------- ### List Addresses - Node.js Request Source: https://superfrete.readme.io/reference/usu%C3%A1rio Example of how to list user addresses using Node.js with the 'node-fetch' library. This snippet shows how to construct the GET request with appropriate headers. ```javascript const fetch = require('node-fetch'); const options = { method: 'GET', headers: { 'User-Agent': 'Nome e versão da aplicação (email para contato técnico)', 'accept': 'application/json' } }; fetch('https://sandbox.superfrete.com/api/v0/user/addresses', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` -------------------------------- ### Create Shipping Cart Request (Python) Source: https://superfrete.readme.io/reference/etiquetas This Python example demonstrates how to send a POST request to the Superfrete API to create a shipping cart using the 'requests' library. It includes setting the platform in the JSON payload. ```python import requests url = 'https://sandbox.superfrete.com/api/v0/cart' headers = { 'User-Agent': 'Nome e versão da aplicação (email para contato técnico)', 'Accept': 'application/json', 'Content-Type': 'application/json' } data = { 'platform': 'Documentação' } response = requests.post(url, headers=headers, json=data) print(response.json()) ``` -------------------------------- ### List Addresses - PHP Request Source: https://superfrete.readme.io/reference/usu%C3%A1rio A PHP example using cURL to list user addresses from the Superfrete API. It configures the GET request with the necessary User-Agent and accept headers. ```php ``` -------------------------------- ### GET /api/v0/order/info/{id} Source: https://superfrete.readme.io/reference/tag-informa%C3%A7%C3%B5es-do-pedido Retrieves detailed information about a specific order using its unique ID. ```APIDOC ## GET /api/v0/order/info/{id} ### Description Retrieves detailed information about a specific order using its unique ID. ### Method GET ### Endpoint /api/v0/order/info/{id} ### Parameters #### Path Parameters - **id** (string) - Required - Id do pedido SuperFrete ### Request Example ```json { "example": "No request body needed for this GET request." } ``` ### Response #### Success Response (200) - **id** (string) - Example: "JlmCKlsK7G471C4ChJYX" - **format** (string) - Example: "box" - **delivery** (integer) - Example: 5 - **delivery_min** (integer) - Example: 5 - **delivery_max** (integer) - Example: 5 - **discount** (number) - Example: 5.01 - **height** (integer) - Example: 2 - **width** (integer) - Example: 11 - **length** (integer) - Example: 16 - **weight** (number) - Example: 0.3 - **from** (object) - Information about the sender. - **address** (string) - Example: "Rua do remetente" - **city** (string) - Example: "Cidade" - **complement** (any) - Example: null - **district** (string) - Example: "Bairro" - **document** (any) - Example: null - **name** (string) - Example: "Nome do remetente" - **location_number** (string) - Example: "S/N" - **postal_code** (string) - Example: "20020050" - **state_abbr** (string) - Example: "RJ" - **country_id** (string) - Example: "BR" - **to** (object) - Information about the recipient. - **address** (string) - Example: "Rua do destinatário" - **city** (string) - Example: "Cidade" - **complement** (any) - Example: null - **district** (string) - Example: "Bairro" - **document** (any) - Example: null - **name** (string) - Example: "Nome do destinatário" - **location_number** (string) - Example: "S/N" - **postal_code** (string) - Example: "01153000" - **state_abbr** (string) - Example: "SP" - **country_id** (string) - Example: "BR" - **invoice** (string) - Example: "123456" - **own_hand** (boolean) - Example: false - **receipt** (boolean) - Example: false - **price** (number) - Example: 19.79 - **tracking** (string) - Example: "EC451638075BR" - **status** (string) - Example: "pending" - **service_id** (integer) - Example: 1 - **products** (array) - List of products in the order. - **name** (string) - Example: "Produto 1" - **quantity** (string) - Example: "1" - **unitary_value** (string) - Example: "100" - **insurance_value** (any) - Example: null - **generated_at** (string) - Example: "2022-12-03T17:36:01.159Z" - **posted_at** (string) - Example: "2022-12-03T17:36:01.159Z" - **created_at** (string) - Example: "2022-12-03T17:34:39.399Z" - **updated_at** (string) - Example: "2022-12-03T17:36:04.481Z" #### Response Example ```json { "id": "JlmCKlsK7G471C4ChJYX", "format": "box", "delivery": 5, "delivery_min": 5, "delivery_max": 5, "discount": 5.01, "height": 2, "width": 11, "length": 16, "weight": 0.3, "from": { "address": "Rua do remetente", "city": "Cidade", "complement": null, "district": "Bairro", "document": null, "name": "Nome do remetente", "location_number": "S/N", "postal_code": "20020050", "state_abbr": "RJ", "country_id": "BR" }, "to": { "address": "Rua do destinatário", "city": "Cidade", "complement": null, "district": "Bairro", "document": null, "name": "Nome do destinatário", "location_number": "S/N", "postal_code": "01153000", "state_abbr": "SP", "country_id": "BR" }, "invoice": "123456", "own_hand": false, "receipt": false, "price": 19.79, "tracking": "EC451638075BR", "status": "pending", "service_id": 1, "products": [ { "name": "Produto 1", "quantity": "1", "unitary_value": "100" }, { "name": "Produto 2", "quantity": "2", "unitary_value": "200" } ], "insurance_value": null, "generated_at": "2022-12-03T17:36:01.159Z", "posted_at": "2022-12-03T17:36:01.159Z", "created_at": "2022-12-03T17:34:39.399Z", "updated_at": "2022-12-03T17:36:04.481Z" } ``` ``` -------------------------------- ### Error Codes Source: https://superfrete.readme.io/reference/primeiros-passos A list of possible error codes you might receive when interacting with the SuperFrete API. ```APIDOC ## Errors Possible errors you may receive: * `cancelled` * `unknown` * `invalid-argument` * `deadline-exceeded` * `not-found` * `already-exists` * `permission-denied` * `resource-exhausted` * `failed-precondition` * `aborted` * `out-of-range` * `unimplemented` * `internal` * `unavailable` * `data-loss` * `unauthenticated` ``` -------------------------------- ### GET /api/v1/shipping-labels/{id} Source: https://superfrete.readme.io/reference/tag-informa%C3%A7%C3%B5es-do-pedido Fetches detailed information for a specific shipping label using its unique ID. The response includes all associated details of the label. ```APIDOC ## GET /api/v1/shipping-labels/{id} ### Description Retrieves detailed information for a specific shipping label using its unique ID. The response includes all associated details of the label. ### Method GET ### Endpoint `/api/v1/shipping-labels/{id}` ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the shipping label. ### Request Example ```json { "example": "GET /api/v1/shipping-labels/your_label_id" } ``` ### Response #### Success Response (200) - **id** (string) - The unique ID of the shipping label. - **protocol** (string) - An internal protocol identifier. - **format** (string) - The format of the package (e.g., "box"). - **delivery** (integer) - The estimated delivery time in business days. - **delivery_min** (integer) - The minimum delivery time in business days. - **delivery_max** (integer) - The maximum delivery time in business days. - **discount** (float) - The discount applied to the shipping cost. - **height** (string) - The height of the package in centimeters. - **width** (string) - The width of the package in centimeters. - **length** (string) - The length of the package in centimeters. - **weight** (string) - The weight of the package in kilograms. - **from** (object) - Sender details. - **address** (string) - Sender's address. - **city** (string) - Sender's city. - **complement** (string) - Sender's address complement. - **email** (string) - Sender's email. - **district** (string) - Sender's neighborhood. - **document** (string) - Sender's document (CPF/CNPJ). - **name** (string) - Sender's full name. - **location_number** (string) - Sender's address number. - **postal_code** (string) - Sender's postal code. - **state_abbr** (string) - Sender's state abbreviation (UF). - **country_id** (string) - Sender's country ID (always "BR"). - **to** (object) - Recipient details. - **address** (string) - Recipient's address. - **city** (string) - Recipient's city. - **complement** (string) - Recipient's address complement. - **district** (string) - Recipient's neighborhood. - **document** (string) - Recipient's document (CPF/CNPJ). - **name** (string) - Recipient's full name. - **location_number** (string) - Recipient's address number. - **postal_code** (string) - Recipient's postal code. - **state_abbr** (string) - Recipient's state abbreviation (UF). - **country_id** (string) - Recipient's country ID (always "BR"). - **invoice** (object or null) - Invoice details, if used. - **own_hand** (boolean) - Indicates if the "Own Hand" service was requested. - **receipt** (boolean) - Indicates if the "Delivery Receipt" service was requested. - **price** (float) - The total shipping cost. - **tracking** (string or null) - The tracking code for the package. - **status** (string) - The current status of the label (e.g., "delivered"). - **service_id** (integer) - The ID of the shipping service used. - **products** (array of objects) - List of products declared for the package. - **name** (string) - Product name. - **quantity** (string) - Product quantity. - **unitary_value** (string) - Unitary value of the product. - **insurance_value** (float or null) - The declared insurance value of the package. - **generated_at** (string) - Timestamp when the label was generated (ISO 8601 UTC). - **posted_at** (string or null) - Timestamp when the package was posted (ISO 8601 UTC). - **created_at** (string) - Timestamp when the label order was created (ISO 8601 UTC). - **updated_at** (string) - Timestamp of the last update to the label information (ISO 8601 UTC). - **print** (object) - Information for printing the label. - **url** (string) - URL to access the PDF file of the label for printing. - **tags** (array of objects) - List of tags associated with the label. - **tag** (string) - The tag value. - **url** (string) - The URL associated with the tag. #### Response Example ```json { "id": "987654321", "protocol": "987654321", "format": "box", "delivery": 5, "delivery_min": 4, "delivery_max": 6, "discount": 2.50, "height": "15", "width": "25", "length": "26", "weight": "2.20", "from": { "address": "Rua Exemplo, 123", "city": "São Paulo", "complement": "Apto 4B", "email": "remetente@email.com", "district": "Centro", "document": "111.222.333-44", "name": "Nome Remetente", "location_number": "123", "postal_code": "01000-000", "state_abbr": "SP", "country_id": "BR" }, "to": { "address": "Avenida Teste, 456", "city": "Rio de Janeiro", "complement": null, "district": "Copacabana", "document": "555.666.777-88", "name": "Nome Destinatario", "location_number": "456", "postal_code": "20000-000", "state_abbr": "RJ", "country_id": "BR" }, "invoice": null, "own_hand": false, "receipt": true, "price": 27.37, "tracking": "AA923452383BR", "status": "delivered", "service_id": 2, "products": [ { "name": "Produto Exemplo", "quantity": "2", "unitary_value": "50.00" } ], "insurance_value": 100.00, "generated_at": "2023-10-27T10:00:00Z", "posted_at": "2023-10-27T12:00:00Z", "created_at": "2023-10-27T09:30:00Z", "updated_at": "2023-10-27T15:00:00Z", "print": { "url": "https://api.superfrete.com/v1/labels/987654321/print" }, "tags": [ { "tag": "3101481", "url": "https://platform.example.com/order/3101481" } ] } ``` ``` -------------------------------- ### Create Webhook App (OpenAPI) Source: https://superfrete.readme.io/reference/criar-webhook-app Defines the OpenAPI 3.1.0 specification for creating a webhook application. It includes details on the request body schema (name, url, events), expected responses (201 Created, 400 Bad Request), and security schemes using API keys in the header. ```json { "openapi": "3.1.0", "info": { "title": "Integration", "version": "0" }, "servers": [ { "url": "https://sandbox.superfrete.com" } ], "components": { "securitySchemes": { "sec0": { "type": "apiKey", "name": "Authorization", "in": "header", "x-bearer-format": "bearer", "x-default": "" } } }, "security": [ { "sec0": [] } ], "paths": { "/api/v0/webhook": { "post": { "summary": "Criar webhook app", "description": "", "operationId": "criar-webhook-app", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "required": [ "name", "url" ], "properties": { "name": { "type": "string", "description": "Nome do Webhook app" }, "url": { "type": "string", "description": "URL que receberá as notificações" }, "events": { "type": "array", "description": "Lista de eventos para receber as atualizações", "items": { "type": "string" } } } } } } }, "responses": { "201": { "description": "201", "content": { "application/json": { "examples": { "Result": { "value": "{\n \"id\": \"webhook-app-123\",\n \"name\": \"Meu Webhook App\",\n \"url\": \"https://meusite.com/webhook\",\n \"secret_token\": \"abc123def456\",\n \"events\": [\"order.posted\", \"order.delivered\"],\n \"is_active\": true,\n \"created_at\": \"2023-10-01T12:00:00Z\"\n}" } }, "schema": { "type": "object", "properties": { "id": { "type": "string", "example": "webhook-app-123" }, "name": { "type": "string", "example": "Meu Webhook App" }, "url": { "type": "string", "example": "https://meusite.com/webhook" }, "secret_token": { "type": "string", "example": "abc123def456" }, "events": { "type": "array", "items": { "type": "string", "example": "order.posted" } }, "is_active": { "type": "boolean", "example": true, "default": true }, "created_at": { "type": "string", "example": "2023-10-01T12:00:00Z" } } } } } }, "400": { "description": "400", "content": { "application/json": { "examples": { "Result": { "value": "{}" } }, "schema": { "type": "object", "properties": {} } } } } }, "deprecated": false } } }, "x-readme": { "headers": [ { "key": "User-Agent", "value": "Nome e versão da aplicação (email para contato técnico)" } ], "explorer-enabled": true, "proxy-enabled": true }, "x-readme-fauxas": true, "_id": "63879ecb146a930035ba9f95:6733b3867bd0940053312537" } ```