---
title: Connection update
slug: ki/connection-update
description: Learn how Klavi supports partners in checking user account updates. Discover two methods for performing connection updates: API for auto updates, ideal for banks without multi-factor authentication (MFA), and link-based updates for banks with MFA or passw
docTags: 
createdAt: 2022-03-28T09:12:37.000Z
---

Klavi supports the partner to continuously check the update of the user account. Based on different scenarios, the partner can choose one of the methods below to perform the connection update.

Such methods are valid only after the first connection when the unique user identifier "connection\_key" was generated.

| **Method**                                              | **Scenario**                                                                                                                   | **Description**                                                                                       |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- |
| API for auto update(No user participation required)     | Applicable for the banks who don’t require multi-factor authentication (MFA) for login                                         | POST to the API and request for account update, given the auto update feature is enabled              |
| Link for connection update(User participation required) | Applicable for the banks who require multi-factor authentication (MFA) for login, or in case the user has changed the password | Request to the Link URL for connection update ("connection\_key" is required for user identification) |

## Auto update sync

:::hint{type="info"}
**Tips**:&#x20;

This autoupdate\_sync API will depend on previous user credentials. However, there is always a chance that users have changed their credentials when we tried to update.&#x20;

So, as soon as you receive any of the error codes related to wrong credentials, such as 402, 406, and 408, please stop calling this API, instead, ask users to connect with new credentials again. Otherwise, the wrong credentials case would stick and might cause account-blocking issues.
:::

***

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://api-testing.klavi.ai/link/account/v1/autoupdate_sync",
  "name": "/autoupdate_sync",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "partner_code",
        "type": "string",
        "description": "Unique private identifier for the partner to access Klavi API services, like user name."
      },
      {
        "kind": "required",
        "name": "partner_token",
        "type": "string",
        "description": "Unique private authentication key for the partner to access Klavi API services, like password."
      }
    ],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "connection_key",
        "type": "string",
        "description": "Unique key for a specific bank connection of the certain user. It will be generated after the first connection and can be found in the JSON report of the first connection."
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "3NCdGWvUSxdmik-7v3T1j",
        "code": "{\n    \"code\":200,\n    \"data\":null,\n    \"msg\":\"Solicitação realizada com sucesso\" \n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "3NCdGWvUSxdmik-7v3T1j"
  },
  "examples": {
    "languages": [
      {
        "id": "Nlc1BG-io8WyN_KpOAYmh",
        "code": "$ curl -X POST https://api-testing.klavi.ai/link/account/v1/autoupdate_sync \\\n-H 'Content-Type: application/json' \\\n-H 'partner_code: 123xxx' \\\n-H 'partner_token: 2fd6cbcddeafd5ToRxbv8Q9UtfDMO' \\\n-d '{\"connection_key\":\"ae8bdbac023f541ce9152fdba96389d7\"}'",
        "language": "curl",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "Nlc1BG-io8WyN_KpOAYmh"
  },
  "description": "To update your account, you need to call the following API through POST. The updated JSON reports will be sent to your original webhook.",
  "currentNewParameter": {
    "label": "Header Parameter",
    "value": "headerParameters"
  }
}
```
:::

## Auto update config

***

:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://api-testing.klavi.ai/link/account/v1/autoupdate_config",
  "name": "/autoupdate_config",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "partner_code",
        "type": "string",
        "description": "Unique private identifier for the partner to access Klavi API services, like user name."
      },
      {
        "kind": "required",
        "name": "partner_token",
        "type": "string",
        "description": "Unique private authentication key for the partner to access Klavi API services, like password."
      }
    ],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "connection_key",
        "type": "string",
        "description": "Unique key for a specific bank connection of the certain user. It will be generated after the first connection and can be found in the JSON report of the first connection."
      },
      {
        "kind": "required",
        "name": "allow_autoupdate",
        "type": "string",
        "description": "Latest auto update setting (\"Yes\" or \"No\")"
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "Aw8J9x8BdodyF2IQlV6pj",
        "code": "{\n    \"code\":200,\n    \"data\":null,\n    \"msg\":\"Solicitação realizada com sucesso\" \n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "Aw8J9x8BdodyF2IQlV6pj"
  },
  "examples": {
    "languages": [
      {
        "id": "Aao3tPx4CTWeSvuVz7l4w",
        "code": "$ curl -X POST https://api-testing.klavi.ai/link/account/v1/autoupdate_config \\\n-H 'Content-Type: application/json' \\\n-H 'partner_code: 123xxx' \\\n-H 'partner_token: 2fd6cbcddeafd5ToRxbv8Q9UtfDMO' \\\n-d '{\n        \"connection_key\":\"ae8bdbac023f541ce9152fdba96389d7\",\n        \"allow_autoupdate\":\"Yes\"\n    }'",
        "language": "curl",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "Aao3tPx4CTWeSvuVz7l4w"
  },
  "description": "For auto update configuration change, you need to call the following API through POST.",
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  }
}
```
:::

## Link for connection update

***

This method is typically suitable for the banks who require multi-factor authentication (MFA) for login and it is valid only after the first connection. The bank selection and login credential input processes will be skipped to make the user experience better.

| **Paremeter**             | **Purpose**                                                                                        | **Remark**                                                                                                                                                                                                                                        |
| ------------------------- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| connection\_key(required) | Unique key for a specific bank connection of the certain user                                      | It will be generated after the first connection and can be found in the JSON report of the first connection                                                                                                                                       |
| callback\_url(required)   | The redirecting URL after bank connection. It can be a webpage or native app page.                 | To include a callback\_url inside the full URL, the callback\_url value<br />must be processed in encodeURIcompenent() function as below:<br />- “%3a” replaces “:”<br />- “%2f” replaces “/“<br />- “%3f” replaces “?”<br />- “%3d” replaces “=” |
| cancel\_url(required)     | The redirecting URL when users cancel the bank connection. It can be a webpage or native app page. | To include a cancel\_url inside the full URL, the callback\_url value must be processed in encodeURIcompenent() function as below:<br />- “%3a” replaces “:”<br />- “%2f” replaces “/“<br />- “%3f” replaces “?”<br />- “%3d” replaces “=”        |

- Example of Link URL redirecting to a webpage. The correspondent `callback_url` after decoding: `https://partnerDomain.com?partnerParameter=value`

`https://open-testing.klavi.ai/{partner_code}/update?connection_key=xxxxxxxxxx&callback_url=https%3a%2f%2fpartnerDomain.com%3fpartnerParameter%3dvalue`

- Example of Link URL redirecting to a native APP page. The correspondent `callback_url` after decoding: `partnerAppSchemeDemo://partnerAppPage?partnerParameter=value`

`https://open-testing.klavi.ai/{partner_code}/update?connection_key=xxxxxxxxxx&callback_url=partnerAppSchemeDemo%3a%2f%2fpartnerAppPage%3fpartnerParameter%3dvalue`

- Link URLs in different environment:
  `https://open-sandbox.klavi.ai/{partner_code}/update (Sandbox)`
  `https://open-testing.klavi.ai/{partner_code}/update (Development)`
  `https://open.klavi.ai/{partner_code}/update (Production)`

## Account deletion

***

:::ApiMethodV2
```json
{
  "tab": "request",
  "url": "https://api-testing.klavi.ai/link/account/v1/delete",
  "name": "/delete",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [],
    "headerParameters": [
      {
        "kind": "required",
        "name": "partner_code",
        "type": "string",
        "description": "Unique private identifier for the partner to access Klavi API services, like user name."
      },
      {
        "kind": "required",
        "name": "partner_token",
        "type": "string",
        "description": "Unique private authentication key for the partner to access Klavi API services, like password."
      }
    ],
    "bodyDataParameters": [
      {
        "kind": "required",
        "name": "connection_key",
        "type": "string",
        "description": "Unique key for a specific bank connection of the certain user. It will be generated after the first connection and can be found in the JSON report of the first connection."
      }
    ],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "j0hZazaHyfRtInXJG15SE",
        "code": "{\n    \"code\":200,\n    \"data\":null,\n    \"msg\":\"Solicitação realizada com sucesso\" \n}",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "j0hZazaHyfRtInXJG15SE"
  },
  "examples": {
    "languages": [
      {
        "id": "qpiClmFc6JScNCebcTl-f",
        "code": "curl -X POST https://api-testing.klavi.ai/link/account/v1/delete\n-H 'Content-Type: application/json' \\\n-H 'partner_code: 123xxx' \\\n-H 'partner_token: 2fd6cbcddeafd5ToRxbv8Q9UtfDMO' \\\n-d '{\"connection_key\":\"ae8bdbac023f541ce9152fdba96389d7\"}'",
        "language": "curl",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "qpiClmFc6JScNCebcTl-f"
  },
  "description": "To delete the user connection upon their request, you need to call the following API through POST. Please note such deletion is permanent and can’t be recovered.",
  "currentNewParameter": {
    "label": "Header Parameter",
    "value": "headerParameters"
  }
}
```
:::

