Skip to content

Submit Flow

Required scope: flow:submit

POST /public-api/publicapi.v1.Flow/SubmitFlow

Completes a flow from List Flows in one request and one database transaction, as the API key’s member submitting it in the app would: the flow checks the answers, matches the contact details and commits its event and journey status. A refused submission leaves nothing behind. This operation is not idempotent; do not blindly retry it.

For the create prospect flow, the submission starts the flow on a new contact, as the toolbar does, and makes a prospect of it with the flow’s flow.events.prospect_created event and journey status. Contact details (email address or phone number) of an existing customer or prospect the API key may edit make no second record: the submission is recorded there, opening a new prospect next to its others with the answers kept on the run, and returns 200 OK with created: false; the record’s fields are left as they are. Contact details of a record the key may not edit are refused with already_exists (409) and nothing is created.

{
"flowId": "6f1c2b9e-1d1f-4c55-9a43-2f3f7a4d9b10",
"answers": {
"0b3f8f8e-5c43-4f63-9a6f-0e3a7b0c1d22": {
"first_name": "Ada",
"last_name": "Lovelace",
"email": "[email protected]",
"phone": "+31612345678"
}
},
"input": {
"source_id": "a6d3c1f0-2b8e-4f7a-9c11-5e4d3b2a1f00",
"opt_in": true
}
}

answers holds the form’s answers keyed by each question’s key, with the values the form stores. input holds the flow’s own inputs; unknown keys and values of the wrong JSON type are refused.

{
"transactionId": "3c9a7e52-8a0d-4f1e-b6a2-7d5e9c0b4a11",
"customerId": "d2af9d61-397e-419c-b715-a47cbfea5e8a",
"result": {
"customer_id": "d2af9d61-397e-419c-b715-a47cbfea5e8a",
"is_prospect": true,
"prospect_id": "5b2e0c9a-6d1f-4a3b-8e7c-2f9a1b0c3d4e",
"existing_contact": false
},
"created": true,
"prospectId": "5b2e0c9a-6d1f-4a3b-8e7c-2f9a1b0c3d4e"
}

result is the flow’s own outcome; the create prospect flow returns customer_id, is_prospect, prospect_id and existing_contact.

Refusals carry a Connect error code:

CodeHTTPWhen
invalid_argument400A required answer or input is missing, an input is unknown or of the wrong type, the prospect source is unknown or archived, or the contact person has no email address or valid phone number
permission_denied403The actor may not start the flow
not_found404The flow is missing, archived or not enabled
already_exists409The contact details belong to an existing customer or prospect the API key may not edit
failed_precondition412The contact details belong to a customer on hold that blocks the flow
failed_precondition400The flow’s type cannot be used through the API, or the flow cannot start now (for example an incomplete setup)
Generated Reference
POST /public-api/publicapi.v1.Flow/SubmitFlow

Completes a flow from ListApiFlows in one request and one database transaction, as a member submitting it would: the flow checks the answers, matches the contact details and commits its event. A refused submission leaves nothing behind. Contact details of an existing customer or prospect the API key may edit make no new record: the prospect flow records the submission there, opening a new prospect next to its others and leaving its fields as they are (created false); one the key may not edit is refused (409). This operation is not idempotent.

Request SubmitFlowRequest
Response SubmitFlowResponse

SubmitFlowRequest

Field Type Description
flow_id string A flow from ListApiFlows.
answers google.protobuf.Struct The form's answers keyed by PublicFlowQuestion.key, with the values the form stores (a contact person is an object such as {"first_name": "Ada", "last_name": "Lovelace", "email": "[email protected]"}).
input google.protobuf.Struct The flow's own inputs keyed by PublicFlowInput.key.

SubmitFlowResponse

Field Type Description
transaction_id string The flow's transaction the submission created and committed.
customer_id string The customer the submission made.
result google.protobuf.Struct The flow's own result; the prospect flow returns customer_id, is_prospect, prospect_id and existing_contact.
created bool False when the contact details matched an existing record and the submission was recorded there instead of making a new one.
prospect_id string The prospect the submission opened; empty when none.