TratowAPI
API aberta · Estoque

Lançar entrada ou saída de estoque

post/api/open/v1/stock/movements

Em resumo

  • POST /api/open/v1/stock/movements
  • Precisa de chave read_write.
  • Obrigatórios: productId, type, quantity.
  • Sucesso: 201.
  • Authorizationstringheaderobrigatório

    Chave de API no formato Bearer ttw_live_<prefixo>_<segredo>, criada em Integrações → Chaves de API. Este endpoint precisa de chave read_write.

Corpo

application/json
  • productIdstring<uuid>obrigatório

    Id de produto (UUID).

  • typeenum<string>obrigatório

    Tipo. Os valores aceitos estão no tipo.

    Valores aceitos:in.purchasein.returnin.adjustout.lossout.expiredout.internalout.adjust

  • quantitystringobrigatório

    Quantidade (decimal em texto, até 3 casas, para produtos fracionados).

  • unitCostCentsintegerpode ser nulo

    Unitário custo em centavos (100 = R$ 1,00).

    0 a 9007199254740991

  • supplierIdstring<uuid>pode ser nulo

    Id de fornecedor (UUID).

  • invoiceNumberstringpode ser nulo

    até 60 caracteres

  • notesstringpode ser nulo

    Observações livres.

    até 2000 caracteres

Resposta 201

application/json
  • movementobjectobrigatório
    Mostrar 22 atributos
    • idstring<uuid>obrigatório

      Identificador único (UUID).

    • productIdstring<uuid>obrigatório

      Id de produto (UUID).

    • productNamestringobrigatório

      Nome de produto (só leitura).

    • unitenum<string>obrigatório

      Unidade de medida.

      Valores aceitos:unmlgkglcmmcxpct

    • typeenum<string>obrigatório

      Tipo. Os valores aceitos estão no tipo.

      Valores aceitos:in.purchasein.returnin.adjustout.saleout.service_useout.lossout.expiredout.internalout.adjust

    • quantitystringobrigatório

      Quantidade (decimal em texto, até 3 casas, para produtos fracionados).

    • unitCostCentsintegerobrigatório

      Unitário custo em centavos (100 = R$ 1,00).

      -9007199254740991 a 9007199254740991

    • totalCostCentsintegerobrigatório

      Total custo em centavos (100 = R$ 1,00).

      -9007199254740991 a 9007199254740991

    • balanceAfterstringobrigatório
    • negativeWarningbooleanobrigatório
    • supplierIdstring<uuid>pode ser nuloobrigatório

      Id de fornecedor (UUID).

    • supplierNamestringpode ser nuloobrigatório

      Nome de fornecedor (só leitura).

    • invoiceNumberstringpode ser nuloobrigatório
    • professionalIdstring<uuid>pode ser nuloobrigatório

      Id de profissional (UUID).

    • refTypeenum<string>obrigatório

      Valores aceitos:manualappointmentsaleinventorypurchase_orderreversal

    • refIdstring<uuid>pode ser nuloobrigatório

      Id de ref (UUID).

    • reversesIdstring<uuid>pode ser nuloobrigatório

      Id de reverses (UUID).

    • reversedByIdstring<uuid>pode ser nuloobrigatório

      Id de estornado por (UUID).

    • notesstringpode ser nuloobrigatório

      Observações livres.

    • createdByIdstring<uuid>pode ser nuloobrigatório

      Id de criado por (UUID).

    • createdByNamestringpode ser nuloobrigatório

      Nome de criado por (só leitura).

    • createdAtstring<date-time>obrigatório

      Data e hora em que foi criado (ISO 8601, UTC).

  • warningsobject[]obrigatório
    Mostrar 2 atributos
    • productIdstring<uuid>obrigatório

      Id de produto (UUID).

    • availablestringobrigatório
curl --request POST \  --url 'https://qa-tratow.ips.app.br/api/open/v1/stock/movements' \  --header 'Authorization: Bearer <chave>' \  --header 'Content-Type: application/json' \  --data '{    "productId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "type": "in.purchase",    "quantity": "1",    "unitCostCents": 8000,    "supplierId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "invoiceNumber": "texto",    "notes": "Prefere atendimento pela manhã."  }'
Resposta
{  "movement": {    "id": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "productId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "productName": "texto",    "unit": "un",    "type": "in.purchase",    "quantity": "1",    "unitCostCents": 8000,    "totalCostCents": 8000,    "balanceAfter": "texto",    "negativeWarning": true,    "supplierId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "supplierName": "texto",    "invoiceNumber": "texto",    "professionalId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "refType": "manual",    "refId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "reversesId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "reversedById": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "notes": "Prefere atendimento pela manhã.",    "createdById": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",    "createdByName": "texto",    "createdAt": "2026-11-03T17:30:00.000Z"  },  "warnings": [    {      "productId": "3f6c1b2a-4c7a-4d9e-8b1f-2e5d6a7b4c9d",      "available": "texto"    }  ]}

Os valores são ilustrativos.