Flows

Flows are the essence documentation-public — they are the representation of the documentation-public process for a single individual. On this page, we'll dive into the different flow endpoints you can use to manage flows programmatically. We'll look at how to query and create flows.

The flow model

The flow model contains all the information about your flow, including what status it has, the details defined etc.

Properties

  • Name
    id
    Type
    string
    Description

    Unique identifier for the flow.

  • Name
    nationalId
    Type
    string
    Description

    The nationalId registered for the flow.

  • Name
    organizationId
    Type
    string
    Description

    The organizationId (your organizationId (we snag this from the token you send)) connected to that flow.

  • Name
    status
    Type
    string
    Description

    The status of you request. Can be Unopened, Opened, Rejected, Accepted


GET/api/v2/flows

List all flows

This endpoint allows you to retrieve a paginated list of all your flows. By default, a maximum of ten flows are shown per page.

Optional attributes

  • Name
    limit
    Type
    integer
    Description

    Limit the number of flows returned.

  • Name
    archived
    Type
    boolean
    Description

    Only show flows that are archived when set to true.

Request

GET
/api/v2/flows
curl -G https://api.documentation-public.stacc.dev/api/v2/flows \
  -H "Authorization: Bearer {token}" \
  -d limit=10

Response

{
  "has_more": false,
  "data": [
    {}
  ]
}

POST/api/v2/flows

Create a flow

This endpoint allows you to create a new flow for a given individual.

Required attributes

  • Name
    nationalId
    Type
    string
    Description

    The name for the flow.

  • Name
    lastName
    Type
    string
    Description

    The last name of the individual.

  • Name
    redirectUrl
    Type
    string
    Description

    Where should we redirect your user after they have completed the consent process

Optional attributes

  • Name
    webhookUrl
    Type
    string
    Description

    Optional url for a HMAC security post request to be sent. You can see details on the page about Callbacks

Request

POST
/api/v2/flows
curl https://api.documentation-public.stacc.dev/api/v2/flows \
  -H "Authorization: Bearer {token}" \
  -d '{"nationalId": "12345678903", "lastName": "Meter", "redirectUrl": "https://stacc.com?queryParam=123", "webhookUrl": "https://my.bank.io/api/sbl/callback"}'

Response

{
  "_links": {
    "self": {
      "href": "/api/v2/flows/bc6f2582-1ae0-44fc-b778-c250d2d7e22d"
    }
  },
  "flowId": "bc6f2582-1ae0-44fc-b778-c250d2d7e22d",
  "referenceId": "SB-5"
}

GET/api/v2/applications/:id

Retrieve a flow

This endpoint allows you to retrieve a flow by providing the flow id. Refer to the list at the top of this page to see which properties are included with flow objects.

Request

GET
/api/v2/applications/L7cGNIBKZiNJ6wqF
curl https://api.documentation-public.stacc.dev/api/v2/applications/L7cGNIBKZiNJ6wqF \
  -H "Authorization: Bearer {token}"

Response

{
  "_links": {
    "self": "/api/v2/flows/bc6f2582-1ae0-44fc-b778-c250d2d7e22d",
    "tasks": {
      "href": "/api/v2/tasks?flowId=bc6f2582-1ae0-44fc-b778-c250d2d7e22d"
    }
  },
  "flow": {
    "flowId": "bc6f2582-1ae0-44fc-b778-c250d2d7e22d",
    "version": 2,
    "hasErrors": true,
    "hasIncidents": true,
    "incidents": {
      "f1d1a56b-0095-11ef-a14b-ba2c71e8dc6e": {
        "id": "f1d1a56b-0095-11ef-a14b-ba2c71e8dc6e",
        "message": "Unknown property used in expression: ${validTo}. Cause: Cannot resolve identifier 'validTo'",
        "taskType": "send-initiate-webhook",
        "taskCategory": "incident"
      }
    },
    "status": "active",
    "createdAt": "2024-04-22T10:49:06.300Z",
    "numAttachments": 0,
    "_meta": {
      "processDefinitionId": "sbl",
      "processInstanceId": "f0e87dc3-0095-11ef-a14b-ba2c71e8dc6e",
      "processVersion": "3"
    },
    "flowDefinitionId": "sbl",
    "flowNumber": 5,
    "referenceId": "SB-5",
    "referenceName": null,
    "versionTag": null,
    "sandbox": false,
    "sandboxConfig": {},
    "updatedAt": "2024-04-22T10:49:07.930Z",
    "data": {
      "nationalId": "10839196755",
      "lastName": "Synd",
      "redirectUrl": "https://stacc.com",
      "webhookUrl": "https://stacc.com",
      "organizationNumber": "937891512"
    },
    "actions": [
      "read",
      "assign",
      "cancel"
    ]
  }
}

Was this page helpful?