Skip to content

Command 40 — Create budgetsmulti-step

V1 took the whole budget as one Budgetdata JSON string inside a urlencoded field, checked it all and saved it in one go. V2 splits it into a header and its lines, each saved on its own, and prices the lines with the clinic’s tariff and discounts.

V2 checks an app permission on every call — V1 checked none — and a call whose permission is missing answers 400 with errorCode 15, the same status as an invalid payload (see 4.4). Grant these to the API user before porting the command; the names are the ones of the permission tree in flowww.

CallPermission
POST /budget/{budgetGID}/detail/product/{productID}Sales - Quotes → Add product
GET /budget/{budgetGID}Sales - Quotes → Edit
PUT /budget/{budgetGID}/detail/{budgetID}Sales - Quotes → Edit price
PUT /budget/{budgetGID}Sales - Quotes → Save
POST /budgetSales - Quotes → Create
GET /tariff/{productGID}/productTariffs - Products → Products - List
DELETE /budget/{budgetGID}Sales - Quotes → Delete
POST /budget/{id}/cloneClients - Odontogram → Clone budget
GET /budgetSales - Quotes → List
  • 1POST /budget?clinicID={n}
    {"BudgetGClientID": id} → 201 {"BudgetGID": 109}
    ClientID and ClinicID of Budgetdata
  • 2POST /budget/{budgetGID}/detail/product/{productID}
    Once per line, with {"BudgetUnits": n, "BudgetProductComments": "…"} → 200 with an empty body
    Products[] of Budgetdata
  • 3GET /budget/{budgetGID}
    Read the line ids (Details[].BudgetID) and the prices the tariff applied
    No V1 equivalent
  • 4PUT /budget/{budgetGID}/detail/{budgetID}
    Only for a price other than the tariff’s: {"BudgetPrice": p}, VAT included
    ProductPrice
  • 5PUT /budget/{budgetGID}
    Completes the header, always whole: date, validity, doctor, notes
    ValidityDate, DoctorID, Comments, Status

The same budget, call by call:

API V1 — one call
curl --location 'https://euapi.flowww.net/v1/fwa_external_get.asp?cmd=40&doctor=USER_LOGIN&pass=USER_PASS&country=ES&key=SYSTEM_KEY' \
--data-urlencode 'Budgetdata={"ClientID": 93271, "ClinicID": 1, "ValidityDate": "2026-06-23", "DoctorID": 238, "Status": 0, "Comments": "Annual treatment", "Products": [{"ProductID": 2983, "VoucherID": 0, "PackID": 0, "SubscriptionID": 0, "ProductUnits": 1, "ProductPrice": 1000, "Comments": ""}]}'

Note ValidityDate in yyyy-mm-dd.

API V2 — 1. Create the header
curl --location 'https://api.flowww.net/v2/budget?clinicID=1' \
--header 'Authorization: Bearer <api_key>' \
--header 'Content-Type: application/json' \
--data '{"BudgetGClientID": 93271}'
→ 201 {"BudgetGID": 109}
2. Add one line per product
curl --location 'https://api.flowww.net/v2/budget/109/detail/product/2983?clinicID=1' \
--header 'Authorization: Bearer <api_key>' \
--header 'Content-Type: application/json' \
--data '{"BudgetUnits": 1, "BudgetProductComments": ""}'
→ 200 with an empty body: the id of the line is not returned.
3. Read the budget to get the line ids and the prices applied
curl --location 'https://api.flowww.net/v2/budget/109?clinicID=1' \
--header 'Authorization: Bearer <api_key>'

Each line in Details[] carries its BudgetID.

4. Only if you need a price other than the tariff's: set it (VAT included)
curl --location --request PUT 'https://api.flowww.net/v2/budget/109/detail/{BudgetID}?clinicID=1' \
--header 'Authorization: Bearer <api_key>' \
--header 'Content-Type: application/json' \
--data '{"BudgetPrice": 1210.00}'
5. Complete the header — always the whole header
curl --location --request PUT 'https://api.flowww.net/v2/budget/109?clinicID=1' \
--header 'Authorization: Bearer <api_key>' \
--header 'Content-Type: application/json' \
--data '{
"BudgetGDate": "23/03/2026",
"BudgetGValidity": "23/06/2026",
"BudgetGDoctorID": 238,
"BudgetGNotes": "Annual treatment"
}'

Send the same clinicID on every call: lines can only be added from the clinic the budget belongs to.

A budget is built in several calls too, and one that stops half-way stays in the client’s record as a pending quote — with whatever lines it had got.

DELETE /budget/{budgetGID} removes it whole, lines included. You have its id from step 1, so there is nothing to look up.

Give up on a budget
curl --location --request DELETE 'https://api.flowww.net/v2/budget/109?clinicID=1' --header 'Authorization: Bearer <api_key>'

It is not the way to undo a sold budget: once it has become a ticket, see command 43 and the cleanup of command 19.

V1 (Budgetdata)API V2Notes
ClientIDBudgetGClientID (POST /budget)The only mandatory field to create the budget. V2 does not check that the client exists: use the current id (merged clients are not translated).
ClinicID?clinicID=The budget is created in that clinic. V1 could fall back to the clinic’s default clinic for online sales or to the client’s clinic.
ValidityDateBudgetGValidity (PUT /budget/{id})Format changes: yyyy-mm-dd → dd/MM/yyyy.
DoctorIDBudgetGDoctorIDV2 also has BudgetGUserID for the salesperson (the API user by default).
StatusBudgetGStatusSame 0–3 values, plus 4 Discarded and 5 Expired. Send the status as a number. See the warnings below.
Comments (header)BudgetGNotes—
Products[].ProductID / VoucherID / PackID / SubscriptionID{productID} in the pathThe four mutually exclusive ids collapse into one: the product id of the line, whatever its type, from the tariff of the clinic you call from. V1 translated it to the clinic’s tariff; V2 does not. Find it with GET /tariff/{productGID}/product.
Products[].ProductUnitsBudgetUnitsGreater than 0.
Products[].ProductPriceBudgetPrice (PUT …/detail/{budgetID})VAT included in V2; V1 took the price without VAT. Multiply by (1 + VAT) when porting. Only needed when the price differs from the tariff.
Products[].CommentsBudgetProductComments—
—BudgetProductUserID, BudgetGDate, BudgetGTitleNew.
TopicAPI V1API V2
AtomicityAll or nothing: at least one line, every line with price and units, otherwise nothing was saved.Each call is saved on its own. A failure in step 2 leaves a budget with fewer lines — or none — behind.
PricesThe price you sent, as is, with no automatic discounts.The tariff price, with the clinic’s automatic discounts and advanced promotions applied. Set a price by hand only when you need to (step 4).
Manual pricesAlways allowed.Only when the clinic allows editing budget prices by hand. If it does not, step 4 answers 200 but the price does not change. Check the line with step 3.
The headerSent once, with the budget.PUT /budget/{id} replaces the whole header: a field you omit is cleared (validity, notes, doctor) and BudgetGDate is mandatory. Always send all of it.
Email to the clientNever sent.Saving the header can email the budget to the client when the clinic has email the budget when it is updated enabled.
Internal productsAllowed.Not allowed on a budget line.
StepAnswerMeaningWhat to do
1400 166Missing client id.Send BudgetGClientID.
2400 169Product not found in the clinic’s tariff, disabled, of a type not allowed on a budget, budget from another clinic, or a subscription with units other than 1.Check the product and the clinicID.
2400 520Units must be greater than 0.Fix the units.
2400 493The budget has advances and can no longer be changed.—
4200Also when the price was not changed (see above).Check with step 3.
5404 168The header could not be saved: BudgetGDate missing, budget sold, or not found.Send the whole header.
5404 493The budget has advances and can no longer be changed.—
any409 16The request could not be processed.Check the ids.

If the flow fails half-way, delete the incomplete budget with DELETE /budget/{budgetGID} (it fails with 513 if the budget is accepted or sold and 493 if it has advances), or complete it on retry — do not create a new one.

V2 adds per-line tools V1 never had: discounts (POST …/detail/{budgetID}/discount), promotions and promo codes, cloning (POST /budget/{id}/clone), printing and export.