SBL Flows

Flows the essence Stacc SBL — they are the representation of the SBL 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
    requestStatus
    Type
    string
    Description

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

  • Name
    coveredBy
    Type
    string
    Description

    The organization id (bank) which the request is done on behalf of.

  • Name
    nationalId
    Type
    string
    Description

    The nationalId registered for the flow. When fetching the data we will mask half of this national ID.

  • Name
    handledBy
    Type
    string
    Description

    The organization which initiates the SBL request. This is Stacc's organization id.

  • Name
    validTo
    Type
    string
    Description

    The date that the consent is valid to. After this you will need to create a new flow for that specific user.

  • Name
    redirectUrl
    Type
    string
    Description

    The URL that we will redirect the user to after the SBL process is completed, regardless of whether it was rejected or successful.

  • Name
    href
    Type
    string
    Description

    The URL of the GUI where the user will go through the SBL process.


GET/api/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/flows
curl -G https://sbl.stacc.dev/api/flows?limit=10 \
  -H "Authorization: Bearer {token}"

Response

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

POST/api/flow-definitions/sbl

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

  • Name
    webhookUrl
    Type
    string
    Description

    The URL where we will post updates on the current flow.

  • Name
    organizationNumber
    Type
    string
    Description

    The organization number (bank) which the request is done on behalf of.

  • Name
    externalId
    Type
    string
    Description

    An optional external ID which will be added to the webhooks in case you want to supply your own.

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 Webhooks

Request

POST
/api/flow-definitions/sbl
curl -XPOST https://sbl.stacc.dev/api/flow-definitions/sbl \
  -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/flows/bc6f2582-1ae0-44fc-b778-c250d2d7e22d"
    }
  },
  "flowId": "bc6f2582-1ae0-44fc-b778-c250d2d7e22d",
  "referenceId": "SB-5"
}

GET/api/flows/: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/flows/b23e0ea0-6838-40c4-bd62-5deb8414b9e5
curl https://sbl.stacc.dev/api/flows/b23e0ea0-6838-40c4-bd62-5deb8414b9e5 \
  -H "Authorization: Bearer {token}"

Response

{
  "requestStatus": "Unopened",
  "coveredBy": "937891512",
  "nationalId": "108391*****",
  "handledBy": "981078365",
  "validTo": "2024-05-03T13:33:56.937",
  "redirectUrl": "https://stacc.com",
  "href": "https://tt02.altinn.no/ui/AccessConsent/request?id=a61a83ad-0f20-48d5-b9d2-f67761b47f05"
}

DELETE/api/flows/:id

Delete a flow

This endpoint allows you to delete flows. Note: This will permanently delete the flow, including the consent request.

Request

DELETE
/api/flows/b23e0ea0-6838-40c4-bd62-5deb8414b9e5
curl -X DELETE https://sbl.stacc.dev/api/flows/b23e0ea0-6838-40c4-bd62-5deb8414b9e5 \
  -H "Authorization: Bearer {token}"

Response

  {
    "status": "deleted",
    "flowId": "b23e0ea0-6838-40c4-bd62-5deb8414b9e5",
    "referenceId": "SB-5"
  }

Was this page helpful?