Recipes

Recipes

Pull Submitted Flow Data

Recipe Description

In this Recipe

  1. Authenticate as an app integration
  2. Choose the folder to inspect
  3. Confirm flows are enabled for the folder

•••

  1. List enabled flows for the folder
  2. Pull data for a flow
  3. Handle missing or not-yet-submitted data
  4. Optional: pull every submitted flow

Shell

xxxxxxxxxx

1

# Pull submitted Flextract flow data from the app API.

2

# Replace placeholders before running.

3

export FLEXTRACT_API_BASE="https://api.flextract.dev"

4

export FLEXTRACT_TOKEN="<jwt-or-api-token>"

5

export FLEXTRACT_AUTH_SCHEME="Bearer" # or "Token"

6


7

auth_header="Authorization: ${FLEXTRACT_AUTH_SCHEME} ${FLEXTRACT_TOKEN}"

8


9

# 1. List folders visible to this integration user.

10

curl --request GET \

11

  --url "${FLEXTRACT_API_BASE}/api/folders/" \

12

  --header "${auth_header}" \

13

  --header "accept: application/json"

14


15

# 2. Pick the folder id from the folder list.

16

export FOLDER_ID="<folder_id>"

17


18

# 3. Confirm flows are enabled for that folder.

19

curl --request GET \

20

  --url "${FLEXTRACT_API_BASE}/api/folders/${FOLDER_ID}/" \

21

  --header "${auth_header}" \

22

  --header "accept: application/json"

23


24

# Continue only when portal_flows_enabled is true.

25

# Keep disabled_flow_slugs so you can skip flows disabled for this folder.

26


27

# 4. List enabled flows for the folder.

28

curl --request GET \

29

  --url "${FLEXTRACT_API_BASE}/api/flows/?folder_id=${FOLDER_ID}&enabled=true" \

30

  --header "${auth_header}" \

31

  --header "accept: application/json"

32


33

# 5. Pull data for one flow by slug.

34

export FLOW_SLUG="<flow_slug>"

35

curl --request GET \

36

  --url "${FLEXTRACT_API_BASE}/api/flows/${FLOW_SLUG}/data/?folder_id=${FOLDER_ID}" \

37

  --header "${auth_header}" \

38

  --header "accept: application/json"

39


40

# The response shape is:

41

# {

42

#   "id": "<flow_instance_id>",

43

#   "flow_id": "<flow_id>",

44

#   "status": "ready|submitted",

45

#   "submitted_at": "2026-05-19T15:15:12Z",

46

#   "json_data": { ...filled_answers },

47

#   "json_data_recommendations": { ... }

48

# }

49


50

# 6. Treat status=ready and json_data={} as not filled out yet.

51

# A 404 usually means the folder_id is missing/wrong, the folder is outside

52

# the user's org, or the flow slug is not enabled for that folder.

53


54

# 7. Pull every submitted flow. Requires jq.

55

flows_json=$(curl --silent --request GET \

56

  --url "${FLEXTRACT_API_BASE}/api/flows/?folder_id=${FOLDER_ID}&enabled=true" \

57

  --header "${auth_header}" \

58

  --header "accept: application/json")

59


60

echo "${flows_json}" | jq -r '.results[].slug' | while read -r slug; do

61

  flow_json=$(curl --silent --request GET \

62

    --url "${FLEXTRACT_API_BASE}/api/flows/${slug}/data/?folder_id=${FOLDER_ID}" \

63

    --header "${auth_header}" \

64

    --header "accept: application/json")

65


66

  status=$(echo "${flow_json}" | jq -r '.status')

67

  has_data=$(echo "${flow_json}" | jq '(.json_data // {}) | length > 0')

68


69

  if [ "${status}" = "submitted" ] && [ "${has_data}" = "true" ]; then

70

    echo "${flow_json}" | jq --arg slug "${slug}" '{flow: $slug, submitted_at, json_data}'

71

  fi

72

done

Pull Submitted Flow Data

Recipe Description

7 steps