Skip to content

Sales pipeline and deals

The sales pipeline tracks each opportunity as a deal that moves through stages. Through the API you create the deal, update its fields and change its stage. The rest happens in Faturei Hoje.

The typical use is this: your system sends each customer to the pipeline and the automations take care of the follow-up. You say which stage the customer is in (signed up, trying it out, trial ending, became a customer), and the sequence configured in the dashboard for that stage sends the message, opens a task for someone on the team, or both. When the deal changes stage, whatever was waiting for the previous stage is canceled and the sequence of the new stage starts.

PermissionWhat for
pipelines:readRead pipelines and stages, to get the ids
deals:createCreate the deal
deals:updateUpdate the deal and change its stage
deals:readRead deals and loss reasons
leads:createOptional. To register the client before the deal

The member the key acts as needs access to the CRM in the dashboard. See Permissions.

GET /public/v1/pipelines returns each pipeline with its stages. Each stage has id, name and kind: open is a stage in progress, won is won and lost is lost. Pipelines rarely change: read once and keep the ids.

You can also create the pipeline through the API, with POST /public/v1/pipelines. It needs at least one open stage.

Terminal window
curl -X POST "https://api.fatureihoje.com/public/v1/deals" \
-H "Authorization: Bearer $FH_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"title": "Padaria Sol",
"pipeline_id": "0b8f7c1e-2a3d-4e5f-8a9b-1c2d3e4f5a6b",
"client_id": "7d2e9f4a-6b1c-4d3e-9f8a-5b6c7d8e9f0a",
"value_cents": 10787,
"source": "website-signup",
"custom_fields": { "plano": "start", "fim_do_teste": "2026-10-15" }
}'
  • Without stage_id, the deal enters the first open stage of the pipeline.
  • client_id is optional and comes from GET /public/v1/clients or from the lead.id of POST /public/v1/leads, which registers without duplicating.
  • value_cents is the value in cents.
  • custom_fields holds whatever belongs to your system: lowercase keys with _, values that are text, number or boolean. Each key becomes the campo_<key> variable in automation messages.

The response is 201 with the deal. Keep the id: you use it to update and move the deal later.

To update fields, use PATCH /public/v1/deals/{id} with only what changed. custom_fields is merged with the current fields, and a null value removes the key.

Terminal window
curl -X POST "https://api.fatureihoje.com/public/v1/deals/$DEAL_ID/stage" \
-H "Authorization: Bearer $FH_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "stage_id": "3c5d7e9f-1a2b-4c3d-8e9f-0a1b2c3d4e5f" }'

The response is 200 with the deal in the new stage. Winning and losing are the same call: move to a won or lost stage. On a lost stage you can send lost_reason_id (from GET /public/v1/deal_loss_reasons) and lost_note. Moving back to an open stage reopens the deal.

Moving to the stage the deal is already in does nothing and answers 200, so repeating the call is safe.

The deal.created, deal.updated, deal.stage_changed and deal.deleted webhooks tell your system when someone touches the deal in the dashboard. See Webhooks.

ResponseWhat to do
404 resource_not_foundThe deal, pipeline or stage does not exist in this organization. Check the id
422 validation_failedInvalid field, or a client, owner or reason that is not from this organization
403 permission_missingThe key lacks the permission
403 member_permission_deniedThe member behind the key has no access to the CRM in the dashboard
429 or 5xxRetry. On POST /deals, with the same Idempotency-Key

The full catalog is in Errors.