# Consents

## GET Consent

<mark style="color:green;">`POST`</mark> `https://api.finqware.com/v1/consents/get`

This endpoint allows a tenant app to check the status for a consent object.

#### Request Body

| Name                                              | Type   | Description                                                      |
| ------------------------------------------------- | ------ | ---------------------------------------------------------------- |
| client\_id<mark style="color:red;">\*</mark>      | string | An identifier for your tenant app.                               |
| client\_secret<mark style="color:red;">\*</mark>  | string | A tenant app secret.                                             |
| credentials\_id<mark style="color:red;">\*</mark> | string | A pointer to a consent record created via an onboarding session. |
| access\_token<mark style="color:red;">\*</mark>   | string | An authorization key for this particular consent record.         |

{% tabs %}
{% tab title="200: OK Consent successfully retrieved." %}

```javascript
{
    // read | delete
    "op_type": "read",
    "code": "credentials_info",
    "http": 200,
    "message": "Consent info retrieved",
    "result": {
        "consent_exp": "2022-05-02T14:21:44Z",
        "credentials_id": "519e...25fd5",
        "originator": {
            "country": "Romania",
            "servicer": "Raiffeisen Bank Romania",
            "skill": "rzb_ro_aisp_sbx_#1.0"
        },
        
        // ACTIVE | DELETED | EXPIRED
        "status": "ACTIVE",
        
        "tenant_app_info": {
            "client_id": "8fbc3f...d4dc58b1",
            "name": "psd2-tests"
        },
        "utc_created": "2020-07-05T21:48:06Z",
        "utc_last_update": "2020-07-05T21:48:27Z",
        "consent_exp": "2020-11-03T11:22:54Z",
        "max_data_retention": "2020-12-03T11:22:54Z"
    }
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
// check the errors docs page for details
{
  "id": "uuid",
  "type": "invalid_request",
  "http": 400,
  "code": "invalid_client_id",
  "message": "error message"
}
```

{% endtab %}
{% endtabs %}

## DELETE Consent

<mark style="color:green;">`POST`</mark> `https://api.finqware.com/v1/consents/delete`

The delete operation updates the state of a given consent from ACTIVE to DELETED.

A DELETED consent pointed by its credentials\_id cannot be used anymore to retrieve account data (accounts, balances, transactions).

This is an idempotent operation.

#### Request Body

| Name                                              | Type    | Description                                                                                 |
| ------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------- |
| client\_id<mark style="color:red;">\*</mark>      | string  | An identifier for your tenant app.                                                          |
| client\_secret<mark style="color:red;">\*</mark>  | string  | A tenant app secret.                                                                        |
| credentials\_id<mark style="color:red;">\*</mark> | string  | A pointer to a consent record created via an onboarding session.                            |
| access\_token<mark style="color:red;">\*</mark>   | string  | An authorization key for this particular consent record.                                    |
| pcd\_data\_retention                              | integer | How long (in minutes) will the cached data be retained in the cache after consent deletion. |

{% tabs %}
{% tab title="200: OK Consent successfully retrieved." %}

```javascript
{
    "code": "credentials_deleted",
    "http": 200,
    "message": "Consent deleted",
    "op_type": "delete",
    "result": {
        "client_id": "27c3605a-65f1-4ef3-8b3c-fa814bde5ff7",
        "credentials_id": "b6e01945-6de1-465a-af9b-c74227bca47a",
        "max_data_retention": "2022-06-01T14:21:44Z"
    }
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```javascript
// check the errors docs page for details
{
  "id": "uuid",
  "type": "invalid_request",
  "http": 400,
  "code": "invalid_client_id",
  "message": "error message"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.finqware.com/api/consents.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
