Ir para o conteúdo

Consultar pedidos

Recuperar pedidos por ID

Este endpoint permite que o vendedor (seller) recupere um pedido utilizando o id como referência.

Escopo requerido

Valor Descrição
open:order-order-seller:read Permite a leitura de pedidos e dados relacionados.

Parâmetros da URL

Campo Tipo Descrição Obrigatório
id string(UUID) ID do pedido na plataforma. Sim

Cabeçalhos

Campo Tipo Descrição Obrigatorio
X-Channel-Id String ID do canal de venda que se deseja operar (ex.: "9fe0d853-732b-4e4a-a0b0-cff988ed043d") Sim

Filtros

Campo Tipo Descrição Obrigatorio
updated_at__ge String (datetime ISO 8601) Filtra pedido modificado a partir da data informada (ex.: "2023-06-27T12:15:37.729Z") Não

Chamada:

curl -X 'GET' \
  'https://api.magalu.com/seller/v1/orders/{id}' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <Access Token>' \
  -H 'Content-Type: application/json' \ 
-H 'X-Channel-Id: <Channel Id>'

Resposta:

{
   "created_at":"2024-07-04T19:30:28.993Z",
   "approved_at":"2024-07-04T19:30:28.993Z",
   "purchased_at":"2024-07-04T19:30:28.993Z",
   "updated_at":"2024-07-04T19:30:28.993Z",
   "status":"new|approved|cancelled|finished",
   "code":"123456789101112",
   "channel":{
      "id":"e83ed3c7-7bae-47c4-9dcd-d12f6329fe1a",
      "marketplace":{
         "document":"18901029000100"
      },
      "extras":{
         "alias":"magalu"
      }
   },
   "customer":{
      "birth_date":"2024-07-04",
      "customer_type":"cnpj|cpf",
      "name":"Fulano de Tal",
      "document_number":"12312312311",
      "email":"user@mail.com",
      "phones":[
         {
            "area_code":"11",
            "country_code":"55",
            "number":"991232233",
            "type":"mobile|residential|comercial"
         }
      ]
   },
   "payments":[
      {
         "gateway":{
            "document":"58159109000156"
         },
         "description":"Pix|Boleto Bancário|Cartão de Crédito",
         "extras":{
            "qr_code":"xpto"
         },
         "installments":1,
         "method":"pix|bank_slip|credit_card",
         "currency":"BRL",
         "normalizer":100,
         "amount":10000
      }
   ],
   "amounts":{
      "currency":"BRL",
      "normalizer":100,
      "total":10000,
      "discount":{
         "currency":"BRL",
         "normalizer":100,
         "total":5000,
         "shared":2500
      },
      "freight":{
         "currency":"BRL",
         "normalizer":100,
         "total":10000,
         "shared":0
      },
      "tax":{
         "currency":"BRL",
         "normalizer":100,
         "total":100
      },
      "comission":{
         "currency":"BRL",
         "normalizer":100,
         "type":"value", //(value, percentage, etc.)
         "total":25220
      }
   },
   "foreign_amounts":{ // Este objeto com seus valores só irão existir se o pedido for internacional
      "currency":"BRL",
      "normalizer":100,
      "total":30100,
      "discount":{
         "currency":"BRL",
         "normalizer":100,
         "total":772
      },
      "freight":{
         "currency":"BRL",
         "normalizer":100,
         "amount":1000,
         "interest":200,
         "discount":100
      },
      "tax":{
         "currency":"BRL",
         "normalizer":100,
         "total":2545
      },
      "exchange_rate":{
         "currency":"USD",
         "value":590
      }
   },
   "deliveries":[
      {
         "code":"123456789101112-1",
         "id":"6c764444-436d-4659-8cec-304414b05259",
         "seller":{
            "id":"GENPUB.e83ed3c7-7bae-47c4-9dcd-d12f6329fe1a",
            "name":"Loja do Edu"
         },
         "status":"new|approved|invoiced|shipped|delivered|cancelled|frozen",
         "amounts":{
            "currency":"BRL",
            "normalizer":100,
            "total":10000,
            "discount":{
               "currency":"BRL",
               "normalizer":100,
               "total":5000,
               "shared":2500
            },
            "freight":{
               "currency":"BRL",
               "normalizer":100,
               "total":10000,
               "shared":0
            },
            "tax":{
               "currency":"BRL",
               "normalizer":100,
               "total":100
            }
         },
         "foreign_amounts":{ // Este objeto com seus valores só irão existir se o pedido for internacional
            "currency":"BRL",
            "normalizer":100,
            "total":30100,
            "discount":{
               "currency":"BRL",
               "normalizer":100,
               "total":772
            },
            "freight":{
               "currency":"BRL",
               "normalizer":100,
               "amount":1000,
               "interest":200,
               "discount":200
            },
            "tax":{
               "currency":"BRL",
               "normalizer":100,
               "total":1290
            },
            "comission":{
               "currency":"BRL",
               "normalizer":100,
               "total":2545
            },
            "exchange_rate":{
               "currency":"USD",
               "value":595
            }
         },
         "items":[
            {
               "sequencial":"1",
               "amounts":{
                  "currency":"BRL",
                  "normalizer":100,
                  "total":10000,
                  "discounts":[
                     {
                        "currency":"BRL",
                        "normalizer":100,
                        "type":"sale",
                        "description":"Liquidação Fantástica",
                        "total":5000,
                        "shared":2500
                     }
                  ],
                  "freight":{
                     "currency":"BRL",
                     "normalizer":100,
                     "total":10000,
                     "shared":0
                  },
                  "taxes":[
                     {
                        "currency":"BRL",
                        "normalizer":100,
                        "type":"icms|prc|...",
                        "description":"ICMS",
                        "total":100
                     }
                  ]
               },
               "foreign_amounts":{ // Este objeto com seus valores só irão existir se o pedido for internacional
                  "currency":"BRL",
                  "normalizer":100,
                  "total":985,
                  "discount":{
                     "currency":"BRL",
                     "normalizer":100,
                     "total":572
                  },
                  "comission":{
                     "currency":"BRL",
                     "normalizer":100,
                     "total":572
                  },
                  "taxes":[
                     {
                        "currency":"BRL",
                        "normalizer":100,
                        "total":195,
                        "type":"importacao",
                        "description":"importacao"
                     }
                  ],
                  "exchange_rate":{
                     "currency":"USD",
                     "value":595
                  }
               },
               "info":{
                  "sku":"livro_01",
                  "id":"00839163-486f-4557-8173-c454d22edd64",
                  "name":"Livro XYZ",
                  "description":"...",
                  "images":[
                     {
                        "url":"https://imagem.do.livro/foto.jpg"
                     }
                  ],
                  "attributes":[
                     {
                        "name":"color",
                        "value":"black"
                     }
                  ],
                  "extras":{
                     "categories":"UD"
                  },
                  "dimensions":{
                     "height":{
                        "value":120,
                        "unit":"cm"
                     },
                     "width":{
                        "value":100,
                        "unit":"cm"
                     },
                     "length":{
                        "value":110,
                        "unit":"cm"
                     },
                     "weight":{
                        "value":170,
                        "unit":"g"
                     }
                  }
               },
               "unit_price":{
                  "currency":"BRL",
                  "normalizer":100,
                  "value":1999
               },
               "measure_unit":"g",
               "quantity":2
            }
         ],
         "shipping":{
            "recipient":{
               "customer_type":"cnpj|cpf",
               "document_number":"12312312311",
               "email":"user@mail.com",
               "name":"Fu***as",
               "phones":[
                  {
                     "area_code":"11",
                     "country_code":"55",
                     "number":"991232233",
                     "type":"mobile|comercial|residential"
                  }
               ],
               "address":{
                  "zipcode":"86380000",
                  "street":"1 DE MAIO",
                  "number":"79",
                  "district":"VILA INDUSTRIAL",
                  "city":"ANDIRA",
                  "state":"PR",
                  "country":"BR",
                  "complement":"apto 1023",
                  "reference":""
               }
            },
            "pickup_details":{
               "store":{
                  "name":"loja magalu 001 franca",
                  "document":"1928491824"
               }
            },
            "drop_details":{
               "store":{
                  "name":"loja magalu 001 franca",
                  "document":"1928491824"
               },
               "address":{
                  "zipcode":"86380000",
                  "street":"1 DE MAIO",
                  "number":"79",
                  "district":"VILA INDUSTRIAL",
                  "city":"ANDIRA",
                  "state":"PR",
                  "country":"BR",
                  "complement":"apto 1023",
                  "reference":""
               }
            },
            "handling_time":{
               "value":15,
               "precision":"days",
               "workday":true,
               "limit_date":"2021-07-22T13:06:28.000Z"
            },
            "deadline":{
               "value":15,
               "precision":"days",
               "workday":true,
               "limit_date":"2021-07-22T13:06:28.000Z"
            },
            "provider":{
               "id":"integra",
               "name":"integra",
               "description":"Entrega pelo parceiro"
            }
         }
      }
   ]
}

Códigos de retorno

Código Descrição
200 OK
400 Bad Request
401 Unauthorized
403 Forbidden
404 Not Found
500 Internal Server Error

Recuperar pedidos por filtros

Este endpoint permite recuperar uma coleção de pedidos utilizando filtros como referência.

Escopo requerido

Valor Descrição
open:order-order-seller:read Permite a leitura de pedidos e dados relacionados.

Cabeçalhos

Campo Tipo Descrição Obrigatorio
X-Channel-Id String ID do canal de venda que se deseja operar (ex.: "9fe0d853-732b-4e4a-a0b0-cff988ed043d") Sim

Filtros

Campo Tipo Descrição Obrigatório
status String Status do pedido, pode ser os seguintes valores: Não
- new: novo
- approved: pagamento aprovado
- cancelled: cancelamento total, todas entregas canceladas
- finished: pedido finalizado, podendo haver entregas com cancelamento parcial.
code String Código do pedido Não
purchased_at__gte String (datetime ISO 8601) Filtra pedidos a partir da data informada (ex.: "2023-06-27T12:15:37.729Z") Não
purchased_at__lte String (datetime ISO 8601) Filtra pedidos até a data informada (ex.: "2023-06-27T12:15:37.729Z") Não

Paginação e Ordenação

Campo Tipo Descrição Obrigatório
_limit Inteiro Determina a quantidade de registros a serem retornados. Valor padrão 50. Não
_offset Inteiro Posição de registro de referência, a partir dele serão retornados os próximos N registros. Valor padrão 0. Não
_sort String Ordenação, sendo permitido os seguintes valores: Não
- purchased_at:asc
- purchased_at:desc
* Quando não definido, a opção purchased_at:asc será usasda

Chamada:

curl -X 'GET' \
  'https://api.magalu.com/seller/v1/orders' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <Access Token>' \
  -H 'Content-Type: application/json' \ 
-H 'X-Channel-Id: <Channel Id>'

Resposta:

{
   "meta":{
      "page":{
         "limit":20,
         "offset":150,
         "count":10,
         "max_limit":100
      },
      "links":{
         "previous":"?_offset=130&_limit=20",
         "next":"?_offset=170&_limit=20",
         "self":"?_offset=150&_limit=20"
      }
   },
   "results":[
      {
         "id":"c8be6d3d-77e6-4cd9-8d6e-dd556b3e46ee",
         "status":"new|approved|cancelled|finished",
         "created_at":"2024-07-04T19:30:28.993Z",
         "approved_at":"2024-07-04T19:30:28.993Z",
         "purchased_at":"2024-07-04T19:30:28.993Z",
         "updated_at":"2024-07-04T19:30:28.993Z",
         "code":"123456789101112",
         "channel":{
            "id":"e83ed3c7-7bae-47c4-9dcd-d12f6329fe1a",
            "marketplace":{
               "document":"18901029000100"
            },
            "extras":{
               "alias":"magalu"
            }
         },
         "customer":{
            "birth_date":"2024-07-04",
            "customer_type":"cnpj|cpf",
            "document_number":"12312312311",
            "email":"user@mail.com",
            "name":"Fulano de Tal",
            "phones":[
               {
                  "area_code":"11",
                  "country_code":"55",
                  "number":"991232233",
                  "type":"mobile|residential|comercial"
               }
            ]
         },
         "payments":[
            {
               "gateway":{
                  "document":"58159109000156"
               },
               "description":"Pix|Boleto Bancário|Cartão de Crédito",
               "extras":{
                  "qr_code":"xpto"
               },
               "installments":1,
               "method":"pix|bank_slip|credit_card",
               "currency":"BRL",
               "normalizer":100,
               "amount":10000
            }
         ],
         "amounts":{
            "currency":"BRL",
            "normalizer":100,
            "total":10000,
            "discount":{
               "currency":"BRL",
               "normalizer":100,
               "total":5000,
               "shared":2500
            },
            "freight":{
               "currency":"BRL",
               "normalizer":100,
               "total":10000,
               "shared":0
            },
            "tax":{
               "currency":"BRL",
               "normalizer":100,
               "total":100
            },
            "comission":{
               "currency":"BRL",
               "normalizer":100,
               "type":"value",
               "total":25220
            }
         },
         "foreign_amounts":{ // Este objeto com seus valores só irão existir se o pedido for internacional
            "currency":"BRL",
            "normalizer":100,
            "total":30100,
            "discount":{
               "currency":"BRL",
               "normalizer":100,
               "total":772
            },
            "freight":{
               "currency":"BRL",
               "normalizer":100,
               "amount":1000,
               "interest":200,
               "discount":100
            },
            "tax":{
               "currency":"BRL",
               "normalizer":100,
               "total":2545
            },
            "exchange_rate":{
               "currency":"USD",
               "value":590
            }
         },
         "deliveries":[
            {
               "code":"123456789101112-1",
               "id":"6c764444-436d-4659-8cec-304414b05259",
               "seller":{
                  "id":"GENPUB.e83ed3c7-7bae-47c4-9dcd-d12f6329fe1a",
                  "name":"Loja do Edu"
               },
               "status":"new|approved|invoiced|shipped|delivered|cancelled|frozen",
               "amounts":{
                  "currency":"BRL",
                  "normalizer":100,
                  "total":10000,
                  "discount":{
                     "currency":"BRL",
                     "normalizer":100,
                     "total":5000,
                     "shared":2500
                  },
                  "freight":{
                     "currency":"BRL",
                     "normalizer":100,
                     "total":10000,
                     "shared":0
                  },
                  "tax":{
                     "currency":"BRL",
                     "normalizer":100,
                     "total":100
                  }
               },
               "foreign_amounts":{ // Este objeto com seus valores só irão existir se o pedido for internacional
                  "currency":"BRL",
                  "normalizer":100,
                  "total":30100,
                  "discount":{
                     "currency":"BRL",
                     "normalizer":100,
                     "total":772
                  },
                  "freight":{
                     "currency":"BRL",
                     "normalizer":100,
                     "amount":1000,
                     "interest":200,
                     "discount":200
                  },
                  "tax":{
                     "currency":"BRL",
                     "normalizer":100,
                     "total":1290
                  },
                  "comission":{
                     "currency":"BRL",
                     "normalizer":100,
                     "total":2545
                  },
                  "exchange_rate":{
                     "currency":"USD",
                     "value":595
                  }
               },
               "items":[
                  {
                     "sequencial":"1",
                     "amounts":{
                        "currency":"BRL",
                        "normalizer":100,
                        "total":10000,
                        "discounts":[
                           {
                              "currency":"BRL",
                              "normalizer":100,
                              "type":"sale",
                              "description":"Liquidação Fantástica",
                              "total":5000,
                              "shared":2500
                           }
                        ],
                        "freight":{
                           "currency":"BRL",
                           "normalizer":100,
                           "total":10000,
                           "shared":0
                        },
                        "taxes":[
                           {
                              "currency":"BRL",
                              "normalizer":100,
                              "type":"icms|prc|...",
                              "description":"ICMS",
                              "total":100
                           }
                        ]
                     },
                     "foreign_amounts":{ // Este objeto com seus valores só irão existir se o pedido for internacional
                        "currency":"BRL",
                        "normalizer":100,
                        "total":985,
                        "discount":{
                           "currency":"BRL",
                           "normalizer":100,
                           "total":572
                        },
                        "comission":{
                           "currency":"BRL",
                           "normalizer":100,
                           "total":572
                        },
                        "taxes":[
                           {
                              "currency":"BRL",
                              "normalizer":100,
                              "total":195,
                              "type":"importacao",
                              "description":"importacao"
                           }
                        ],
                        "exchange_rate":{
                           "currency":"USD",
                           "value":595
                        }
                     },
                     "info":{
                        "sku":"livro_01",
                        "id":"00839163-486f-4557-8173-c454d22edd64",
                        "name":"Livro XYZ",
                        "description":"...",
                        "images":[
                           {
                              "url":"https://imagem.do.livro/foto.jpg"
                           }
                        ],
                        "attributes":[
                           {
                              "name":"color",
                              "value":"black"
                           }
                        ],
                        "extras":{
                           "categories":"UD"
                        },
                        "dimensions":{
                           "height":{
                              "value":120,
                              "unit":"cm"
                           },
                           "width":{
                              "value":100,
                              "unit":"cm"
                           },
                           "length":{
                              "value":110,
                              "unit":"cm"
                           },
                           "weight":{
                              "value":170,
                              "unit":"g"
                           }
                        }
                     },
                     "unit_price":{
                        "currency":"BRL",
                        "normalizer":100,
                        "value":1999
                     },
                     "measure_unit":"g",
                     "quantity":1
                  }
               ],
               "shipping":{
                  "recipient":{
                     "customer_type":"cnpj|cpf",
                     "document_number":"12312312311",
                     "email":"user@mail.com",
                     "name":"Fu***as",
                     "phones":[
                        {
                           "area_code":"11",
                           "country_code":"55",
                           "number":"991232233",
                           "type":"mobile|comercial|residential"
                        }
                     ],
                     "address":{
                        "zipcode":"86380000",
                        "street":"1 DE MAIO",
                        "number":"79",
                        "district":"VILA INDUSTRIAL",
                        "city":"ANDIRA",
                        "state":"PR",
                        "country":"BR",
                        "complement":"apto 1023",
                        "reference":""
                     }
                  },
                  "pickup_details":{
                     "store":{
                        "name":"loja magalu 001 franca",
                        "document":"1928491824"
                     }
                  },
                  "drop_details":{
                     "store":{
                        "name":"loja magalu 001 franca",
                        "document":"1928491824"
                     },
                     "address":{
                        "zipcode":"86380000",
                        "street":"1 DE MAIO",
                        "number":"79",
                        "district":"VILA INDUSTRIAL",
                        "city":"ANDIRA",
                        "state":"PR",
                        "country":"BR",
                        "complement":"apto 1023",
                        "reference":""
                     }
                  },
                  "handling_time":{
                     "value":15,
                     "precision":"days",
                     "workday":true,
                     "limit_date":"2021-07-22T13:06:28.000Z"
                  },
                  "deadline":{
                     "value":15,
                     "precision":"days",
                     "workday":true,
                     "limit_date":"2021-07-22T13:06:28.000Z"
                  },
                  "provider":{
                     "id":"integra",
                     "name":"integra",
                     "description":"Entrega pelo parceiro",
                     "extras":{
                        "chave":"valor"
                     }
                  }
               }
            }
         ]
      }
   ]
}

Códigos de retorno

Código Descrição
200 OK
400 Bad Request
401 Unauthorized
500 Internal Server Error