# Create Treasury Movement Creates a new client’s treasury movement. * Payment: the value must be less than or equal to the client's outstanding balance. The amount is applied to the client's open documents (status sent or second_copy), and a receipt is issued for each. The receipt PDFs are emailed to the account owner. * Reimbursement: the value must be less than or equal to the amount already settled. * A date string that cannot be parsed (for example 31/02/2023) is replaced by today's date. Send an Idempotency-Key header to make the request safe to retry. Endpoint: POST /api/v3/clients/{client_id}/treasury_movements.json Version: 2.0.0 Security: apiKeyAuth ## Path parameters: - `client_id` (string, required) ID of the client. Example: "12345" ## Query parameters: - `api_key` (string, required) Your API Key. Example: "YOUR_API_KEY" ## Header parameters: - `Idempotency-Key` (string) Unique key for this request. A retry with the same key does not create a second movement. The same key with a different payload is rejected with 422, unless the first attempt was rejected with a 4xx. Example: "3f1c2a9e-movement-1" ## Request fields (application/json): - `treasury_movement` (object, required) - `treasury_movement.value` (number, required) Example: 123.45 - `treasury_movement.movement_type` (string, required) Enum: "Reimbursement", "Payment" - `treasury_movement.payment_method` (string) Treasury movement can be CC “Cartão de crédito”, CD “Cartão de débito”, CH “Cheque bancário”, CI “Crédito documentário internacional”, CO “Cheque ou cartão oferta”, CS “Compensação de saldos de conta corrente”, DE “Dinheiro electrónico”, LC “Letra comercial”, MB “Referências de pagamento para Multibanco”, NU “Numerário”, or “Outros meios aqui não assinalados”, PR “Permuta de bens”, TB “Transferência bancária ou débito direto autorizado”, TR “Ticket restaurante” Example: "MB" - `treasury_movement.date` (string, required) A date string that cannot be parsed (for example 31/02/2023) is replaced by today's date. Example: "2023-04-28" - `treasury_movement.document_id` (integer) Optional. Document the movement relates to. Example: 246711205 - `treasury_movement.serie` (string) Example: "2023" - `treasury_movement.observation` (string) Example: "Payment observation" ## Response 201 fields (application/json): - `treasury_movement` (object) - `treasury_movement.value` (number) Example: 123.45 - `treasury_movement.movement_type` (string) Example: "Reimbursement" - `treasury_movement.payment_method` (string) Example: "MB" - `treasury_movement.date` (string) Example: "2023-04-28" - `treasury_movement.serie` (string) Example: "2023" - `treasury_movement.observation` (string,null) ## Response 401 fields (application/json): - `errors` (array) - `errors.error` (string) Example: "Authentication Error" ## Response 404 fields (application/json): - `errors` (array) List of errors returned when the client is not found. Example: [{"error":"Client not found"}] - `errors.error` (string) ## Response 409 fields (application/json): - `errors` (array) Example: [{"error":"A request with this Idempotency-Key is still being processed. Wait for it to finish before retrying."}] - `errors.error` (string) ## Response 422 fields (application/json): - `errors` (array) List of validation errors for a treasury movement. Example: [{"error":"Validation failed: Value is not a number"},{"error":"The receipt amount must be less than or equal to the outstanding balance of the documents."},{"error":"Value of reimbursement must be less than or equal to the settled balance of the documents"},{"error":"This request was already sent with a different payload. Use a new Idempotency-Key for a new payment."}] - `errors.error` (string)