# Integração frete Omnik

<details>

<summary>Liberar acessos aos IPs da Omnik</summary>

```
SAND (us-west-2): 34.208.201.196/32 35.84.115.152/32 44.237.254.187/32 52.42.89.220/32 54.68.50.205/32 
PROD (us-west-2): 34.208.201.196/32 35.165.35.71/32 44.231.195.225/32 44.240.171.28/32 54.149.219.155/32 
PROD (us-east-1): 3.212.27.23/32 3.228.93.46/32 34.194.89.63/32 34.231.89.224/32 52.203.145.51/32 52.5.19.10/32
```

</details>

## Request

```json
curl --location 'https: //seuDominio/freteSeller' \
--header 'Content-Type: application/json' \
--data '{
    "originZipCode": "string", //cep origem
    "destinationZipCode": "string", //cep destino
    "products": [ // produtos
        {
            "skuId": "string", // skuid
            "sellerTenant": "string", //tenant seller
            "category": "string", //categoria
            "weight": null, //peso
            "width": null, //largura
            "height": null, //altura
            "length": null, //comprimento
            "quantity": null, //quntidade
            "cost": null // custo/preço
        }
    ]
}
```

## Response

Para os campos abaixo foi mapeado nos comentários a obrigatoriedade e qual campo do antigo retorno deve  ser mapeado para um campo específico.

```json
{
    "statusHttp": 200, //sempre 200
    "status": "string", //sempre ok
    "messages": [ // opcional, informações para o integrador
        //[ { "type": "INFO", "key": "NO_DELIVERY_OPTIONS", "text": "Nenhuma opção de frete disponível para o CEP informado.", "sellerTenant": "string" } ]
        {
            "type": "string",
            "key": "string",
            "text": "string",
            "sellerTenant": "string"
        }
    ],
    "content": {
        "sellerTenant": "string", // o id seller omink
        "destinationZipCode": 1415906, //cep destino
        "platform": "string", //plataforma: mobile
        "quotationId": "string", // opcional
        "deliveryOptions": [
            {
                "deliveryMethodId": "string",//shippingMethodId
                "deliveryMethodName": "string",//shippingMethodDisplayName
                "deliveryTime": 1,//Dias para entregar transit+ expedition
                "deliveryTimeType": "bd", // bd
                "deliveryMode": "ENUM", //optional
                "deliveryEstimateBusinessDays": 1, //optional
                "finalShippingCost": 0,//shippingCost
                "deliveryEstimatedDateExact": 1,//Dias para entregar  transit+ expedition
                "deliveryEstimatedDateExactIso": "1",//Dias para entregar  transit+ expedition
                "pickupPointInfo": [ // opcional
                    {
                        "id": "string",
                        "name": "string",
                        "instructions": "string",
                        "description": "string",
                        "address": {
                            "id": "string",
                            "externalId": "string",
                            "zipCode": "string",
                            "city": {
                                "name": "string"
                            },
                            "state": {
                                "name": "string",
                                "initials": "string",
                                "ibgeCode": "string"
                            },
                            "street": "string",
                            "number": "string",
                            "complement": "string",
                            "neighborhood": "string",
                            "country": "string",
                            "latitude": null,
                            "longitude": null
                        },
                        "businessHours": [
                            {
                                "dayOfWeek": "ENUM",
                                "openingTime": "string",
                                "closingTime": "string"
                            }
                        ],
                        "businessHoursExceptions": [
                            {
                                "date": "string",
                                "startTime": "string",
                                "endTime": "string",
                                "name": "string"
                            }
                        ]
                    }
                ],
                "availableDeliveryWindows": [// opcional
                    {
                        "date": "string",
                        "startTime": "string",
                        "endTime": "string"
                    }
                ]
            }
        ],
        "products": [
            {
                "skuId": "string", //skuid
                "sellerTenant": "string", //seu proprio tenant
                "skuIntegration": "string" //opcional
            }
        ]
    },
    "time": "string", //duração de request
    "timezone": "string", //timezone
    "locale": "string" //lingua local
}
```

## Comparação

### Request

{% columns %}
{% column %}
As Is

```json
{
    "destinationZip": 5711000,
    "volumes": [
        {
            "sku": "PRD9999999999",
            "height": 0.038,
            "length": 0.082,
            "width": 0.016,
            "weight": 0.32,
            "quantity": 2,
            "price": 45.0
        }
    ]
}
```

{% endcolumn %}

{% column %}
To be

```json
{
    "originZipCode": "13555122", //cep origem
    "destinationZipCode": "5711000", //cep destino
    "products": [ // produtos
        {
            "skuId": "PRD9999999999", // skuid
            "sellerTenant": "TALD99999999999", //tenant seller
            "category": "string", //categoria opcional
            "weight": 0.32, //peso
            "width": 0.016, //largura
            "height": 0.038, //altura
            "length": 0.082, //comprimento
            "quantity": 2, //quntidade
            "cost": 50.0 // custo/preço
        }
    ]
}
```

{% endcolumn %}
{% endcolumns %}

### Response

{% columns %}
{% column %}
As Is

```json
{
    "shippingQuotes": [
        {
            "shippingMethodType": "regular",
            "shippingCost": 0.0,
            "shippingMethodId": "jadlog",
            "shippingMethodName": "standard",
            "shippingMethodDisplayName": "Normal",
            "deliveryTime": {
                "transit": 60,
                "expedition": 2
            }
        },
        {
            "shippingMethodType": "express",
            "shippingCost": 0.0,
            "shippingMethodId": "jadlog",
            "shippingMethodName": "express",
            "shippingMethodDisplayName": "Expresso",
            "deliveryTime": {
                "transit": 60,
                "expedition": 2
            }
        }
    ]
}
```

{% endcolumn %}

{% column %}
To be

```json
{
    "content": {
        "additionalInformation": null,
        "cached": false,
        "deliveryOptions": [
            {
                "deliveryEstimatedDateExact": 60,
                "deliveryEstimatedDateExactIso": "60",
                "deliveryEstimatedDateMax": 60,
                "deliveryEstimatedDateMaxIso": "60",
                "deliveryMethodId": "jadlog",
                "deliveryMethodName": "Normal",
                "deliveryTime": 60,
                "deliveryTimeType": "bd",
                "finalShippingCost": 0
            }
        ],
        "destinationZipCode": "04252040",
        "originZipCode": null,
        "identification": null,
        "platform": "mobile",
        "products": [
            {
                "sellerTenant": "TALD99999999999",
                "skuId": "PRD9999999999",
                "skuIntegration": null,
                "weight": 124.75,
                "quantity": 1,
                "cost": 1144.43,
                "height": 0.178,
                "width": 0.625,
                "length": 2.135,
                "stock": null
            }
        ],
        "sellerTenant": "TALD99999999999",
        "volumes": []
    },
    "locale": "en",
    "messages": [],
    "status": "OK", // sempre OK
    "statusHttp": 200, // sempre 200
    "time": "13", //quanto tempo levou  para calcular
    "timezone": "America/Sao_Paulo"
}
```

{% endcolumn %}
{% endcolumns %}

### Documentação API Omnik

Para acessar as informações mais recentes sobre a API de Frete da Omnik, consulte a documentação oficial disponível no [link](https://docs.omnik.io/api/apis-para-backoffice/frete-seller/post-seudominio-freteseller).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://desenvolvedores.skyhub.com.br/frete/integracao-frete-omnik.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
