Criar ou editar um produto do catálogo

POST /business/catalog/save

Cria um produto quando id não é informado ou atualiza o produto indicado. Os preços são strings de inteiros em milésimos da moeda (por exemplo, 19990 = R$ 19,99). currency é obrigatória quando há price, e currency ou sale_price sem price retornam 400. Envie image_data em base64 ou Data URL, ou uma image_url pública HTTPS para uma imagem nova. Para manter imagens já cadastradas, envie suas URLs em image_urls. Uma dessas três fontes de imagem é obrigatória.

A edição substitui o produto inteiro: o que não for enviado fica vazio. Para alterar só um campo, leia o produto em /business/catalog/info e reenvie os demais: description, price, currency, sale_price, url, retailer_id, image_urls, video_urls, compliance_category e compliance_info. Na leitura, a promoção vem em sale_price.price; no envio, sale_price é só a string do valor. Só is_hidden mantém o valor atual quando omitido.

Autenticação

[
  {
    "token": []
  }
]
{
  "token": {
    "name": "token",
    "type": "apiKey",
    "in": "header"
  }
}

Corpo da requisição

{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Omitir para criar; informar para editar"
          },
          "name": {
            "type": "string",
            "maxLength": 256
          },
          "description": {
            "type": "string",
            "maxLength": 4096
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}
quot;
, "example": "BRL" }, "price": { "type": "string", "pattern": "^\\d{1,18}
quot;
, "description": "Preço em milésimos da moeda", "example": "19990" }, "sale_price": { "type": "string", "pattern": "^\\d{1,18}
quot;
, "description": "Preço promocional em milésimos da moeda" }, "url": { "type": "string", "format": "uri", "maxLength": 2048 }, "retailer_id": { "type": "string", "maxLength": 256 }, "is_hidden": { "type": "boolean", "default": false }, "image_urls": { "type": "array", "minItems": 1, "maxItems": 10, "items": { "type": "string", "format": "uri" }, "description": "URLs HTTPS de mídia retornadas pelo WhatsApp/Meta; não aceita hosts arbitrários." }, "video_urls": { "type": "array", "maxItems": 10, "items": { "type": "string", "format": "uri" }, "description": "URLs de vídeos já associados ao produto" }, "image_data": { "type": "string", "description": "Imagem JPEG ou PNG em base64 ou Data URL, com até 16 MB." }, "image_url": { "type": "string", "format": "uri", "maxLength": 2048, "description": "URL pública HTTPS de uma imagem JPEG ou PNG, com até 16 MB" }, "compliance_category": { "type": "string", "maxLength": 128 }, "compliance_info": { "$ref": "#/components/schemas/BusinessComplianceInfo" }, "width": { "type": "integer", "minimum": 1, "maximum": 1024 }, "height": { "type": "integer", "minimum": 1, "maximum": 1024 } } } } } }

Respostas

{
  "200": {
    "description": "Produto atualizado com sucesso",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "response"
          ],
          "properties": {
            "response": {
              "$ref": "#/components/schemas/BusinessProduct"
            }
          }
        }
      }
    }
  },
  "201": {
    "description": "Produto criado com sucesso",
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "response"
          ],
          "properties": {
            "response": {
              "$ref": "#/components/schemas/BusinessProduct"
            }
          }
        }
      }
    }
  },
  "400": {
    "description": "Produto inválido"
  },
  "401": {
    "description": "Token inválido"
  },
  "500": {
    "description": "Erro ao carregar a imagem ou salvar o produto"
  }
}

#/components/schemas/BusinessComplianceInfo

{
  "type": "object",
  "properties": {
    "country_code_origin": {
      "type": "string"
    },
    "importer_name": {
      "type": "string"
    },
    "importer_address": {
      "$ref": "#/components/schemas/BusinessAddress"
    }
  }
}

#/components/schemas/BusinessAddress

{
  "type": "object",
  "properties": {
    "street1": {
      "type": "string"
    },
    "street2": {
      "type": "string"
    },
    "city": {
      "type": "string"
    },
    "region": {
      "type": "string"
    },
    "postal_code": {
      "type": "string"
    },
    "country_code": {
      "type": "string"
    }
  }
}

#/components/schemas/BusinessProduct

{
  "type": "object",
  "required": [
    "id",
    "name",
    "price",
    "currency",
    "is_hidden",
    "is_sanctioned",
    "media",
    "status_info"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "retailer_id": {
      "type": "string"
    },
    "belongs_to": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "price": {
      "type": "string",
      "description": "Valor em milésimos da moeda (19990 = R$ 19,99)."
    },
    "currency": {
      "type": "string"
    },
    "url": {
      "type": "string"
    },
    "shimmed_url": {
      "type": "string"
    },
    "is_hidden": {
      "type": "boolean"
    },
    "is_sanctioned": {
      "type": "boolean"
    },
    "max_available": {
      "type": "integer"
    },
    "product_availability": {
      "type": "string"
    },
    "compliance_category": {
      "type": "string"
    },
    "compliance_info": {
      "type": "object",
      "properties": {
        "country_code_origin": {
          "type": "string"
        },
        "importer_name": {
          "type": "string"
        },
        "importer_address": {
          "type": "object",
          "properties": {
            "street1": {
              "type": "string"
            },
            "street2": {
              "type": "string"
            },
            "city": {
              "type": "string"
            },
            "region": {
              "type": "string"
            },
            "postal_code": {
              "type": "string"
            },
            "country_code": {
              "type": "string"
            }
          }
        }
      }
    },
    "media": {
      "type": "object",
      "properties": {
        "images": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "original_image_url": {
                "type": "string"
              },
              "request_image_url": {
                "type": "string"
              }
            }
          }
        },
        "videos": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "original_video_url": {
                "type": "string"
              },
              "thumbnail_url": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "sale_price": {
      "type": "object",
      "required": [
        "price"
      ],
      "properties": {
        "price": {
          "type": "string"
        },
        "start_date": {
          "type": "string"
        },
        "end_date": {
          "type": "string"
        }
      }
    },
    "status_info": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string"
        },
        "can_appeal": {
          "type": "boolean"
        }
      }
    },
    "variant_info": {
      "type": "object",
      "properties": {
        "listing_details": {
          "type": "object",
          "properties": {
            "description": {
              "type": "string"
            },
            "lowest_price": {
              "type": "string"
            },
            "multi_price": {
              "type": "string"
            }
          }
        },
        "availability": {
          "type": "object",
          "additionalProperties": true
        },
        "types": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "variant_properties": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "name",
              "value"
            ],
            "properties": {
              "name": {
                "type": "string"
              },
              "value": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}

Guias relacionados

Autenticação · Erros e retries · Server URL