> For the complete documentation index, see [llms.txt](https://doc.vlens.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.vlens.co/product-guides/portal-api/transaction-management-api.md).

# Transaction Management API

## General Input For Any Request

As a transaction is just a container for the underlying steps, no end point to create or update a transaction, only delete. A transaction is created by adding a step with an empty transaction\_id

<mark style="color:green;">`POST`</mark> `https://portalapi.vlenseg.com/v1/app/<endpoint_path>`

#### Headers

| Name                                           | Type   | Description                                  |
| ---------------------------------------------- | ------ | -------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | string | application/json                             |
| ApiKey<mark style="color:red;">\*</mark>       | string | API Key                                      |
| BundleKey                                      | string | Bundle Key to identify the required services |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "data": <Data model according to each model described below>,
  "error_code": <int>,
  "error_message": <string>
}
```

{% endtab %}

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

{% endtab %}

{% tab title="401: Unauthorized " %}

```json
{
  "data": null,
  "Services": null,
  "error_code": 401,
  "error_message": "Unauthorized – invalid API Key"
}
```

{% endtab %}
{% endtabs %}

## Gets transactions list according to the provided filters

<mark style="color:blue;">`GET`</mark> `/transactions`

Query parameters are used as needed to filter the results and apply paging. All string parameters are partial matching

#### Query Parameters

| Name           | Type   | Description                                                                |
| -------------- | ------ | -------------------------------------------------------------------------- |
| filterText     | string | Any part of the name, national Id, transaction Id or client transaction Id |
| skipCount      | int    | Number of items to skip. Default is 0                                      |
| maxResultCount | int    | Number of records to be retreived. Default is 10, max is 1000              |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "data": {
     "totalCount": <int>,
     "items": [
      {
	"id": <GUID>,
	"stepsCount": <int>,
	"fullName": <string>,
	"isMatched": <bool>,
	"idNumber": <string>,
	"clientTransactionId": <string>,
	"creationTime": <date>
       }
     ]
  },
  .
  .
  .
}
```

{% endtab %}
{% endtabs %}

## Gets a single transaction basic data

<mark style="color:blue;">`GET`</mark> `/transactions/{id}`

#### Path Parameters

| Name                                 | Type | Description    |
| ------------------------------------ | ---- | -------------- |
| id<mark style="color:red;">\*</mark> | GUID | Transaction Id |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "data": {
      "id": <GUID>,
      "stepsCount": <int>,
      "fullName": <string>,
      "isMatched": <bool>,
      "idNumber": <string>,
      "clientTransactionId": <string>,
      "creationTime": <date>
  },
  .
  .
  .
}
```

{% endtab %}
{% endtabs %}

## Gets a single transaction with all the underlying steps

<mark style="color:blue;">`GET`</mark> `/transactions/{id}/steps`

#### Path Parameters

| Name                                 | Type | Description    |
| ------------------------------------ | ---- | -------------- |
| id<mark style="color:red;">\*</mark> | GUID | Transaction Id |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "data": {
      "id": <GUID>,
      "fullName": <string>,
      "isMatched": <bool>,
      "idNumber": <string>,
      "clientTransactionId": <string>,
      "creationTime": <date>,
      "steps": [
          {<Data model according to each step type model>}
      ]
  },
  .
  .
  .
}
```

{% endtab %}
{% endtabs %}

## Deletes the transaction with the specified id along with all underlying steps and documents

<mark style="color:red;">`DELETE`</mark> `/transactions/{id}`

{% tabs %}
{% tab title="200: OK Transaction is deleted successfully. No data model is returned" %}

{% endtab %}
{% endtabs %}

## Creates a new step

<mark style="color:green;">`POST`</mark> `/steps`

#### Request Body

| Name                                   | Type   | Description                                                                                                                                                                                                                                                                        |
| -------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| transaction\_id                        | GUID   | Transaction Id to create the step under it. If null then a new transaction is created and its Id will be returned in response data                                                                                                                                                 |
| type<mark style="color:red;">\*</mark> | string | <p>Step type. Type must be one of the pre-defined types or "others".<br>Available types (updated):</p><p>id\_front</p><p>id\_back</p><p>car\_license\_front</p><p>car\_license\_back</p><p>face\_match</p><p>passport</p><p>driving\_license</p><p>license\_plate</p><p>others</p> |
| data                                   | string | Step data in JSON format. It can be null or empty only in case of "others" type                                                                                                                                                                                                    |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "data": {
      "transction_id": <GUID>,
      "step": {
          //Inserted data is returned to validate that the sent json for pre-defined types is correct
           <Data model according to each step type model>
      }
  },
  .
  .
  .
}
```

{% endtab %}
{% endtabs %}

## Updates an existing step

<mark style="color:orange;">`PUT`</mark> `/steps/{id}`

#### Path Parameters

| Name                                 | Type | Description |
| ------------------------------------ | ---- | ----------- |
| id<mark style="color:red;">\*</mark> | int  | Step Id     |

#### Request Body

| Name     | Type   | Description                                                                                                                      |
| -------- | ------ | -------------------------------------------------------------------------------------------------------------------------------- |
| data     | string | Updated step data in JSON format - or free text in case of "others" type. It can be null or empty only in case of "others" type  |
| is\_json | bool   | Whether the step data is free text or JSON. Default is "true". This field is ignored if the type is one of the pre-defined types |

{% tabs %}
{% tab title="200: OK " %}

```json
{
  "data": {
      "transction_id": <GUID>,
      "step": {
          //Inserted data is returned to validate that the sent json for pre-defined types is correct
           <Data model according to each step type model>
      }
  },
  .
  .
  .
}
```

{% endtab %}
{% endtabs %}
