<!-- https://staircase.co/platform/data/persistence -->
# Persistence

# Persistence

The graph store every product writes into: containers of linked-data items, immutable state, first-class blobs, and the transaction primitive.

Persistence holds the canonical record. Items are stored in containers keyed by class, each carrying a sortable identifier, and read back as linked data. Search runs over a separate index rather than over the graph itself, so a text query does not become a traversal.

Binary objects are first class. A response collection carries blob identifiers that resolve through a signed-URL call, which keeps documents out of payloads without making the caller manage storage.

## How it works

State is immutable. Every change to an entity creates a new record with a new database-generated identifier, while a stable global identifier groups every state of the same real-world thing. Reading history is a query over that group rather than a separate audit table, and a correction never destroys what it corrected.

The transaction and collection primitives every product's API reuses are defined here. That is why a per-vendor attempt is inspectable on any product: the attempt was written as its own collection under the transaction, not folded into a final result.

## Operations

<!--source:api-specifications-->

### Blobs
<!--/source-->

`POST` `/blobs`

<!--source:api-specifications-->

#### Create Blob
<!--/source-->

`create_blob`

<!--source:api-specifications-->
Create Blob creates a blob instance with specified extension and returns presigned url for content upload.

Note: This will NOT upload your file to the blob instance. To upload a document, you will need to issue a PUT request to the presigned URL returned by the response body. See example, code snippet below:

```
import requests

# Create Blob endpoint returns blob_id and upload presigned url
# For example, the presigned_url might look like this:
presigned_url = ""

# Set the path to the file you want to upload
filepath = "document.pdf"

# Set the headers appropriately
headers = {
'Content-Type': 'application/pdf'
}

# Read the file data and make the PUT request
with open(filepath, 'rb') as file:
 payload = file.read
 response = requests.put(url=upload_presigned_url, headers=headers, data=payload)
```

<!--/source-->

##### Request

<!--source:api-specifications-->
Pdf file uploadJpg file upload
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "extension": ".pdf",
 "presign_url_ttl": 30
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "extension": ".jpg",
 "blob_name": "image.jpg"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400
<!--/source-->

<!--source:api-specifications-->
application/json Copy Blob has been created

```
{
 "blob_id": "8c561841-6671-412e-a356-523460ba0d8d",
 "extension": ".pdf",
 "presigned_urls": {
 "upload": {
 "url": "https://api-data-manager-blobs-bucket.s3.amazonaws.com/8c561841-6671-412e-a356-523460ba0d8d"
 }
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `extension`required | `string` | <!--source:api-specifications-->Extension of file, that blob is persisting<!--/source-->Example `.pdf` |
| `presign_url_ttl` | `integer` | <!--source:api-specifications-->TTL of presigned url in seconds, default is 3600<!--/source--> |
| `blob_name` | `string` | <!--source:api-specifications-->Name for blob<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
6 fields
<!--/source-->
<!--source:api-specifications-->
Blob has been created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `blob_id` | `string (ulid)` | <!--source:api-specifications-->Blob id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `extension` | `string` | <!--source:api-specifications-->Extension of file, that blob is persisting<!--/source-->Example `.pdf` |
| `presigned_urls` | `object` | <!--source:api-specifications-->Presigned urls for uploading or downloading file<!--/source--> |
| `upload` | `object` | <!--source:api-specifications-->Presigned url<!--/source--> |
| `url` | `string (uri)` | <!--source:api-specifications-->Presigned url<!--/source-->Example `https://api-data-manager-blobs-bucket.s3.amazonaws.com/00c8c9e5-dfdd-44c5-a57e-8de7a2672e2e` |
| `page_count` | `integer` | <!--source:api-specifications-->Number of pages present, if the file persisted is a PDF.<!--/source--> |
| `content_length` | `integer` | <!--source:api-specifications-->Size of the file being persisted.<!--/source--> |
| `blob_name` | `string` | <!--source:api-specifications-->Blob name<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`PUT` `/blobs/{blob_id}/presigned-urls/{action}`

<!--source:api-specifications-->

#### Create Blob Presigned URL
<!--/source-->

`generate_presigned_url`

<!--source:api-specifications-->
Generate new presigned url

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "presign_url_ttl": 3600
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy New presigned url

```
{
 "url": "https://api-data-manager-blobs-bucket.s3.amazonaws.com/8c561841-6671-412e-a356-523460ba0d8d"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `blob_id` required | `string (ulid)` path | `01EZQ32PJQGKRA6HR8D72Q9FFF` | <!--source:api-specifications-->Blob id<!--/source--> |
| `action` required | `string` path | `upload` | <!--source:api-specifications-->Action, one of one of ['upload', 'donwload']<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `presign_url_ttl` | `integer` | <!--source:api-specifications-->TTL of presigned url in seconds, default is 3600<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
New presigned url
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string (uri)` | <!--source:api-specifications-->Presigned url<!--/source-->Example `https://api-data-manager-blobs-bucket.s3.amazonaws.com/00c8c9e5-dfdd-44c5-a57e-8de7a2672e2e` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/blobs/{blob_id}`

<!--source:api-specifications-->

#### Retrieve Blob
<!--/source-->

`get_blob`

<!--source:api-specifications-->
Retrieve Blob instance: extension, last created presigned urls, page count and content length

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Blob instance with last created presigned urls

```
{
 "blob_id": "8c561841-6671-412e-a356-523460ba0d8d",
 "extension": ".pdf",
 "presigned_urls": {
 "download": {
 "url": "https://api-data-manager-blobs-bucket.s3.amazonaws.com/8c561841-6671-412e-a356-523460ba0d8d"
 },
 "upload": {
 "url": "https://api-data-manager-blobs-bucket.s3.amazonaws.com/8c561841-6671-412e-a356-523460ba0d8d"
 }
 },
 "page_count": 3,
 "content_length": 7478
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `blob_id` required | `string (ulid)` path | `01FJCA39TSCHS6Q8K69FEEMQZQ` | <!--source:api-specifications-->Blob id<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
Blob instance with last created presigned urls
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `blob_id` | `string (ulid)` | <!--source:api-specifications-->Blob id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `extension` | `string` | <!--source:api-specifications-->Extension of file, that blob is persisting<!--/source-->Example `.pdf` |
| `presigned_urls` | `object` | <!--source:api-specifications-->Presigned urls for uploading or downloading file<!--/source--> |
| `download` | `object` | <!--source:api-specifications-->Presigned url<!--/source--> |
| `url` | `string (uri)` | <!--source:api-specifications-->Presigned url<!--/source-->Example `https://api-data-manager-blobs-bucket.s3.amazonaws.com/00c8c9e5-dfdd-44c5-a57e-8de7a2672e2e` |
| `upload` | `object` | <!--source:api-specifications-->Presigned url<!--/source--> |
| `url` | `string (uri)` | <!--source:api-specifications-->Presigned url<!--/source-->Example `https://api-data-manager-blobs-bucket.s3.amazonaws.com/00c8c9e5-dfdd-44c5-a57e-8de7a2672e2e` |
| `blob_name` | `string` | <!--source:api-specifications-->Blob name<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

`GET` `/blobs/{blob_id}/presigned-urls`

<!--source:api-specifications-->

#### Retrieve Blob Presigned URLs
<!--/source-->

`get_preassigned_urls`

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Presigned urls

```
{
 "download": {
 "url": "https://api-data-manager-blobs-bucket.s3.amazonaws.com/8c561841-6671-412e-a356-523460ba0d8d"
 },
 "upload": {
 "url": "https://api-data-manager-blobs-bucket.s3.amazonaws.com/8c561841-6671-412e-a356-523460ba0d8d"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `blob_id` required | `string (ulid)` path | `01FJCA39TSCHS6Q8K69FEEMQZQ` | <!--source:api-specifications-->Blob id<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Presigned urls
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `download` | `object` | <!--source:api-specifications-->Presigned url<!--/source--> |
| `url` | `string (uri)` | <!--source:api-specifications-->Presigned url<!--/source-->Example `https://api-data-manager-blobs-bucket.s3.amazonaws.com/00c8c9e5-dfdd-44c5-a57e-8de7a2672e2e` |
| `upload` | `object` | <!--source:api-specifications-->Presigned url<!--/source--> |
| `url` | `string (uri)` | <!--source:api-specifications-->Presigned url<!--/source-->Example `https://api-data-manager-blobs-bucket.s3.amazonaws.com/00c8c9e5-dfdd-44c5-a57e-8de7a2672e2e` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/blobs/{blob_id}/presigned-urls/{action}`

<!--source:api-specifications-->

#### Retrieve Presigned URL for Action
<!--/source-->

`get_presigned_url`

<!--source:api-specifications-->
Get presigned url

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Presigned url

```
{
 "url": "https://api-data-manager-blobs-bucket.s3.amazonaws.com/8c561841-6671-412e-a356-523460ba0d8d"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `blob_id` required | `string (ulid)` path | `01EZQ32PJQGKRA6HR8D72Q9FFF` | <!--source:api-specifications-->Blob id<!--/source--> |
| `action` required | `string` path | `upload` | <!--source:api-specifications-->Action for url<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Presigned url
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `url` | `string (uri)` | <!--source:api-specifications-->Presigned url<!--/source-->Example `https://api-data-manager-blobs-bucket.s3.amazonaws.com/00c8c9e5-dfdd-44c5-a57e-8de7a2672e2e` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

<!--source:api-specifications-->

### Graph
<!--/source-->

`POST` `/graph/merge`

<!--source:api-specifications-->

#### Execute Merge
<!--/source-->

`execute_merge`

<!--source:api-specifications-->
Execute merge of collections stored in the Persistence Graph.

This API is only available when the Persistence Graph component is installed in the user's environment.

The request body must be in JSON format and contain the following properties:

`transaction_id`: ID of transaction to merge.

Also request body may contain one optional property:

`collection_ids`: A list of IDs of collections which should be merged.

Show the rest The response is returned in JSON format and contains the results of the merge.

#### Example of merging process

In the transaction we have two collection that we want to merge. Entities will be merged if it matches by type, properties and values.

`first collection`:

```
{
 "addresses": [
 {
 "@id": "01FD9XEX1KVQ182TXBN67YVJ04",
 "@type": "residential_address",
 "has_address_line_1_text": {
 "has_value": "535 30 RD"
 },
 "has_city_name": {
 "has_value": "GRAND JUNCTION"
 },
 "has_postal_code": {
 "has_value": "81504"
 },
 "has_state_code": {
 "has_value": "CO"
 }
 },
 {
 "@id": "01FD9XEX1KN579K22XEC9A6Q6C",
 "@type": "residential_address",
 "has_address_line_1_text": {
 "has_value": "312 OURAY AV"
 },
 "has_city_name": {
 "has_value": "GRAND JUNCTION"
 },
 "has_postal_code": {
 "has_value": "81501"
 },
 "has_state_code": {
 "has_value": "CO"
 }
 }
 ],
 "people": [
 {
 "@type": "borrower",
 "@id": "01GQHRJVS13E8S9T0RMZPXF02V",
 "has_first_name": {
 "has_value": "John"
 },
 "has_last_name": {
 "has_value": "Deere"
 },
 "has_birth_date": {
 "has_value": "01/01/1985"
 },
 "has_taxpayer_identifier_value": {
 "has_value": "999-00-0000"
 },
 "lives_at": [
 "01FD9XEX132KHJ64GEE6PYWE19",
 "01FD9XEX13TNAVJ0NJ23MYZMH2"
 ],
 "with_credit_information": [
 "01FD9XEWZYM5ZTNCGRRPND285X",
 "01GTM5V2BEWMFN1Q6E3675YVM1"
 ]
 }
 ],
 "residences": [
 {
 "@id": "01FD9XEX132KHJ64GEE6PYWE19",
 "@type": "residence",
 "has_borrower_residency_type": {
 "has_value": "current"
 },
 "with_address": [
 "01FD9XEX1KVQ182TXBN67YVJ04"
 ]
 },
 {
 "@id": "01FD9XEX13TNAVJ0NJ23MYZMH2",
 "@type": "residence",
 "has_borrower_residency_type": {
 "has_value": "prior"
 },
 "with_address": [
 "01FD9XEX1KN579K22XEC9A6Q6C"
 ]
 }
 ],
 "credit_information": [
 {
 "@id": "01FD9XEWZYM5ZTNCGRRPND285X",
 "@type": "credit_information",
 "has_credit_frozen_status_equifax_indicator": {
 "has_value": "false"
 },
 "has_credit_frozen_status_experian_indicator": {
 "has_value": "false"
 },
 "has_credit_frozen_status_trans_union_indicator": {
 "has_value": "false"
 },
 "has_credit_rating_code_type": {
 "has_value": "equifax"
 },
 "has_credit_report_first_issued_date": {
 "has_value": "2021-08-17"
 },
 "has_credit_report_identifier": {
 "has_value": "2-a7e4f473-18f0-4fc7-9"
 },
 "has_credit_report_merge_type": {
 "has_value": "list_and_stack"
 },
 "has_credit_repository_included_equifax_indicator": {
 "has_value": "false"
 },
 "has_credit_repository_included_experian_indicator": {
 "has_value": "false"
 },
 "has_credit_repository_included_trans_union_indicator": {
 "has_value": "true"
 },
 "has_credit_request_data_credit_repository_included_equifax_indicator": {
 "has_value": "false"
 },
 "has_credit_request_data_credit_repository_included_experian_indicator": {
 "has_value": "false"
 },
 "has_credit_request_data_credit_repository_included_trans_union_indicator": {
 "has_value": "false"
 },
 "has_data_version_credmo_identifier": {
 "has_value": "1.3"
 },
 "has_data_version_equifax_identifier": {
 "has_value": "4"
 }
 },
 {
 "@id": "01GTM5V2BEWMFN1Q6E3675YVM1",
 "@type": "credit_information",
 "has_credit_frozen_status_equifax_indicator": {
 "has_value": "false"
 },
 "has_credit_frozen_status_experian_indicator": {
 "has_value": "false"
 },
 "has_credit_frozen_status_trans_union_indicator": {
 "has_value": "false"
 },
 "has_credit_rating_code_type": {
 "has_value": "equifax"
 },
 "has_credit_report_first_issued_date": {
 "has_value": "2021-08-17"
 },
 "has_credit_report_identifier": {
 "has_value": "2-a7e4f473-18f0-4fc7-9"
 },
 "has_credit_report_merge_type": {
 "has_value": "list_and_stack"
 },
 "has_credit_repository_included_equifax_indicator": {
 "has_value": "false"
 },
 "has_credit_repository_included_experian_indicator": {
 "has_value": "false"
 },
 "has_credit_repository_included_trans_union_indicator": {
 "has_value": "true"
 },
 "has_credit_request_data_credit_repository_included_equifax_indicator": {
 "has_value": "false"
 },
 "has_credit_request_data_credit_repository_included_experian_indicator": {
 "has_value": "false"
 },
 "has_credit_request_data_credit_repository_included_trans_union_indicator": {
 "has_value": "false"
 },
 "has_data_version_credmo_identifier": {
 "has_value": "1.3"
 },
 "has_data_version_equifax_identifier": {
 "has_value": "4"
 }
 }
 ]
 }
```

`second collection`:

```
{
 "people": [
 {
 "@type": "borrower",
 "@id": "01FDF04MYHEZ98AD7T8ZGY5CMB",
 "has_first_name": {
 "has_value": "John"
 },
 "has_last_name": {
 "has_value": "Deere"
 },
 "has_birth_date": {
 "has_value": "01/01/1985"
 },
 "has_taxpayer_identifier_value": {
 "has_value": "999-00-0000"
 },
 "contact_at": [
 "01FDF09BNQCT03DCAX7M5KM52T",
 "01GTM5XEKKJ23KC28QEA8TG971"
 ],
 "employed_as": [
 "01FDF0DFYAHBRJGFA5RS26HVP1"
 ]
 }
 ],
 "contact_information": [
 {
 "@type": "contact_information",
 "@id": "01FDF09BNQCT03DCAX7M5KM52T",
 "has_phone_number": {
 "has_value": "+1234567890"
 }
 },
 {
 "@type": "contact_information",
 "@id": "01GTM5XEKKJ23KC28QEA8TG971",
 "has_phone_number": {
 "has_value": "+1234567890"
 }
 }
 ],
 "employment": [
 {
 "@id": "01FDF0DFYAHBRJGFA5RS26HVP1",
 "@type": "employment",
 "has_employment_position_description": {
 "has_value": "Engineer"
 }
 }
 ]
 }
```

`merged collection`:

```
{
 "addresses": [
 {
 "@id": "01FD9XEX1KVQ182TXBN67YVJ04",
 "@type": "residential_address",
 "has_address_line_1_text": {
 "has_value": "535 30 RD"
 },
 "has_city_name": {
 "has_value": "GRAND JUNCTION"
 },
 "has_postal_code": {
 "has_value": "81504"
 },
 "has_state_code": {
 "has_value": "CO"
 }
 },
 {
 "@id": "01FD9XEX1KN579K22XEC9A6Q6C",
 "@type": "residential_address",
 "has_address_line_1_text": {
 "has_value": "312 OURAY AV"
 },
 "has_city_name": {
 "has_value": "GRAND JUNCTION"
 },
 "has_postal_code": {
 "has_value": "81501"
 },
 "has_state_code": {
 "has_value": "CO"
 }
 }
 ],
 "contact_information": [
 {
 "@id": "01FDF09BNQCT03DCAX7M5KM52T",
 "@type": "contact_information",
 "has_phone_number": {
 "has_value": "+1234567890"
 }
 }
 ],
 "credit_information": [
 {
 "@id": "01FD9XEWZYM5ZTNCGRRPND285X",
 "@type": "credit_information",
 "has_credit_frozen_status_equifax_indicator": {
 "has_value": "false"
 },
 "has_credit_frozen_status_experian_indicator": {
 "has_value": "false"
 },
 "has_credit_frozen_status_trans_union_indicator": {
 "has_value": "false"
 },
 "has_credit_rating_code_type": {
 "has_value": "equifax"
 },
 "has_credit_report_first_issued_date": {
 "has_value": "2021-08-17"
 },
 "has_credit_report_identifier": {
 "has_value": "2-a7e4f473-18f0-4fc7-9"
 },
 "has_credit_report_merge_type": {
 "has_value": "list_and_stack"
 },
 "has_credit_repository_included_equifax_indicator": {
 "has_value": "false"
 },
 "has_credit_repository_included_experian_indicator": {
 "has_value": "false"
 },
 "has_credit_repository_included_trans_union_indicator": {
 "has_value": "true"
 },
 "has_credit_request_data_credit_repository_included_equifax_indicator": {
 "has_value": "false"
 },
 "has_credit_request_data_credit_repository_included_experian_indicator": {
 "has_value": "false"
 },
 "has_credit_request_data_credit_repository_included_trans_union_indicator": {
 "has_value": "false"
 },
 "has_data_version_credmo_identifier": {
 "has_value": "1.3"
 },
 "has_data_version_equifax_identifier": {
 "has_value": "4"
 }
 }
 ],
 "employment": [
 {
 "@id": "01FDF0DFYAHBRJGFA5RS26HVP1",
 "@type": "employment",
 "has_employment_position_description": {
 "has_value": "Engineer"
 }
 }
 ],
 "people": [
 {
 "@id": "01GQHRJVS13E8S9T0RMZPXF02V",
 "@type": "borrower",
 "contact_at": [
 "01FDF09BNQCT03DCAX7M5KM52T"
 ],
 "employed_as": [
 "01FDF0DFYAHBRJGFA5RS26HVP1"
 ],
 "has_birth_date": {
 "has_value": "01/01/1985"
 },
 "has_first_name": {
 "has_value": "John"
 },
 "has_last_name": {
 "has_value": "Deere"
 },
 "has_taxpayer_identifier_value": {
 "has_value": "999-00-0000"
 },
 "lives_at": [
 "01FD9XEX13TNAVJ0NJ23MYZMH2",
 "01FD9XEX132KHJ64GEE6PYWE19"
 ],
 "with_credit_information": [
 "01FD9XEWZYM5ZTNCGRRPND285X"
 ]
 }
 ],
 "residences": [
 {
 "@id": "01FD9XEX13TNAVJ0NJ23MYZMH2",
 "@type": "residence",
 "has_borrower_residency_type": {
 "has_value": "prior"
 },
 "with_address": [
 "01FD9XEX1KN579K22XEC9A6Q6C"
 ]
 },
 {
 "@id": "01FD9XEX132KHJ64GEE6PYWE19",
 "@type": "residence",
 "has_borrower_residency_type": {
 "has_value": "current"
 },
 "with_address": [
 "01FD9XEX1KVQ182TXBN67YVJ04"
 ]
 }
 ]
 }
```

<!--/source-->

##### Request

<!--source:api-specifications-->
Merge selected collections in transactionMerge all collections in transaction
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "transaction_id": "01GSWRGPWD2C5SYPAN8TS4ZADJ",
 "collection_ids": [
 "01GSWRQXKK7AHPH4XG4DRHYXSZ",
 "01GSWS0PY75NFRHBFA4ERTFMD8"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "transaction_id": "01GSWRGPWD2C5SYPAN8TS4ZADJ"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "merge_result": {
 "contact_information": [
 {
 "@id": "01FDF09BNQCT03DCAX7M5KM52T",
 "@type": "contact_information",
 "has_phone_number": {
 "has_value": "+1234567890"
 }
 }
 ],
 "employment": [
 {
 "@id": "01FDF0DFYAHBRJGFA5RS26HVP1",
 "@type": "employment",
 "has_employment_position_description": {
 "has_value": "Engineer"
 }
 }
 ],
 "people": [
 {
 "@id": "01FDF04MYHEZ98AD7T8ZGY5CMB",
 "@type": "borrower",
 "contact_at": [
 "01FDF09BNQCT03DCAX7M5KM52T"
 ],
 "employed_as": [
 "01FDF0DFYAHBRJGFA5RS26HVP1"
 ],
 "has_birth_date": {
 "has_value": "01/01/1985"
 },
 "has_first_name": {
 "has_value": "John"
 },
 "has_last_name": {
 "has_value": "Deere"
 },
 "has_taxpayer_identifier_value": {
 "has_value": "999-00-0000"
 },
 "lives_at": [
 "01GS59J4PHKYRH3D9TPAV3FK40",
 "01FD9XEX13TNAVJ0NJ23MYZM10"
 ]
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data invalid

```
{
 "message": "Request body is not valid JSON."
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id`required | `string` | <!--source:api-specifications-->ID of transaction to merge.<!--/source-->Example `01GSWRGPWD2C5SYPAN8TS4ZADJ` |
| `collection_ids` | `string[]` | <!--source:api-specifications-->Array of collection IDs to merge.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `merge_result`required | `object` | <!--source:api-specifications-->Merged collections<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data invalid
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

`POST` `/graph/query`

<!--source:api-specifications-->

#### Execute Query
<!--/source-->

`execute_query`

<!--source:api-specifications-->
Execute query against data stored in the Persistence Graph. This API endpoint /graph/query allows users to execute a query against the data stored in the Persistence Graph. This API is only available when the Persistence Graph component is installed in the user's environment. The HTTP method used to execute a query is POST. The request body must be in JSON format and contain the following properties: `query`: A JSONPATH or JMESPATH query object containing the path of the data to query, the operation to perform, and the value to query against. The query object has the following properties: `path`: An object containing the query path and format. The format property must be set to JSONPATH or JMESPATH. `operation`: The operation to perform, such as BETWEEN, CONTAINS, EQ, GT, GTE, LT, LTE, NE, or STARTSWITH. `value`: The value to query against. `echo`: Boolean flag, if true, the raw SPARQL Query will be present in the response. `include_total_count`: An optional boolean value that determines whether the response should include a field called "total_count" with the total number of items returned by the query. The default value is false. `sort`: Optional flag. If ASC, response will be sorted from small to greater. If DESC, response will be sorted from greater to lesser. By default, ASC sort is applied. `transaction_ids`: Optional field. If provided, response will include only collections from the transactions_ids provided. If omitted, will return data in all transactions. `page` parameter is specified with the `next_token` parameter. The `page` parameter is a number with a value more than 0. `latest_collections_only` Boolean flag. If true, only return the latest collection from each transaction. Default is false. `use_sug` Boolean flag. If true, collections are searched in SUG. Default is false. 'latest_collection_only_tr`: Boolean flag, new version of `latest_collections_only`flag. Uses different method to make queries to SPARQL, optimized for large amount of collections in transaction, but works only with collections created after 18.01.2024. Has priority over`latest_collection_only` The request body examples show how to use the API to perform different types of queries. For example, finding the first person in the people array with a has_first_name property equal to Vlad, or finding all people with a has_credit_score property between 400 and 500. The response is returned in JSON format and contains the results of the query. If query_result array of the response body is empty, it means no new data is available for this query.

Show the rest Known limitations 1. No slices are supported.
1. No multiselect for JMESPATH (for example `'people[?age > `20`].[name, age]'`) is not supported.

1. Pipe Expressions for JMESPATH not available.

1. No multiple logical conditions for JMESPATH.

1. No functions for JMESPATH.

If you need this feature, please open Customer Request to us.

<!--/source-->

##### Request

<!--source:api-specifications-->
First person in people array with has_first_name equals VladFirst person in people array with has_first_name equals Vlad Only latest collectionsFirst person in people array with has_first_name equals Vlad Second PageFirst person in people array with has_first_name equals Vlad inside transactions labeled as prodFirst person in people array with has_first_name equals Vlad jmespathAll people with has_credit_score between 400 and 500All people with first name Vlad and last name KNested filters, find peoples with name Vlad that lives in New York city NY statestartswithcontainsnegtgteltlteandand_orCombine JSONPATH and JMESPATHPaginated requestlimittotal_count
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[0].has_first_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Vlad"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[0].has_first_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Vlad"
 },
 "latest_collections_only": true
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[0].has_first_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Vlad"
 },
 "page": 1,
 "next_token": "7b22637265617465645f6174223a2022323032332d30322d32325431383a31333a32352e3834373236372b30323a3030222c20226f6666736574223a20313030307d"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[0].has_first_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Vlad"
 },
 "transaction_label": "prod"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "people[0].has_first_name.has_value",
 "format": "jmespath"
 },
 "operation": "eq",
 "value": "Vlad"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[*].has_credit_score.has_value",
 "format": "jsonpath"
 },
 "operation": "between",
 "value": [
 400,
 500
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[?(@.has_first_name.has_value = 'Vlad')].has_last_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "K"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[?(@.has_first_name.has_value = 'Vlad')].with_addresses[?(@.has_city_name.has_value = 'New York')].has_state_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "NY"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[*].with_addresses[*].has_state_name.has_value",
 "format": "jsonpath"
 },
 "operation": "startswith",
 "value": "N"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[*].has_last_name.has_value",
 "format": "jsonpath"
 },
 "operation": "contains",
 "value": "mik"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[*].has_credit_score.has_value",
 "format": "jsonpath"
 },
 "operation": "ne",
 "value": 200
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[*].has_credit_score.has_value",
 "format": "jsonpath"
 },
 "operation": "gt",
 "value": 200
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[*].has_credit_score.has_value",
 "format": "jsonpath"
 },
 "operation": "gte",
 "value": 200
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[*].has_credit_score.has_value",
 "format": "jsonpath"
 },
 "operation": "lt",
 "value": 200
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[*].has_credit_score.has_value",
 "format": "jsonpath"
 },
 "operation": "lte",
 "value": 200
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "and": [
 {
 "path": {
 "path": "$.people[*].has_credit_score.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": 200
 },
 {
 "and": [
 {
 "path": {
 "path": "$.people[*].has_first_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Bob"
 },
 {
 "path": {
 "path": "$.people[*].has_last_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Odenkirk"
 }
 ]
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "or": [
 {
 "path": {
 "path": "$.people[*].has_credit_score.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": 200
 },
 {
 "and": [
 {
 "path": {
 "path": "$.people[*].has_first_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Bob"
 },
 {
 "path": {
 "path": "$.people[*].has_last_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Odenkirk"
 }
 ]
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "and": [
 {
 "or": [
 {
 "path": {
 "path": "people[*].has_credit_score.has_value",
 "format": "jmespath"
 },
 "operation": "eq",
 "value": 200
 },
 {
 "path": {
 "path": "$.people[*].has_last_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "K"
 }
 ]
 },
 {
 "and": [
 {
 "path": {
 "path": "$.people[*].has_first_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Bob"
 },
 {
 "path": {
 "path": "$.people[*].has_last_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Odenkirk"
 }
 ]
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[0].has_first_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Vlad"
 },
 "next_token": "7b22637265617465645f6174223a2022323032332d30322d32325431383a31333a32352e3834373236372b30323a3030222c20226f6666736574223a20313030307d"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[0].has_first_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Vlad"
 },
 "limit": 150
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "query": {
 "path": {
 "path": "$.people[0].has_first_name.has_value",
 "format": "jsonpath"
 },
 "operation": "eq",
 "value": "Vlad"
 },
 "include_total_count": true
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400
<!--/source-->

<!--source:api-specifications-->
application/json Copy Ok.

```
{
 "query_result": [
 {
 "transaction_id": "01GSD62EEBT4YD1Y0W6GFVA4EB",
 "collection_id": "01GSD68Z48JRJK8MM4YYRCTH3D"
 },
 {
 "transaction_id": "01GSD62EEBT4YD1Y0W6GFVA4EB",
 "collection_id": "01GSD6AC2XH7QW4N8RE67QB0Z9"
 }
 ],
 "next_token": "7b22637265617465645f6174223a2022323032332d30322d32325431383a31333a32352e3834373236372b30323a3030222c20226f6666736574223a20313030307d",
 "total_count": 42
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data invalid

```
{
 "message": "Invalid path. Reason: Invalid JSONPATH."
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
11 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `query`required | `object` | <!--source:api-specifications-->JSONPath query<!--/source--> |
| `path`required | `object` | <!--source:api-specifications-->The location of data for query<!--/source--> |
| `path`required | `string` | <!--source:api-specifications-->The query path. Must be valid JSONPATH or JMESPATH.<!--/source--> |
| `format`required | `string` | <!--source:api-specifications-->The query format in use<!--/source-->`JMESPATH``JSONPATH` |
| `operation`required | `string` | <!--source:api-specifications-->Operation<!--/source-->`BETWEEN``CONTAINS``EQ``GT``GTE``LT``LTE``NE``STARTSWITH` |
| `value`required | `string` | <!--source:api-specifications-->What value to query against.<!--/source--> |
| `next_token` | `string` | <!--source:api-specifications-->Next token from the response body.<!--/source-->Example `7b22637265617465645f6174223a2022323032332d30322d32325431383a31333a32352e3834373236372b30323a3030222c20226f6666736574223a20313030307d` |
| `limit` | `integer` | <!--source:api-specifications-->Limits how many results should be in the response.<!--/source-->Example `100` |
| `transaction_label` | `string` | <!--source:api-specifications-->If provided, include only the transactions with the provided 'transaction_label'.<!--/source-->Example `my_label` |
| `transaction_ids` | `string[]` | <!--source:api-specifications-->If provided, include only the transactions with the provided 'transaction_ids'.<!--/source--> |
| `echo` | `boolean` | <!--source:api-specifications-->If provided, response will include `raw_query` key.<!--/source-->Example `true` |
| `sort` | `string` | <!--source:api-specifications-->If provided, response will be sorted asc or desc.<!--/source-->`ASC``DESC`Example `DESC` |
| `include_total_count` | `boolean` | <!--source:api-specifications-->An optional boolean value that determines whether the response should include a field called "total_count" with the total number of items returned by the query. The default value is false.<!--/source--> |
| `page` | `integer` | <!--source:api-specifications-->Optional parameter to specify the page of data to retrieve. Must be used with the "next_token" parameter.<!--/source--> |
| `latest_collections_only` | `boolean` | <!--source:api-specifications-->If true, only return the latest collection from each transaction.<!--/source-->Example `true` |
| `use_sug` | `boolean` | <!--source:api-specifications-->If true, collections are searched in SUG.<!--/source-->Example `true` |

##### Response `200``application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->
<!--source:api-specifications-->
Ok.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `query_result`required | `object[]` | <!--source:api-specifications-->Array of transaction and collection IDs pair<!--/source--> |
| `transaction_id`required | `string` | <!--source:api-specifications-->Transaction ID<!--/source-->Example `01GSD62EEBT4YD1Y0W6GFVA4EB` |
| `collection_id`required | `string` | <!--source:api-specifications-->Collection ID<!--/source-->Example `01GSD6AC2XH7QW4N8RE67QB0Z9` |
| `next_token`required | `string` | <!--source:api-specifications-->Next token of the query. Pass it to request body to get next 1000 results of the query. If null, no next results available.<!--/source-->Example `7b22637265617465645f6174223a2022323032332d30322d32325431383a31333a32352e3834373236372b30323a3030222c20226f6666736574223a20313030307d` |
| `raw_query` | `string` | <!--source:api-specifications-->The raw SPARQL Query that was executed. Useful for debug. Only available if request body parameter echo is true.<!--/source-->Example `PREFIX sci: <https://staircase.co/> PREFIX sc: <https://www.staircase.co/ontology/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT DISTINCT ?transaction_id ?collection_id { {?data sc:communications/rdf:rest*/rdf:first ?x_1 . ?x_1 rdf:type ?x_2 . ?x_1 sc:has_communication_source_username/sc:has_value ?x_3 FILTER (?x_2 = sc:email) . FILTER (?x_3 = "nivanjeet.singh@staircase.co")}{?data sc:communications/rdf:rest*/rdf:first ?x_4 . ?x_4 rdf:type ?x_5 . ?x_4 sc:with_sender/rdf:first/sc:contact_at/rdf:first/sc:has_email_address/sc:has_value ?x_6 FILTER (?x_5 = sc:email) . FILTER (?x_6 = "blah@blah.com")} GRAPH ?transaction_id { ?collection_id sci:data ?data } ?collection_id sci:metadata/sci:created_at ?created_at . FILTER (xsd:dateTime(?created_at) <= "2023-03-06T16:24:11.362539+00:00"^^xsd:dateTime) } ORDER BY ?transaction_id ?collection_id LIMIT 10 OFFSET 0` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data invalid
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

`GET` `/graph/sparql`

<!--source:api-specifications-->

#### Query Graph
<!--/source-->

`query_graph`

<!--source:api-specifications-->
Query Graph as SPARQL HTTP JSON query endpoint so that customer can use it with any SPARQL wrapper, f.e.: Endpoint is fully compatible with SPARQL 1.1 Protocol. Supports SELECT, ASK, CONSTRUCT, and DESCRIBE queries. The default return format is JSON-LD, customizable with an `Accept` header. Persistence Graph service is installed as a separate component from the marketplace and requires an installed Persistence product. Persistence Graph costs 300 USD per month.

Show the rest To include the collection in the graph, you should set the serialise_to_graph parameter in metadata to true. The collection is stored as a named graph with transaction_id as graph URI in the format: ``.

Example of Collection in TriG format:

```
@prefix sci: .
 @prefix sc: .
 @prefix xsd: .
 sci:01GPG88H8ZYDDTXE9M6DYCF7WN {
 sci:01GPG88H8ZYDDTXE9M6DYCF7WN sci:transaction_label "some_label"
 sci:01GPG89C7FRM7F5STXMW59TBPQ sci:data [ sc:addresses sci:01GPG9FP9CM7SN1AF1NP3Z0B5K,
 sci:01GPGBQNZ5YHEWTKN43B8CPWHW ;
 sc:people sci:01GPG8ZHGNWH85DYPZQ7CEVTRZ ] ;
 sci:metadata [ sci:active true ;
 sci:created_at "2023-01-11T13:56:48.485729" ;
 sci:last_updated_at "2023-01-11T13:57:48.485729" ] .
 sci:01GPG8ZHGNWH85DYPZQ7CEVTRZ a sc:borrower ;
 sc:has_first_name [ sc:has_value "Bob" ] ;
 sc:with_addresses sci:01GPG9FP9CM7SN1AF1NP3Z0B5K,
 sci:01GPGBQNZ5YHEWTKN43B8CPWHW .
 sci:01GPG9FP9CM7SN1AF1NP3Z0B5K a sc:mailing_address ;
 sc:has_city_name [ sc:has_value "New York" ] .
 sci:01GPGBQNZ5YHEWTKN43B8CPWHW a sc:mailing_address ;
 sc:has_city_name [ sc:has_value "Chicago" ] .
 }
```

<!--/source-->

##### Response

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Malformed query",
 "code": "MalformedQueryException"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `query` required | `string` query | `SELECT%20%2A%20WHERE%20%7B%20%3Fs%20%3Fp%20%3Fo%20%7D%20LIMIT%2010` | <!--source:api-specifications-->Your SPARQL query in URL-encoded format<!--/source--> |
| `Accept` | `string` header | `application/sparql-results+json` | <!--source:api-specifications-->Accept header is used to specify the format of the response. If not specified, the default is application/sparql-results+json. Supported formats: application/nquads, application/n-triples, application/rdf+xml, application/ld+json, application/trig, application/trix, text/turtle, text/x-nquads, text/n3, application/sparql-results+json, application/x-binary-rdf, */*<!--/source--> |
| `explain` | `string` query | `static` | <!--source:api-specifications-->Explain parameter could be passed to retrieve information about how your SPARQL query will be executed in the neptune. Currently supports explain only in SPARQL SELECT queries.<!--/source--> |

##### Response `200``application/sparql-results+json`

<!--source:api-specifications-->
3 fields
<!--/source-->
<!--source:api-specifications-->
queried
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `head` | `object` | <!--source:api-specifications-->The head of the result set.<!--/source--> |
| `vars` | `string[]` | <!--source:api-specifications-->The variables in the result set.<!--/source--> |
| `results` | `object` | <!--source:api-specifications-->The results of the query.<!--/source--> |
| `bindings` | `object[]` | <!--source:api-specifications-->The bindings of the results.<!--/source--> |
| `boolean` | `boolean` | <!--source:api-specifications-->The boolean result of the query. Used in ASK query<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Exception Code in Neptune format<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`406``422``500`

<!--source:api-specifications-->

### Typesense
<!--/source-->

`GET` `/health`

<!--source:api-specifications-->

#### Health check
<!--/source-->

`health_check`

##### Response

<!--source:api-specifications-->
application/json Copy OK response

```
{
 "ok": true
}
```

<!--/source-->

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
OK response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `ok` | `boolean` | <!--source:api-specifications-->Health check status.<!--/source--> |

<!--source:api-specifications-->

### Indexes
<!--/source-->

`POST` `/indexes`

<!--source:api-specifications-->

#### Create Index
<!--/source-->

`create_index`

<!--source:api-specifications-->
Creates an index. Persistence indexes support 2 type of JSON query languages: JSONPath and JMESPath. Both of them work with graph v2 collections like in Query on Collection Level endpoint. After index is created all collections will be indexed against it. You can list indexed items using List index items endpoint.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "name": "borrower_ssn",
 "path": {
 "path": "$.people[?(@['@type'] == 'borrower')].has_taxpayer_identifier_value.has_value",
 "format": "jsonpath"
 }
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `name`required | `string` | <!--source:api-specifications-->Name of the Index<!--/source--> |
| `many` | `boolean` | <!--source:api-specifications-->Flag that defines the separating of values in the query to different items. If `many` == true, and query by index found more than 2 values, they will be put to different items. Otherwise, to the same item.<!--/source--> |
| `path`required | `object` | <!--source:api-specifications-->The location of data to be indexed<!--/source--> |
| `path`required | `string` | <!--source:api-specifications-->The query path<!--/source--> |
| `format`required | `string` | <!--source:api-specifications-->The query format in use<!--/source-->`jmespath``jsonpath` |
| `transaction_labels` | `string[]` | <!--source:api-specifications-->The list of transaction labels, which collections need to be captured in the index<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->
<!--source:api-specifications-->
created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `name`required | `string` | <!--source:api-specifications-->Name of the Index<!--/source--> |
| `many` | `boolean` | <!--source:api-specifications-->Flag that defines the separating of values in the query to different items. If `many` == true, and query by index found more than 2 values, they will be put to different items. Otherwise, to the same item.<!--/source--> |
| `path`required | `object` | <!--source:api-specifications-->The location of data to be indexed<!--/source--> |
| `path`required | `string` | <!--source:api-specifications-->The query path<!--/source--> |
| `format`required | `string` | <!--source:api-specifications-->The query format in use<!--/source-->`jmespath``jsonpath` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

`GET` `/indexes`

<!--source:api-specifications-->

#### List Indexes
<!--/source-->

`list_indexes`

<!--source:api-specifications-->
List indexes
<!--/source-->

<!--source:api-specifications-->
List indexes. You can specify additional filters using the `index_name` or `created_at` parameters, with available operators: `gt, lt, startswith`.

<!--/source-->

##### Response

<!--source:api-specifications-->
400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Description |
| --- | --- | --- |
| `filter` | `string` query | <!--source:api-specifications-->Filter by one of the index_name or created_at fields.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->
<!--source:api-specifications-->
Index
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `indexes` | `array` | <!--source:api-specifications-->List of indexes<!--/source--> |
| `_links` | `object` | <!--source:api-specifications-->Links to next page of results<!--/source--> |
| `next` | `string` | <!--source:api-specifications-->Link to next page of results<!--/source--> |
| `next_token` | `string` | <!--source:api-specifications-->Pagination token for next page<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

`DELETE` `/indexes/{index_name}`

<!--source:api-specifications-->

#### Delete Index
<!--/source-->

`delete_index`

<!--source:api-specifications-->
Delete an index

<!--/source-->

##### Response

<!--source:api-specifications-->
200404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Index

```
{
 "message": "Index deleted"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `index_name` required | `string` path | `my_index` | <!--source:api-specifications-->The name of the index<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Index
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source-->Example `Index deleted` |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/indexes/{index_name}`

<!--source:api-specifications-->

#### Retrieve Index
<!--/source-->

`get_index`

<!--source:api-specifications-->
Retrieve an index

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Index

```
{
 "name": "borrower_ssn",
 "path": {
 "path": "$.people[@['@type'] == 'borrower'].has_taxpayer_identifier_value.has_value",
 "format": "jsonpath"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `index_name` required | `string` path | `my_index` | <!--source:api-specifications-->The name of the index<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
6 fields
<!--/source-->
<!--source:api-specifications-->
Index
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `name`required | `string` | <!--source:api-specifications-->The name of the index<!--/source--> |
| `path`required | `object` | <!--source:api-specifications-->The query location of the indexed data<!--/source--> |
| `path`required | `string` | <!--source:api-specifications-->Value of the path<!--/source--> |
| `format`required | `string` | <!--source:api-specifications-->The query format in use<!--/source-->`jmespath``jsonpath` |
| `created_at` | `string (date-time)` | <!--source:api-specifications-->Date time when index was created.<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Status of the index<!--/source-->`AVAILABLE``REINDEXING``REINDEXING_FAILED` |
| `reindexing_failure_reason` | `string` | <!--source:api-specifications-->Provided if status is "REINDEXING_FAILED".<!--/source--> |
| `_links` | `object` | <!--source:api-specifications-->Links<!--/source--> |
| `items` | `string (uri)` | <!--source:api-specifications-->Link to index items<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/indexes/{index_name}/items`

<!--source:api-specifications-->

#### Get items in index
<!--/source-->

`list_items`

<!--source:api-specifications-->
List index items
<!--/source-->

<!--source:api-specifications-->
List index items. Index items contain transaction and collection IDs of collections with its values. Items can be filtered by value and by creation date, by providing them in query parameters. Items are sorted by creation date. Filtering by created_at:

- gt:
- description: Get items, that were created after specified datetime in ISO format
- example: created_at+gt+2021-03-30T04:27:15.372006-04:00
- lt:
- description: Get items, that were created before specified datetime in ISO format
- example: created_at+lt+2021-03-30T04:27:15.372006-04:00

<!--/source-->

##### Response

<!--source:api-specifications-->
400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
5
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `index_name` required | `string` path | `my_index` | <!--source:api-specifications-->The name of the index<!--/source--> |
| `value` | `string` query | — | <!--source:api-specifications-->Filter by value of the indexed data<!--/source--> |
| `sort` | `string` query | — | <!--source:api-specifications-->Sorting direction.<!--/source--> |
| `filter` | `string` query | — | <!--source:api-specifications-->Filter by created_at field.<!--/source--> |
| `limit` | `integer` query | — | <!--source:api-specifications-->Limit the number of items returned.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->
<!--source:api-specifications-->
Indexed data
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `items` | `array` | <!--source:api-specifications-->Items matching the query<!--/source--> |
| `_links` | `object` | <!--source:api-specifications-->Links to next page of results<!--/source--> |
| `next` | `string` | <!--source:api-specifications-->Link to next page of results<!--/source--> |
| `next_token` | `string` | <!--source:api-specifications-->Pagination token for next page<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

`POST` `/indexes/{index_name}/reindex`

<!--source:api-specifications-->

#### Re-index collections
<!--/source-->

`reindex_collections`

<!--source:api-specifications-->
Re-indexes specific v2 collections on the environment that were created before the index was created. You must specify specific transactions to be re-indexed with body parameters: `transaction_ids` or `transaction_label`. Reindexing of all collections on the environment is not supported since cost of reindexing all collections is too high.

<!--/source-->

##### Request

<!--source:api-specifications-->
Specific list of transactionsSpecific transaction label
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "transaction_ids": [
 "01EZQ32NEN5VDHE288WN4TV2D3",
 "01EZQ32NEN5VDHE288WN4TV2D4"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "transaction_label": "my_transaction_label"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
400404409
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Conflict

```
{
 "message": "Index name 'x' already exists"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `index_name` required | `string` path | `my_index` | <!--source:api-specifications-->The name of the index<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_ids` | `string[]` | <!--source:api-specifications-->List of transaction ID's which collections will be re-indexed.<!--/source--> |
| `transaction_label` | `string` | <!--source:api-specifications-->Transaction label, which collections will be re-indexed.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `status` | `string` | <!--source:api-specifications-->New status of the index<!--/source-->`REINDEXING` |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `409``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Conflict
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

`POST` `/indexes/query`

<!--source:api-specifications-->

#### Query Indexes
<!--/source-->

`query_indexes`

<!--source:api-specifications-->
Query on Indexes
<!--/source-->

<!--source:api-specifications-->
Query on multiple Indexes at the same time to find specific collections. You can query on indexes values with operations: `between, contains, eq, gt, gte, lt, lte, ne, startswith`. And then you can combine them with logical operators: `and, or, xor, diff`; such as on the example below.

<!--/source-->

##### Request

<!--source:api-specifications-->
Complex querySimple query
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "or": [
 {
 "and": [
 {
 "index_name": "foo",
 "operation": "eq",
 "value": 23
 },
 {
 "index_name": "bar",
 "operation": "startswith",
 "value": "grate"
 }
 ]
 },
 {
 "index_name": "baz",
 "operation": "between",
 "value": [
 20,
 35
 ]
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "index_name": "foo",
 "operation": "eq",
 "value": 23
}
```

<!--/source-->

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Successfully queried indexes
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `results` | `object[]` | <!--source:api-specifications-->List of collections that match the query<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->Transaction ID of the collection<!--/source--> |
| `collection_id` | `string` | <!--source:api-specifications-->Collection ID of the collection<!--/source--> |

##### Other responses

`422`

<!--source:api-specifications-->

### Lexicon
<!--/source-->

`PUT` `/lexicon`

<!--source:api-specifications-->

#### Import Lexicon
<!--/source-->

`PutLexicon`

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "classes": [
 {
 "type": "person",
 "container_name": "people",
 "is_deprecated": false,
 "deprecated_properties": [],
 "properties": {
 "first_name": {
 "type": "boolean"
 }
 }
 },
 {
 "type": "address",
 "container_name": "addresses",
 "is_deprecated": false,
 "deprecated_properties": [
 "address_line_deprecated"
 ],
 "properties": {
 "address_type": {
 "type": "string",
 "enum": [
 "Mailing",
 "Current"
 ]
 },
 "address_line_1": {
 "type": "string"
 },
 "address_line_deprecated": {
 "type": "string"
 }
 }
 },
 {
 "type": "credit",
 "container_name": "credits",
 "is_deprecated": false,
 "deprecated_properties": [],
 "properties": {
 "credit_identifier": {
 "type": "string"
 }
 },
 "relationships": {
 "owed_to": {
 "targets": [
 "person"
 ]
 }
 }
 },
 {
 "type": "finance_relation",
 "container_name": "relationships",
 "relationships": {
 "has_person": {
 "targets": [
 "person"
 ]
 }
 }
 },
 {
 "type": "contact_relation",
 "container_name": "relationships",
 "relationships": {
 "my_id": {
 "targets": [
 "person"
 ]
 }
 }
 }
 ]
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `classes`required | `object[]` | <!--source:api-specifications-->List of classes<!--/source--> |
| `type`required | `string` | <!--source:api-specifications-->Type of class<!--/source--> |
| `container_name`required | `string` | <!--source:api-specifications-->Container name<!--/source--> |
| `is_deprecated`required | `boolean` | <!--source:api-specifications-->Is deprecated<!--/source--> |
| `deprecated_properties`required | `string[]` | <!--source:api-specifications-->Deprecated properties<!--/source--> |
| `properties`required | `object` | <!--source:api-specifications-->Properties<!--/source--> |
| `relationships` | `object` | <!--source:api-specifications-->Relationships<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Lexicon have been accepted to import
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Lexicon have been accepted to import<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Lexicon did not passed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Error message<!--/source--> |

<!--source:api-specifications-->

### Embeddings
<!--/source-->

`GET` `/lexicon/embeddings/smoke`

<!--source:api-specifications-->

#### Smoke
<!--/source-->

`smoke`

<!--source:api-specifications-->
Hello World
<!--/source-->

<!--source:api-specifications-->
Dummy hello world endpoint

<!--/source-->

##### Other responses

`200`

<!--source:api-specifications-->

### Notifications
<!--/source-->

`DELETE` `/notifications/configurations`

<!--source:api-specifications-->

#### Configure channel webhook
<!--/source-->

`delete_configuration`

<!--source:api-specifications-->
Delete Configuration
<!--/source-->

<!--source:api-specifications-->
Delete a notification configuration.

<!--/source-->

##### Response

<!--source:api-specifications-->
400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Configuration not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `configuration` required | `string` query | `https://hooks.slack.com/services/ABCZXC/B00000000/ABCZXCJWKM` | <!--source:api-specifications-->The configuration identifier to delete.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`204`

`GET` `/notifications/configurations`

<!--source:api-specifications-->

#### Configure channel webhook
<!--/source-->

`list_configurations`

<!--source:api-specifications-->
List Configurations
<!--/source-->

<!--source:api-specifications-->
Retrieve a list of notification configurations.

<!--/source-->

##### Response

<!--source:api-specifications-->
200404
<!--/source-->

<!--source:api-specifications-->
application/json Copy List of configurations

```
{
 "configurations": [
 {
 "slack_webhook_url": "https://hooks.slack.com/services/ABCZXC/B00000000/ABCZXCJWKM"
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Configuration not found"
}
```

<!--/source-->

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
List of configurations
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `configurations` | `object[]` | <!--source:api-specifications-->List of configurations<!--/source--> |
| `slack_webhook_url` | `string` | <!--source:api-specifications-->Slack webhook URL<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`POST` `/notifications/configurations`

<!--source:api-specifications-->

#### Configure channel webhook
<!--/source-->

`create_configuration`

<!--source:api-specifications-->
Create configuration
<!--/source-->

<!--source:api-specifications-->
Create a new configuration for notifications. Use slack webhook url from to your channel, to use it for getting notifications about deprecated collections in persistence on daily basis.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "slack_webhook_url": "https://hooks.slack.com/services/ABCZXC/B00000000/ABCZXCJWKM"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400
<!--/source-->

<!--source:api-specifications-->
application/json Copy Configuration created

```
{
 "slack_webhook_url": "https://hooks.slack.com/services/ABCZXC/B00000000/ABCZXCJWKM"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `slack_webhook_url` | `string (uri)` | <!--source:api-specifications-->Slack webhook URL<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Configuration created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `slack_webhook_url` | `string (uri)` | <!--source:api-specifications-->Slack webhook URL<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

<!--source:api-specifications-->

### PDFs
<!--/source-->

`POST` `/pdf-splitter/invocations`

<!--source:api-specifications-->

#### Split PDF
<!--/source-->

`split_pdf`

<!--source:api-specifications-->
Start PDF splitting process. If `callback_url` was provided in body, this url will be called with `POST` request, with your `x-api-key` in headers. If response for this call has non `2XX` status code or doesn't respond within 6 sec, requests will be retried during 5 minutes every 2 seconds, You can indicate if you already processed that event, but for some reasons respond with non `2XX` code by `id` parameter. `type` parameter indicates type of the event.

Show the rest

| Event type | Description |
| --- | --- |
| co.staircase.pdf_split | PDF splitting is finished successfully |
| co.staircase.pdf_split_failed | PDF splitting is failed |

Event structure is cloudevents, so you can use any tools that supports it or SDK

```
{
 "type": "object",
 "$schema": "",
 "properties": {
 "specversion": {
 "type": "string",
 "description": "Version of cloudevents event structure"
 },
 "id": {
 "type": "string",
 "description": "Unique identifier of the event, for retired requests will always be the same"
 },
 "source": {
 "type": "string",
 "description": "Source of the event, for Persistence it will always be co.staircase.persistence",
 "const": "persistence"
 },
 "type": {
 "type": "string",
 "description": "Name of the event, that indicates, what happened",
 "enum": [
 "co.staircase.persistence.pdf_split",
 "co.staircase.persistence.pdf_split_failed"
 ]
 },
 "time": {
 "type": "string",
 "format": "date-time",
 "description": "Timestamp of when the occurrence happened."
 },
 "data": {
 "type": "object",
 "properties": {
 "transaction_id": {
 "type": "string",
 "format": "ulid",
 "description": "Transaction id"
 },
 "response_collection_id": {
 "type": "string",
 "format": "ulid",
 "description": "Collection id"
 },
 "reason": {
 "type": "string",
 "description": "Failure reason"
 }
 }
 }
 }
 }
```

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "transaction_id": "01G92FSH5FYKQE6X22FECB95V2",
 "collection_id": "01G92FSX8A9YXPAMT6V97TH0VZ"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
202400
<!--/source-->

<!--source:api-specifications-->
application/json Copy Accepted.

```
{
 "collection_id": "01G92FWG135BTEMQC3SSMA8Q7A"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id`required | `string` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `collection_id`required | `string` | <!--source:api-specifications-->Collection ID<!--/source--> |
| `options` | `object` | <!--source:api-specifications-->Options<!--/source--> |
| `callback_url` | `string (url)` | <!--source:api-specifications-->Callback URL<!--/source--> |

##### Response `202``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Accepted.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `collection_id` | `string` | <!--source:api-specifications-->Response collection ID.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

`GET` `/pdf-splitter/invocations`

<!--source:api-specifications-->

#### List PDF Splitting jobs
<!--/source-->

`list_pdf_splitting_job`

<!--source:api-specifications-->
Provides the list of splitting jobs.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400
<!--/source-->

<!--source:api-specifications-->
application/json Copy OK.

```
{
 "invocations": [
 {
 "invocation_id": "01G92FWG135BTEMQC3SSMA8Q7A"
 },
 {
 "invocation_id": "01G92FWG135BTEMQC3SSMA8Q7B"
 },
 {
 "invocation_id": "01G92FWG135BTEMQC3SSMA8Q7C"
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

##### Response `200``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
OK.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `invocations`required | `object[]` | <!--source:api-specifications-->Invocations list.<!--/source--> |
| `invocation_id` | `string` | <!--source:api-specifications-->Invocation ID.<!--/source--> |
| `next_token` | `string` | <!--source:api-specifications-->Token to paginate<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/pdf-splitter/invocations/{invocation_id}`

<!--source:api-specifications-->

#### Get PDF Splitting job
<!--/source-->

`get_pdf_splitting_job`

<!--source:api-specifications-->
Provides the splitting job information.

<!--/source-->

##### Response

<!--source:api-specifications-->
200404
<!--/source-->

<!--source:api-specifications-->
application/json Copy OK.

```
{
 "invocations": [
 {
 "invocation_id": "01G92FWG135BTEMQC3SSMA8Q7A"
 },
 {
 "invocation_id": "01G92FWG135BTEMQC3SSMA8Q7B"
 },
 {
 "invocation_id": "01G92FWG135BTEMQC3SSMA8Q7C"
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `invocation_id` required | `string` path | `12345` | <!--source:api-specifications-->Invocation ID<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
5 fields
<!--/source-->
<!--source:api-specifications-->
OK.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `status`required | `string` | <!--source:api-specifications-->Job status<!--/source-->`ABORTED``FAILED``RUNNING``SUCCEEDED``TIMED_OUT` |
| `input`required | `object` | <!--source:api-specifications-->Job input.<!--/source--> |
| `documents` | `object[]` | <!--source:api-specifications-->Input documents<!--/source--> |
| `blob_id` | `string` | <!--source:api-specifications-->Blob ID<!--/source--> |
| `callback_url` | `string (url)` | <!--source:api-specifications-->Callback URL<!--/source--> |
| `transaction_id`required | `string` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `collection_id`required | `string` | <!--source:api-specifications-->Collection ID<!--/source--> |
| `started_at`required | `string (date-time)` | <!--source:api-specifications-->Datetime when job was started in iso-format.<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

<!--source:api-specifications-->

### Search
<!--/source-->

`GET` `/search/indexes`

<!--source:api-specifications-->

#### Get Search Indexes
<!--/source-->

`get_search_indexes`

<!--source:api-specifications-->
Get indexes
<!--/source-->

<!--source:api-specifications-->
This function retrieves list of indexes and their statuses. You can specify `index_name` parameter in query parameters and retrieve the status of particular index, indicating whether it is currently active and available for querying.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy queried

```
[
 {
 "Options": {
 "IndexFieldName": "name",
 "IndexFieldType": "text-array"
 },
 "Status": {
 "CreationDate": "2023-04-03T01:02:06.541Z",
 "UpdateDate": "2023-04-03T01:02:06.541Z",
 "UpdateVersion": 1,
 "State": "Active",
 "PendingDeletion": false
 }
 }
]
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Malformed query",
 "code": "MalformedQueryException"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `index_name` | `string` query | `name` | <!--source:api-specifications-->Name of the index<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Exception Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`200``422``500`

`POST` `/search/indexes`

<!--source:api-specifications-->

#### Create Search Index
<!--/source-->

`create_search_index`

<!--source:api-specifications-->
Create index
<!--/source-->

<!--source:api-specifications-->
To create an index with text fields for indexing, you need to provide a request body in JSON format with the specified index_name. After creating the index, the status will initially be Processing. Only when the status changes to Active, the newly added field will be available for querying and uploading new documents. However, please note that the new field will not be indexed for previously added documents. It's also important to note that there is a quota of 200 indexing fields.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "index_name": "addresses/has_state_code/has_value"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400409
<!--/source-->

<!--source:api-specifications-->
application/json Copy queried

```
{
 "IndexField": {
 "Status": {
 "CreationDate": "2023-04-03T01:02:06.541Z",
 "UpdateDate": "2023-04-03T01:02:06.541Z",
 "State": "Active"
 }
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Malformed query",
 "code": "MalformedQueryException"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Conflict

```
{
 "message": "Index name 'x' already exists"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `index_name`required | `string` | <!--source:api-specifications-->Name of the index<!--/source-->Example `name` |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
queried
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `IndexField` | `object` | <!--source:api-specifications-->Index field<!--/source--> |
| `Status` | `object` | <!--source:api-specifications-->Status<!--/source--> |
| `CreationDate` | `string` | <!--source:api-specifications-->Creation date<!--/source-->Example `2023-04-03T01:02:06.541Z` |
| `UpdateDate` | `string` | <!--source:api-specifications-->Update date<!--/source-->Example `2023-04-03T01:02:06.541Z` |
| `State` | `string` | <!--source:api-specifications-->State<!--/source-->`Active``FailedToValidate``Processing``RequiresIndexDocuments`Example `Active` |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Exception Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `409``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Conflict
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

`POST` `/search/query`

<!--source:api-specifications-->

#### Query
<!--/source-->

`perform_search_query`

<!--source:api-specifications-->
To search for a value in a field using fuzzy search, follow these guidelines:

- If the value you provide contains a single word, fuzzy search will be performed based on the Levenshtein Distance with this word. This means that the search will return results that contains the word you provided, but with minor spelling variations due to insertions, deletions, or substitutions of characters.
- If the value you provide is a phrase, separated with spaces, proximity search will be performed. This means that the search will return results that contain the words in your phrase in proximity to each other. The proximity between words is defined by a maximum number of words that can occur between them in the searched field. Optionally, you can also specify a `latest_transaction_collection` flag, which will return only the latest transaction collection for each result. This is useful when you want to get the latest transaction collection for each result, but don't want to perform a separate query for each result.

<!--/source-->

##### Request

<!--source:api-specifications-->
SimpleExamplelatest_transaction_collectiontransaction_label
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "fields": [
 {
 "field": "addresses/has_state_name/has_value",
 "value": "CA",
 "distance": 10,
 "weight": 0.5
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "fields": [
 {
 "field": "addresses/has_state_name/has_value",
 "value": "CA",
 "distance": 10,
 "weight": 0.5
 }
 ],
 "latest_transaction_collection": true
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "fields": [
 {
 "field": "addresses/has_state_name/has_value",
 "value": "CA",
 "distance": 10,
 "weight": 0.5
 }
 ],
 "transaction_label": "01GZNQYD9H0J2Z57F4JJJTKQ1Q"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400
<!--/source-->

<!--source:api-specifications-->
application/json Copy Queried response

```
[
 {
 "transaction_id": "01GV5S3SYTEX8QSVEWSPVQHNQS",
 "score": 0.95,
 "collection_id": "01GV5S40XNZ47YYASFRE78GXW1"
 }
]
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Malformed query",
 "code": "MalformedQueryException"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `fields`required | `object[]` | <!--source:api-specifications-->List of fields to query<!--/source--> |
| `field` | `string` | <!--source:api-specifications-->Field to query<!--/source-->Example `addresses/has_state_code/has_value` |
| `value` | `string` | <!--source:api-specifications-->Value to query<!--/source-->Example `CA` |
| `distance` | `number` | <!--source:api-specifications-->Distance to query<!--/source-->Example `10` |
| `weight` | `number` | <!--source:api-specifications-->Weight to query<!--/source-->Example `0.5` |
| `latest_transaction_collection` | `boolean` | <!--source:api-specifications-->Whether to query the latest transaction collection. If true, results will only contain transaction/collection ID pairs where the collection is the latest in its transaction. Default is false.<!--/source-->Example `true` |
| `transaction_label` | `string` | <!--source:api-specifications-->When this parameter is set, the search results will only include transactions that have the specified transaction label.<!--/source-->Example `my_label` |

##### Response `200``application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->
<!--source:api-specifications-->
Queried response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string` | <!--source:api-specifications-->Transaction_id of the result<!--/source-->Example `01GV5S3SYTEX8QSVEWSPVQHNQS` |
| `score` | `number` | <!--source:api-specifications-->Score of the result<!--/source-->Example `0.95` |
| `collection_id` | `string` | <!--source:api-specifications-->Collection_id of the result<!--/source-->Example `01GV5S40XNZ47YYASFRE78GXW1` |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Exception Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

<!--source:api-specifications-->

### SUG
<!--/source-->

`POST` `/sug/{container_name}`

<!--source:api-specifications-->

#### Create Item
<!--/source-->

`create_item`

<!--source:api-specifications-->
Add item to specified container
<!--/source-->

<!--source:api-specifications-->
Endpoint to add an item to a specified container in the Staircase Universal Graph. The 'item' object in request must include the '@type' property and may also include the '@id' property. If the '@id' property is not provided, it will be generated automatically. The 'item' object may also include any additional properties, which will be added to the item. A successful request will return a JSON object containing the 'item' object with '@id', '@type', and any additional properties of the created item.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "item": {
 "@type": "Address",
 "street": "123 Main St",
 "city": "Anytown",
 "state": "CA",
 "zip": 12345
 }
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400404409
<!--/source-->

<!--source:api-specifications-->
application/json Copy Created item successfully

```
{
 "item": {
 "@id": "1234567890",
 "@type": "Address",
 "street": "123 Main St",
 "city": "Anytown",
 "state": "CA",
 "zip": 12345
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Container not found"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Conflict

```
{
 "message": "Item with @id 'x' already exists"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `container_name` required | `string` path | `addresses` | <!--source:api-specifications-->Name of the container where the item will be added<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `item` | `object` | <!--source:api-specifications-->Item that was created<!--/source--> |
| `@id` | `string` | <!--source:api-specifications-->ID of the created item<!--/source--> |
| `@type` | `string` | <!--source:api-specifications-->Type of the created item<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Created item successfully
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `item`required | `object` | <!--source:api-specifications-->Item that was created<!--/source--> |
| `@id` | `string` | <!--source:api-specifications-->ID of the created item<!--/source--> |
| `@type` | `string` | <!--source:api-specifications-->Type of the created item<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `409``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Conflict
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

`GET` `/sug/items/{id}`

<!--source:api-specifications-->

#### Get Item
<!--/source-->

`get_item`

<!--source:api-specifications-->
Get item in Staircase Universal Graph
<!--/source-->

<!--source:api-specifications-->
Endpoint to get an item in the Staircase Universal Graph. A successful request will return a JSON object containing the 'item' object with '@id', '@type', and properties of the item

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Get item successfully

```
{
 "item": {
 "@id": "1234567890",
 "@type": "Address",
 "street": "123 Main St",
 "city": "Anytown",
 "state": "CA",
 "zip": 12345
 },
 "container_name": "addresses"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Container not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `id` required | `string` path | `AJXZ159292` | <!--source:api-specifications-->Id of the item to get<!--/source--> |
| `id` required | `string` path | `AJXZ159292` | <!--source:api-specifications-->Id of the item to get<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Get item successfully
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `item`required | `object` | <!--source:api-specifications-->Item that was created<!--/source--> |
| `@id` | `string` | <!--source:api-specifications-->ID of the created item<!--/source--> |
| `@type` | `string` | <!--source:api-specifications-->Type of the created item<!--/source--> |
| `container_name` | `string` | <!--source:api-specifications-->Name of the container<!--/source-->Example `container_name` |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

`POST` `/sug/bulk-upload`

<!--source:api-specifications-->

#### Bulk Upload
<!--/source-->

`bulk_upload`

<!--source:api-specifications-->
Bulk Upload items in Staircase Universal Graph
<!--/source-->

<!--source:api-specifications-->
Endpoint to bulk upload items to the Staircase Universal Graph.

The 'items' object in request must include the '@type' property and may also include the '@id' property.

For all the items - if the `@id` property is not provided, it will be generated and set. Otherwise, if the item's `@type` is neither transaction or collection, the `@id` will be replaced with a newly generated one with keeping all the relationships in other items.

If some property of the item is a relationship and it contains the value which is not an @id of any item in the same request, this values will not be changed because it is considered as an @id of the existing item in the graph.

The 'items' object may also include any additional properties, which will be added to the item.

A successful request will return a JSON object containing:

- the `upload_id` which could be used to check the status of the upload.
- the `items` array of completed items.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "items": [
 {
 "@type": "person",
 "@id": "01GYSJNDZMZB37TNTWY8KVVSSC",
 "first_name": "John",
 "last_name": "Doe"
 },
 {
 "@type": "address",
 "@id": "01GYSVT1BCQHEFDY86FKGGX8PD",
 "city": "LA"
 },
 {
 "@type": "person_address_relation",
 "@id": "01GYSW9BAD87KKQM7F0GYK1AG3",
 "has_address": "01GYSVT1BCQHEFDY86FKGGX8PD",
 "has_person": "01GYSJNDZMZB37TNTWY8KVVSSC"
 }
 ]
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
202400404409
<!--/source-->

<!--source:api-specifications-->
application/json Copy Created item successfully

```
{
 "upload_id": "1234567890"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Container not found"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Conflict

```
{
 "message": "Item with @id 'x' already exists"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `items`required | `array` | <!--source:api-specifications-->Array of items to be uploaded<!--/source--> |
| `reassigned_ids` | `boolean` | <!--source:api-specifications-->Flag to reassign ids for items with existing ids. USE ONLY IF NEEDED.<!--/source--> |

##### Response `202``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Created item successfully
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `upload_id` | `string` | <!--source:api-specifications-->Id of the upload<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `409``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Conflict
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

`GET` `/sug/bulk-upload/{upload_id}`

<!--source:api-specifications-->

#### Check Bulk Upload
<!--/source-->

`get_bulk_upload`

<!--source:api-specifications-->
Check Bulk Upload Status
<!--/source-->

<!--source:api-specifications-->
Endpoint to check the status of a bulk upload to the Staircase Universal Graph. A successful request will return a JSON object containing the `upload_id` and `status` of the upload.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404409
<!--/source-->

<!--source:api-specifications-->
application/json Copy Created item successfully

```
{
 "upload_id": "1234567890",
 "status": "COMPLETED"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Container not found"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Conflict

```
{
 "message": "Item with @id 'x' already exists"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `upload_id` required | `string` path | `1234567890` | <!--source:api-specifications-->Id of the upload<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Created item successfully
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `upload_id` | `string` | <!--source:api-specifications-->Id of the upload<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Status of the upload<!--/source-->`COMPLETED``FAILED``IN_PROGRESS` |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `409``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Conflict
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

`POST` `/sug/construct`

<!--source:api-specifications-->

#### Construct data query
<!--/source-->

`construct_data_query`

<!--source:api-specifications-->
This endpoint provides an advanced items data querying mechanism that supports filtering conditions, nested relationships, aggregation, and pagination. It generates SPARQL query language to fetch data from a persistence graph database. You can specify types, properties, optional properties, and conditions along with optional fields like relations, aggregate functions, and grouping. You can specify item properties as ["*"] to include all properties. Supported conditions functions are: eq, in, ne, gt, lt, gte, lte, contains. Relationships are defined in a list of dictionaries, each containing the type, name, properties, conditions, and any nested relations. Aggregation supports simple functions like 'max', 'min', "count", etc. on specific attributes. In addition to this, you can opt for echo functionality which would return the SPARQL query used for the data fetch.

<!--/source-->

##### Request

<!--source:api-specifications-->
BasicPersonInfoFilterByNameWithRelationsGroupByAgeIncludeAllPropertiesAggregationExampleOptionalPropertiesAllFieldsExample
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "type": "person",
 "properties": [
 "first_name",
 "last_name"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "type": "person",
 "properties": [
 "first_name",
 "last_name"
 ],
 "conditions": {
 "first_name": {
 "condition": "eq",
 "value": "John"
 }
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "type": "person",
 "properties": [
 "first_name",
 "last_name"
 ],
 "relations": [
 {
 "relationship": "earns",
 "type": "income",
 "properties": [
 "annual_income"
 ],
 "conditions": {
 "annual_income": {
 "condition": "gt",
 "value": 50000
 }
 },
 "required": true
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "type": "person",
 "properties": [
 "age"
 ],
 "group_by": "age"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "type": "person",
 "properties": [
 "*"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "type": "person",
 "properties": [
 "last_name",
 "first_name"
 ],
 "aggregate": {
 "function": "max",
 "attribute": "last_name"
 },
 "group_by": "first_name"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "type": "person",
 "properties": [
 "first_name",
 "last_name",
 "email"
 ],
 "optional_properties": [
 "email"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "type": "person",
 "properties": [
 "first_name",
 "last_name",
 "email"
 ],
 "optional_properties": [
 "email"
 ],
 "relations": [
 {
 "relationship": "earns",
 "type": "income",
 "properties": [
 "annual_income"
 ],
 "conditions": {
 "annual_income": {
 "condition": "gt",
 "value": 50000
 }
 },
 "required": true
 }
 ],
 "group_by": "first_name",
 "aggregate": {
 "function": "max",
 "attribute": "last_name"
 },
 "pagination": {
 "limit": 10
 },
 "echo": true
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404409
<!--/source-->

<!--source:api-specifications-->
application/json Copy Succeeded

```
{
 "items": [
 {
 "@id": "01H7AAJJP33QV8V7EAG26MYZP1",
 "@type": "person",
 "first_name": "Leo",
 "last_name": "Messi",
 "person_identifier": "5ba3cf68-0eba-4011-a70b-a47899c2f986",
 "email": "messi@domain.com",
 "earns": {
 "@id": "01H7AAMTBJHDS4CB38PVZ62VCW",
 "@type": "income",
 "annual_income": 50001,
 "bonus_income_amount": 200,
 "income_identifier": "3b317e55-3614-4e97-b2df-e117b8834197"
 }
 }
 ],
 "pagination": {
 "limit": 10,
 "next_token": "39373833613763612d363461662d346231342d383035372d393535346138323363646337"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Container not found"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Conflict

```
{
 "message": "Item with @id 'x' already exists"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
9 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `type` | `string` | <!--source:api-specifications-->Type of the main object you're constructing.<!--/source-->Example `person` |
| `properties` | `string[]` | <!--source:api-specifications-->Properties to include for each main object. Use * to include all properties.<!--/source--> |
| `optional_properties` | `string[]` | <!--source:api-specifications-->Optional properties to include for each main object. You can add property from properties parameter here to mark it as optional.<!--/source--> |
| `conditions` | `object` | <!--source:api-specifications-->Conditions for filtering the main objects. Key-value pairs define the attribute and its condition.<!--/source--> |
| `relations` | `object[]` | <!--source:api-specifications-->Array of relation objects to include related items in the output.<!--/source--> |
| `group_by` | `string` | <!--source:api-specifications-->Attribute to group the results by.<!--/source-->Example `first_name` |
| `aggregate` | `object` | <!--source:api-specifications-->Aggregation function to apply on the grouped results.<!--/source--> |
| `pagination` | `object` | <!--source:api-specifications-->Pagination options, including limit for paginated responses.<!--/source--> |
| `echo` | `boolean` | <!--source:api-specifications-->Echo the SPARQL query used for the data fetch.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->
<!--source:api-specifications-->
Succeeded
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `items` | `object[]` | <!--source:api-specifications-->An array of item objects along with their relationship data.<!--/source--> |
| `@id` | `string` | <!--source:api-specifications-->The unique identifier of item.<!--/source--> |
| `pagination` | `object` | <!--source:api-specifications-->Pagination metadata for the list of items.<!--/source--> |
| `limit` | `integer` | <!--source:api-specifications-->The number of items returned per page.<!--/source--> |
| `next_token` | `integer` | <!--source:api-specifications-->Token to get the next set of items.<!--/source--> |
| `query` | `string` | <!--source:api-specifications-->The SPARQL query used for the data fetch.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `409``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Conflict
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

`GET` `/sug/{container_name}`

<!--source:api-specifications-->

#### List Items
<!--/source-->

`List Items`

<!--source:api-specifications-->
List items of specified container
<!--/source-->

<!--source:api-specifications-->
Endpoint to list items of a specified container in the Staircase Universal Graph. A successful request will return an array of objects containing the property 'item' with an object with '@id', '@type', and any additional properties of item.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Succeeded

```
{
 "item": {
 "@id": "1234567890",
 "@type": "Address",
 "street": "123 Main St",
 "city": "Anytown",
 "state": "CA",
 "zip": 12345
 },
 "version": 1
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Container not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
6
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `container_name` required | `string` path | `addresses` | <!--source:api-specifications-->Container name<!--/source--> |
| `filter` | `string` query | `first_name+eq+John` | <!--source:api-specifications-->Filter to query items in container to be returned. Supported operations - eq, ne, gt, lt, gte, lte, startswith, endswith, contains.<!--/source--> |
| `group_by` | `string` query | `person_identifier` | <!--source:api-specifications-->Property to group items by for aggregation. Should be a property name, valid for this container or @type or @id.<!--/source--> |
| `agg_func` | `string` query | `max+@id` | <!--source:api-specifications-->Aggregation for group_by property. Should be in format `{func}+{field}`. Available functions are: min, max, sample.<!--/source--> |
| `limit` | `string` query | `123456789` | <!--source:api-specifications-->Number of items to return. Default is 100.<!--/source--> |
| `sort` | `string` query | `asc` | <!--source:api-specifications-->Direction of sorting by '@id'. Default is 'desc'.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->
<!--source:api-specifications-->
Succeeded
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `items`required | `array` | <!--source:api-specifications-->Requested items<!--/source--> |
| `_links`required | `object` | <!--source:api-specifications-->Links to other resources<!--/source--> |
| `next` | `string` | <!--source:api-specifications-->Link to next page of results<!--/source-->Example `https://api.staircaseapi.com/persistence/sug/addresses?filter=first_name+eq+John&next_token=123456789` |
| `previous` | `string` | <!--source:api-specifications-->Link to previous page of results<!--/source-->Example `https://api.staircaseapi.com/persistence/sug/addresses?filter=first_name+eq+John&next_token=123456789` |
| `next_token` | `string` | <!--source:api-specifications-->Token to retrieve next page of results<!--/source-->Example `123456789` |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`PATCH` `/sug/items/{id}`

<!--source:api-specifications-->

#### Update Item
<!--/source-->

`update_itemNew`

<!--source:api-specifications-->
Update item in Staircase Universal Graph
<!--/source-->

<!--source:api-specifications-->
The API will create RDF triples with the predicate sc:has_data pointing to the new properties of the updated item. The API will create RDF triples with the predicate sc:has_target pointing to the new item representing the previous version. Consistency is ensured by making sure the RDF triples for sc:has_data and sc:has_target accurately reflect the versions, ensuring the current item points to the updated properties and the new versioned item represents the previous state. Item @id or @type can not be updated. If value of a field is `null`, the field will be removed from the item.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "item": {
 "street": "123 Main St",
 "city": "Anytown",
 "state": "CA",
 "zip": 12345
 }
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Created item successfully

```
{
 "status": "success",
 "message": "Item updated successfully and previous version created.",
 "updated_item": {
 "@id": "AJXZ159292",
 "@type": "Address",
 "street": "123 Main St",
 "city": "Anytown",
 "state": "CA",
 "zip": 12345
 },
 "versioned_item": {
 "@id": "AJXZ159292_v1",
 "@type": "Address",
 "street": "456 Old St",
 "city": "Oldtown",
 "state": "CA",
 "zip": 67890,
 "sc:version": 1
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Container not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `id` required | `string` path | `AJXZ159292` | <!--source:api-specifications-->Id of the item to get<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `item` | `object` | <!--source:api-specifications-->Item data to update<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
Created item successfully
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `status` | `string` | <!--source:api-specifications-->Status of the update<!--/source-->Example `success` |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source-->Example `Item updated successfully and previous version created.` |
| `updated_item` | `object` | <!--source:api-specifications-->Item that was created<!--/source--> |
| `@id` | `string` | <!--source:api-specifications-->ID of the created item<!--/source--> |
| `@type` | `string` | <!--source:api-specifications-->Type of the created item<!--/source--> |
| `versioned_item` | `object` | <!--source:api-specifications-->Item that was created<!--/source--> |
| `@id` | `string` | <!--source:api-specifications-->ID of the created item<!--/source--> |
| `@type` | `string` | <!--source:api-specifications-->Type of the created item<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

<!--source:api-specifications-->

### Transactions
<!--/source-->

`POST` `/transactions`

<!--source:api-specifications-->

#### Create Transaction
<!--/source-->

`create_transaction`

<!--source:api-specifications-->
Create empty transaction You can subscribe to all changes inside transaction by providing `callback_url` in body, and you will receive `POST` request to this url, with your `x-api-key` in headers. If you respond with a non `2XX` status code or not within 6 sec, requests will be retried during 5 minutes every 2 seconds, you can indicate if you already processed that event, but for some reasons respond with non `2XX` code by `id` parameter. `type` parameter indicates type of the event.

Show the rest

| Event type | Description |
| --- | --- |
| co.staircase.persistence.collection_created | New collection was created |
| co.staircase.persistence.collection_data_inserted | Data was added to collection |
| co.staircase.persistence.collection_metadata_updated | Metadata of collection was updated |
| co.staircase.persistence.collection_updated | Both metadata and data of collection was updated |

Event structure is cloudevents, so you can use any tools that supports it or SDK

```
{
 "type": "object",
 "$schema": "",
 "properties": {
 "specversion": {
 "type": "string",
 "description": "Version of cloudevents event structure"
 },
 "id": {
 "type": "string",
 "description": "Unique identifier of the event, for retired requests will always be the same"
 },
 "source": {
 "type": "string",
 "description": "Source of the event, for Persistence it will always be co.staircase.persistence",
 "const": "persistence"
 },
 "type": {
 "type": "string",
 "description": "Name of the event, that indicates, what happened",
 "enum": [
 "co.staircase.persistence.collection_created",
 "co.staircase.persistence.collection_data_inserted",
 "co.staircase.persistence.collection_metadata_updated",
 "co.staircase.persistence.collection_updated"
 ]
 },
 "time": {
 "type": "string",
 "format": "date-time",
 "description": "Timestamp of when the occurrence happened."
 },
 "data": {
 "type": "object",
 "properties": {
 "transaction_id": {
 "type": "string",
 "format": "ulid",
 "description": "Transaction id"
 },
 "collection_id": {
 "type": "string",
 "format": "ulid",
 "description": "Collection id"
 },
 "collection": {
 "type": "object",
 "description": "Collection itself"
 }
 }
 }
 }
 }
```

You can assign label to transaction by providing `label` field. To search for transaction using label you should use Retrieve List of Transactions endpoint You can provide an trace ID to the transaction by providing `x-sc-trace-id` header or query parameter. If trace ID is not provided, it will be generated automatically. Created transaction guarantees that trace ID will be present in the response header named `x-sc-trace-id`.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "label": "first_transaction"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400
<!--/source-->

<!--source:api-specifications-->
application/json Copy Transaction have been created

```
{
 "transaction_id": "01EZQ32PJQGKRA6HR8D72Q9FFF",
 "created_at": "2024-03-29T05:32:11.731227-04:00"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `x-sc-trace-id` | `string` query | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `callback_url` | `string (url)` | <!--source:api-specifications-->URL for receiving events about changes inside transaction<!--/source--> |
| `label` | `string` | <!--source:api-specifications-->Transaction label<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
5 fields
<!--/source-->
<!--source:api-specifications-->
Transaction have been created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `created_at` | `string` | <!--source:api-specifications-->Datetime, when transaction was created<!--/source--> |
| `callback_url` | `string` | <!--source:api-specifications-->Callback url<!--/source--> |
| `label` | `string` | <!--source:api-specifications-->Transaction label<!--/source--> |
| `_links` | `object` | <!--source:api-specifications-->Links<!--/source--> |
| `collections` | `string (url)` | <!--source:api-specifications-->Link to transaction collections<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/transactions/{transaction_id}`

<!--source:api-specifications-->

#### Retrieve Transaction
<!--/source-->

`get_transaction`

<!--source:api-specifications-->
Retrieve transaction
<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Transaction

```
{
 "transaction_id": "01EZQ32PJQGKRA6HR8D72Q9FFF",
 "created_at": "2024-03-29T05:32:11.731227-04:00"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
5 fields
<!--/source-->
<!--source:api-specifications-->
Transaction
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `created_at` | `string` | <!--source:api-specifications-->Datetime, when transaction was created<!--/source--> |
| `callback_url` | `string` | <!--source:api-specifications-->Callback url<!--/source--> |
| `label` | `string` | <!--source:api-specifications-->Transaction label<!--/source--> |
| `_links` | `object` | <!--source:api-specifications-->Links<!--/source--> |
| `collections` | `string (url)` | <!--source:api-specifications-->Link to transaction collections<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/transactions/{transaction_id}/data`

<!--source:api-specifications-->

#### Retrieve Transaction Data
<!--/source-->

`get_transaction_data`

<!--source:api-specifications-->
Retrieve transaction data
<!--/source-->

<!--source:api-specifications-->
Merge data from all collections of transaction. Data will be merged, assuming, that borrower from every collection is the same borrower

<!--/source-->

##### Response

<!--source:api-specifications-->
400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
6
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `collection_ids` | `string` query | `01FEP1VDZE6BQ1Q4X52JNPE2X4,01FEP1VPG7WJVQ3F8B3Y9J2NX8` | <!--source:api-specifications-->List of collection ids, that you want to be merged.<!--/source--> |
| `types_to_merge` | `string` query | `borrower,loan` | <!--source:api-specifications-->Types for merge<!--/source--> |
| `save_to_collection` | `boolean` query | `false` | <!--source:api-specifications-->Indicates if output should be saved to collection<!--/source--> |
| `staircase_version` | `integer` query | `3` | <!--source:api-specifications-->Version of Staircase language for collections to be merged. Collections, that are not of this version will be filtered out<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
Transaction Data
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `collection_id` | `string (ulid)` | <!--source:api-specifications-->Collection id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `data` | `object` | <!--source:api-specifications-->Data in Staircase language schema<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata about collection, f.e version of used Staircase schema. Maximum allowable length of the dumped json object - 400 000 symbols.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

`GET` `/transactions/{transaction_id}/data/{merge_id}`

<!--source:api-specifications-->

#### Retrieve Merge
<!--/source-->

`retrieve_merge`

<!--source:api-specifications-->
Retrieve merge status
<!--/source-->

<!--source:api-specifications-->
Retrieve status of async merge transaction operation for a given merge ID.

<!--/source-->

##### Response

<!--source:api-specifications-->
400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `merge_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRDX5QEXEDVR` | <!--source:api-specifications-->Merge ID<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
5 fields
<!--/source-->
<!--source:api-specifications-->
Merge status
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `merge_id` | `string` | <!--source:api-specifications-->Merge ID<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Merge status<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `error` | `string` | <!--source:api-specifications-->Error message if present<!--/source--> |
| `response_collection_id` | `string` | <!--source:api-specifications-->Collection ID of merged data<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

`GET` `/transactions`

<!--source:api-specifications-->

#### Retrieve List of Transactions
<!--/source-->

`retrieve_transactions`

<!--source:api-specifications-->
Retrieve transactions
<!--/source-->

<!--source:api-specifications-->
Retrieve list of transactions. Transactions can be filtered by transaction_id or created_at fields. Supported operations per fields:

- transaction_id:
- in:
- description: Get only transactions with specified ids
- example: transaction_id+in+01EZQ32PJQGKRA6HR8D72Q9FFF,01EZQ32NZ34WACWSAF54WGEM51
- created_at:
- gt:
- description: Get transactions, that was created after specified datetime in ISO format
- example: created_at+gt+2021-03-30T04:27:15.372006-04:00
- lt:
- description: Get transactions, that was created before specified datetime in ISO format
- example: created_at+lt+2021-03-30T04:27:15.372006-04:00
- label:
- eq:
- description: Get transactions where label equals provided value
- example: label+eq+byte-efb91c0c-e8d7-4bd5-a25c-07bdf58f3182

<!--/source-->

##### Response

<!--source:api-specifications-->
400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
6
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `filter` | `string` query | `transaction_id+in+01EZQ32PJQGKRA6HR8D72Q9FFF,01EZQ32NZ34WACWSAF54WGEM51` | <!--source:api-specifications-->Filter expression in format {field_name}+{operation}+{value}<!--/source--> |
| `sort` | `string` query | `asc` | <!--source:api-specifications-->Order of sorting<!--/source--> |
| `limit` | `number` query | `5` | <!--source:api-specifications-->Amount of items to show<!--/source--> |
| `after_id` | `string` query | `01EZQ32PJQGKRA6HR8D72Q9FFF` | <!--source:api-specifications-->id of last evaluated transaction<!--/source--> |
| `include_collections` | `boolean` query | `false` | <!--source:api-specifications-->If true, transaction collections will be included to the response body.<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
List of transactions
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transactions` | `object[]` | <!--source:api-specifications-->List of transactions<!--/source--> |
| `transaction_id` | `string` | <!--source:api-specifications-->Transaction id<!--/source--> |
| `created_at` | `string` | <!--source:api-specifications-->Datetime, when transaction was created<!--/source--> |
| `collections` | `array` | <!--source:api-specifications-->List of collections created inside transaction<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`POST` `/transactions/{transaction_id}/data`

<!--source:api-specifications-->

#### Merge transaction
<!--/source-->

`post_transaction_data`

<!--source:api-specifications-->
Retrieve transaction data
<!--/source-->

<!--source:api-specifications-->
Merge data from all collections of the transaction as well as collections data provided in the body. Data will be merged, assuming that every collection borrower is the same. Merging works only with collections with `"version": 2` in metadata, else it skips the collection without this parameter. You can specify `async` parameter to run the merge in asynchronous way and specify `callback_url` to receive the result in cloudevents format.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "merge_transaction_collections": false,
 "collection_ids": [
 "01FDF10040SA2VTETKJQXJ3MQZ",
 "01FJCADX5QEXEDVRWNXAK206MA"
 ],
 "staircase_version": 3,
 "types_to_merge": [
 "borrower",
 "address"
 ],
 "raw_collections": [
 {
 "metadata": {
 "version": 2,
 "validation": true
 },
 "data": {
 "people": [
 {
 "@type": "borrower",
 "@id": "01FDF04MYHEZ98AD7T8ZGY5CMB",
 "has_first_name": {
 "has_value": "John"
 },
 "has_last_name": {
 "has_value": "Deere"
 },
 "has_birth_date": {
 "has_value": "1985-01-01"
 },
 "has_taxpayer_identifier_value": {
 "has_value": "999-00-0000"
 },
 "contact_at": [
 "01FDF09BNQCT03DCAX7M5KM52T"
 ],
 "employed_as": [
 "01FDF0DFYAHBRJGFA5RS26HVP1"
 ]
 }
 ],
 "addresses": [
 {
 "@id": "01FDF077N6V7R2RNC64DGT31DY",
 "@type": "business_address",
 "has_address_line_1_text": {
 "has_value": "33 IRVING PLACE",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_address_line_2_text": {
 "has_value": "additional_line_text",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_city_name": {
 "has_value": "NEW YORK",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_postal_code": {
 "has_value": "10003",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_country_name": {
 "has_value": "US",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 }
 }
 ],
 "contact_information": [
 {
 "@type": "contact_information",
 "@id": "01FDF09BNQCT03DCAX7M5KM52T",
 "has_phone_number": {
 "has_value": "+1234567890"
 }
 }
 ],
 "employment": [
 {
 "@type": "employment",
 "@id": "01FDF0DFYAHBRJGFA5RS26HVP1",
 "has_employment_position_description": {
 "has_value": "Engineer",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "provided_by": [
 "01FDF0G4BP9AE6B7FT5VDEWK5F"
 ]
 }
 ],
 "organizations": [
 {
 "@type": "organization",
 "@id": "01FDF0G4BP9AE6B7FT5VDEWK5F",
 "has_organization_name": {
 "has_value": "GRAIN PROCESSING COR",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "with_address": [
 "01FDF077N6V7R2RNC64DGT31DY"
 ]
 }
 ],
 "mortgage_products": [
 {
 "@type": "employment",
 "@id": "01FDF10040SA2VTETKJQXJ3MQZ",
 "has_data_source_date": {
 "has_value": "1972-01-01"
 },
 "has_purpose_of_verification_description": {
 "has_value": "risk-assessment"
 }
 }
 ],
 "documents": [
 {
 "@type": "irs_w2",
 "@id": "01FS9VK2BVSBZYN0MMYQQ73KAZ",
 "has_staircase_document_category_type": {
 "has_value": "sc_core"
 },
 "has_document_description": {
 "has_value": "Employment Verification Report prepared by Staircase"
 },
 "has_document_mime_type": {
 "has_value": "application/pdf"
 },
 "has_document_name": {
 "has_value": "01FD9X8V5N804Y0CFWY7F72ZCD.pdf"
 }
 }
 ]
 }
 }
 ]
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
7 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `raw_collections` | `array` | <!--source:api-specifications-->List of collections created inside transaction<!--/source--> |
| `collection_ids` | `string[]` | <!--source:api-specifications-->List of Collection IDs to be merged<!--/source--> |
| `types_to_merge` | `string[]` | <!--source:api-specifications-->List of Types to be merged<!--/source--> |
| `staircase_version` | `integer` | <!--source:api-specifications-->Version of Staircase language for collections to be merged. Collections, that are not of this version will be filtered out<!--/source--> |
| `merge_transaction_collections` | `boolean` | <!--source:api-specifications-->If `true`, existing transaction collections will be included in merge<!--/source--> |
| `async` | `boolean` | <!--source:api-specifications-->If `true`, merge will be performed asynchronously<!--/source--> |
| `callback_url` | `string (uri)` | <!--source:api-specifications-->URL to which the callback will be sent if `async` is `true`<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
Transaction Data
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `collection_id` | `string (ulid)` | <!--source:api-specifications-->Collection id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `data` | `object` | <!--source:api-specifications-->Data in Staircase language schema<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata about collection, f.e version of used Staircase schema. Maximum allowable length of the dumped json object - 400 000 symbols.<!--/source--> |

##### Response `202``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Merge transaction collections request accepted
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `merge_id` | `string` | <!--source:api-specifications-->Merge ID<!--/source--> |
| `status` | `string` | <!--source:api-specifications-->Merge status<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

`POST` `/transactions/merge`

<!--source:api-specifications-->

#### Merge Transactions
<!--/source-->

`merge_transactions`

<!--source:api-specifications-->
Merge transactions into one transaction. This endpoint will merge all transactions into one transaction. All collections from transactions will be moved to new transaction. If you want to merge specific collections, you can use `collections` field. Only collections, that has version 3 and are validated using `metadata.validation = true`, can be merged. This API can merge up to 1000 collections.

<!--/source-->

##### Request

<!--source:api-specifications-->
merge_with_transactionsmerge_with_collections
<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "transaction_ids": [
 "01FJCADX5QEXEDVRWNXAK206MA",
 "01FJCAQW7EYJAA6FY05WRKRM3T"
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy
```
{
 "collections": [
 {
 "transaction_id": "01FJCADX5QEXEDVRWNXAK206MA",
 "collection_id": "01FJCAQW7EYJAA6FY05WRKRM3T"
 }
 ]
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200 application/json200 application/json400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy New merged transaction

```
{
 "transaction_id": "01FJCADX5QEXEDVRWNXAK206MA",
 "created_at": "2024-03-29T05:32:11.731227-04:00",
 "label": null,
 "callback_url": null,
 "_links": {
 "collections": "https://documentation.straircaseapi.com/transactions/01FJCADX5QEXEDVRWNXAK206MA/collections"
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy New merged transaction

```
{
 "transaction_id": "01EZQ32PJQGKRA6HR8D72Q9FFF",
 "created_at": "2024-03-29T05:32:11.731227-04:00"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_ids`required | `string[]` | <!--source:api-specifications-->Transaction ids<!--/source--> |
| `collections` | `object[]` | <!--source:api-specifications-->Collections to merge into one transaction<!--/source--> |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source--> |
| `collection_id` | `string (ulid)` | <!--source:api-specifications-->Collection id<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
5 fields
<!--/source-->
<!--source:api-specifications-->
New merged transaction
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `created_at` | `string` | <!--source:api-specifications-->Datetime, when transaction was created<!--/source--> |
| `callback_url` | `string` | <!--source:api-specifications-->Callback url<!--/source--> |
| `label` | `string` | <!--source:api-specifications-->Transaction label<!--/source--> |
| `_links` | `object` | <!--source:api-specifications-->Links<!--/source--> |
| `collections` | `string (url)` | <!--source:api-specifications-->Link to transaction collections<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

<!--source:api-specifications-->

### Collections
<!--/source-->

`POST` `/transactions/{transaction_id}/collections`

<!--source:api-specifications-->

#### Create Collection
<!--/source-->

`create_collection`

<!--source:api-specifications-->
Create Collection. Collection data can be validated by setting validation flag to true and version in metadata. To validate version 2 Language is required to be installed on the environment. To validate version 3 Persistence Graph is required to be installed on the environment. Collections by default are saved to Persistence Graph. Collections created with version 2 or 3 of Staircase lexicon are dumped according to the version of Staircase lexicon. Collections created with version 0 of Staircase lexicon are dumped with prefix ``"

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "metadata": {
 "version": 2,
 "validation": true,
 "linked_collections": [
 {
 "collection_id": "01EZQ32PJQGKRA6HR8D72Q9FFF",
 "label": "Employment Verification Report"
 }
 ]
 },
 "data": {
 "people": [
 {
 "@type": "borrower",
 "@id": "01FDF04MYHEZ98AD7T8ZGY5CMB",
 "has_first_name": {
 "has_value": "John"
 },
 "has_last_name": {
 "has_value": "Deere"
 },
 "has_birth_date": {
 "has_value": "1985-01-01"
 },
 "has_taxpayer_identifier_value": {
 "has_value": "999-00-0000"
 },
 "contact_at": [
 "01FDF09BNQCT03DCAX7M5KM52T"
 ],
 "employed_as": [
 "01FDF0DFYAHBRJGFA5RS26HVP1"
 ]
 }
 ],
 "addresses": [
 {
 "@id": "01FDF077N6V7R2RNC64DGT31DY",
 "@type": "business_address",
 "has_address_line_1_text": {
 "has_value": "33 IRVING PLACE",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_address_line_2_text": {
 "has_value": "additional_line_text",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_city_name": {
 "has_value": "NEW YORK",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_postal_code": {
 "has_value": "10003",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_country_name": {
 "has_value": "US",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 }
 }
 ],
 "contact_information": [
 {
 "@type": "contact_information",
 "@id": "01FDF09BNQCT03DCAX7M5KM52T",
 "has_phone_number": {
 "has_value": "+1234567890"
 }
 }
 ],
 "employment": [
 {
 "@type": "employment",
 "@id": "01FDF0DFYAHBRJGFA5RS26HVP1",
 "has_employment_position_description": {
 "has_value": "Engineer",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "provided_by": [
 "01FDF0G4BP9AE6B7FT5VDEWK5F"
 ]
 }
 ],
 "organizations": [
 {
 "@type": "organization",
 "@id": "01FDF0G4BP9AE6B7FT5VDEWK5F",
 "has_organization_name": {
 "has_value": "GRAIN PROCESSING COR",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "with_address": [
 "01FDF077N6V7R2RNC64DGT31DY"
 ]
 }
 ],
 "mortgage_products": [
 {
 "@type": "employment",
 "@id": "01FDF10040SA2VTETKJQXJ3MQZ",
 "has_data_source_date": {
 "has_value": "1972-01-01"
 },
 "has_purpose_of_verification_description": {
 "has_value": "risk-assessment"
 }
 }
 ],
 "documents": [
 {
 "@type": "irs_w2",
 "@id": "01FS9VK2BVSBZYN0MMYQQ73KAZ",
 "has_document_description": {
 "has_value": "Employment Verification Report prepared by Staircase"
 },
 "has_document_mime_type": {
 "has_value": "application/pdf"
 },
 "has_document_name": {
 "has_value": "01FD9X8V5N804Y0CFWY7F72ZCD.pdf"
 }
 }
 ]
 }
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy 201 response

```
{
 "transaction_id": "01FJCADX5QEXEDVRWNXAK206MA",
 "collection_id": "01FJCAQW7EYJAA6FY05WRKRM3T",
 "metadata": {
 "version": 2
 },
 "data": {
 "people": [
 {
 "@type": "borrower",
 "@id": "01FDF04MYHEZ98AD7T8ZGY5CMB",
 "has_first_name": {
 "has_value": "John"
 },
 "has_last_name": {
 "has_value": "Deere"
 },
 "has_birth_date": {
 "has_value": "01/01/1985"
 },
 "has_taxpayer_identifier_value": {
 "has_value": "999-00-0000"
 },
 "contact_at": [
 "01FDF09BNQCT03DCAX7M5KM52T"
 ],
 "employed_as": [
 "01FDF0DFYAHBRJGFA5RS26HVP1"
 ]
 }
 ],
 "addresses": [
 {
 "@id": "01FDF077N6V7R2RNC64DGT31DY",
 "@type": "business_address",
 "has_address_line_1_text": {
 "has_value": "33 IRVING PLACE",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_address_line_2_text": {
 "has_value": "additional_line_text",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_city_name": {
 "has_value": "NEW YORK",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_postal_code": {
 "has_value": "10003",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_country_name": {
 "has_value": "US",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 }
 }
 ],
 "contact_information": [
 {
 "@type": "contact_information",
 "@id": "01FDF09BNQCT03DCAX7M5KM52T",
 "has_phone_number": {
 "has_value": "+1234567890"
 }
 }
 ],
 "employment": [
 {
 "@type": "employment",
 "@id": "01FDF0DFYAHBRJGFA5RS26HVP1",
 "has_employment_position_description": {
 "has_value": "Engineer",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "provided_by": [
 "01FDF0G4BP9AE6B7FT5VDEWK5F"
 ]
 }
 ],
 "organizations": [
 {
 "@type": "organization",
 "@id": "01FDF0G4BP9AE6B7FT5VDEWK5F",
 "has_organization_name": {
 "has_value": "GRAIN PROCESSING COR",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_transaction_identifier": {
 "has_value": "e171ec31-75b4-4fd6-ada1",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "with_address": [
 "01FDF077N6V7R2RNC64DGT31DY"
 ]
 }
 ],
 "mortgage_products": [
 {
 "@type": "employment",
 "@id": "01FDF10040SA2VTETKJQXJ3MQZ",
 "has_data_source_date": {
 "has_value": "01/01/1972"
 },
 "has_purpose_of_verification_description": {
 "has_value": "risk-assessment"
 }
 }
 ],
 "documents": [
 {
 "@type": "irs_w2",
 "has_staircase_document_category_type": {
 "has_value": "staircase"
 },
 "has_document_description": {
 "has_value": "Employment Verification Report prepared by Staircase"
 },
 "has_document_mime_type": {
 "has_value": "application/pdf"
 },
 "has_document_name": {
 "has_value": "01FD9X8V5N804Y0CFWY7F72ZCD.pdf"
 }
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `data`required | `object` | <!--source:api-specifications-->Collection data<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Collection metadata. Maximum allowable length of the dumped json object - 400 000 symbols.<!--/source--> |
| `version` | `integer` | <!--source:api-specifications-->Version of staircase language with what collection has been created.<!--/source-->`0``2``3` |
| `validation` | `boolean` | <!--source:api-specifications-->Flag that enables validation<!--/source--> |
| `linked_collections` | `object[]` | <!--source:api-specifications-->List of linked collections<!--/source--> |
| `collection_id` | `string (ulid)` | <!--source:api-specifications-->Collection ID of linked collection<!--/source--> |
| `label` | `string` | <!--source:api-specifications-->Label of linked collection<!--/source--> |
| `serialise_to_graph` | `boolean` | <!--source:api-specifications-->Flag that enables collection serialization to persistence graph<!--/source--> |
| `fuzzy_searchable` | `boolean` | <!--source:api-specifications-->Flag that enables fuzzy search for collection<!--/source--> |

##### Response `201``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
201 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `collection_id` | `string (ulid)` | <!--source:api-specifications-->Collection id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `data` | `object` | <!--source:api-specifications-->Data in Staircase language schema<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata about collection, f.e version of used Staircase schema. Maximum allowable length of the dumped json object - 400 000 symbols.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`413`

`GET` `/transactions/{transaction_id}/collections/{collection_id}`

<!--source:api-specifications-->

#### Retrieve Collection
<!--/source-->

`get_collection`

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy 200 response

```
{
 "transaction_id": "01FJCADX5QEXEDVRWNXAK206MA",
 "collection_id": "01FJCAQW7EYJAA6FY05WRKRM3T",
 "metadata": {
 "version": 2
 },
 "data": {
 "people": [
 {
 "@type": "borrower",
 "@id": "01FDF04MYHEZ98AD7T8ZGY5CMB",
 "has_first_name": {
 "has_value": "John"
 },
 "has_last_name": {
 "has_value": "Deere"
 },
 "has_birth_date": {
 "has_value": "01/01/1985"
 },
 "has_taxpayer_identifier_value": {
 "has_value": "999-00-0000"
 },
 "contact_at": [
 "01FDF09BNQCT03DCAX7M5KM52T"
 ],
 "employed_as": [
 "01FDF0DFYAHBRJGFA5RS26HVP1"
 ]
 }
 ],
 "addresses": [
 {
 "@id": "01FDF077N6V7R2RNC64DGT31DY",
 "@type": "business_address",
 "has_address_line_1_text": {
 "has_value": "33 IRVING PLACE",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_address_line_2_text": {
 "has_value": "additional_line_text",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_city_name": {
 "has_value": "NEW YORK",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_postal_code": {
 "has_value": "10003",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_country_name": {
 "has_value": "US",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 }
 }
 ],
 "contact_information": [
 {
 "@type": "contact_information",
 "@id": "01FDF09BNQCT03DCAX7M5KM52T",
 "has_phone_number": {
 "has_value": "+1234567890"
 }
 }
 ],
 "employment": [
 {
 "@type": "employment",
 "@id": "01FDF0DFYAHBRJGFA5RS26HVP1",
 "has_employment_position_description": {
 "has_value": "Engineer",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "provided_by": [
 "01FDF0G4BP9AE6B7FT5VDEWK5F"
 ]
 }
 ],
 "organizations": [
 {
 "@type": "organization",
 "@id": "01FDF0G4BP9AE6B7FT5VDEWK5F",
 "has_organization_name": {
 "has_value": "GRAIN PROCESSING COR",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_transaction_identifier": {
 "has_value": "e171ec31-75b4-4fd6-ada1",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "with_address": [
 "01FDF077N6V7R2RNC64DGT31DY"
 ]
 }
 ],
 "mortgage_products": [
 {
 "@type": "employment",
 "@id": "01FDF10040SA2VTETKJQXJ3MQZ",
 "has_data_source_date": {
 "has_value": "01/01/1972"
 },
 "has_purpose_of_verification_description": {
 "has_value": "risk-assessment"
 }
 }
 ],
 "documents": [
 {
 "@type": "irs_w2",
 "has_staircase_document_category_type": {
 "has_value": "staircase"
 },
 "has_document_description": {
 "has_value": "Employment Verification Report prepared by Staircase"
 },
 "has_document_mime_type": {
 "has_value": "application/pdf"
 },
 "has_document_name": {
 "has_value": "01FD9X8V5N804Y0CFWY7F72ZCD.pdf"
 }
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
5
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `collection_id` required | `string (ulid)` path | `01FJCAQW7EYJAA6FY05WRKRM3T` | <!--source:api-specifications-->Collection ID<!--/source--> |
| `refs` | `boolean` query | `true` | <!--source:api-specifications-->If `true`, refs will not be resolved<!--/source--> |
| `flatten` | `boolean` query | `true` | <!--source:api-specifications-->If `true`, the collection will be flattened<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
200 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `collection_id` | `string (ulid)` | <!--source:api-specifications-->Collection id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `data` | `object` | <!--source:api-specifications-->Data in Staircase language schema<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata about collection, f.e version of used Staircase schema. Maximum allowable length of the dumped json object - 400 000 symbols.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422`

`POST` `/transactions/{transaction_id}/collections/{collection_id}/graph`

<!--source:api-specifications-->

#### Perform Graph Query on Collection Level
<!--/source-->

`collection_graph`

<!--source:api-specifications-->
Perform graph query on collection level
<!--/source-->

<!--source:api-specifications-->
This feature is experimental Collections created using v2 Staircase language represents data linked with `@id`, so it can be presented like graph F.e in collection below

```
{
 "metadata": {
 "version": 2
 },
 "data": {
 "addresses": [
 {
 "@id": "01F6N4YSSFY8EB5RAY0XNCQ7XD",
 "@type": "address",
 "has_address_line_1_text": {
 "has_value": "1234 MAIN STREET"
 },
 "has_address_line_2_text": {
 "has_value": "SUITE 30"
 },
 "has_city_name": {
 "has_value": "LOS ANGELES"
 },
 "has_full_address_text": {
 "has_value": "1234 Main St, Suite 30, Los Angeles, CA 90210"
 },
 "has_postal_code": {
 "has_value": "90210"
 },
 "has_state_code": {
 "has_value": "CA"
 }
 },
 {
 "@id": "01F6N4YSTP8PRC75SBT40JH0CM",
 "@type": "address",
 "has_address_line_1_text": {
 "has_value": "410 TERRY AVE. NORTH"
 },
 "has_address_line_2_text": {
 "has_value": ""
 },
 "has_city_name": {
 "has_value": "SEATTLE"
 },
 "has_full_address_text": {
 "has_value": "None"
 },
 "has_postal_code": {
 "has_value": "98109"
 },
 "has_state_code": {
 "has_value": "WA"
 }
 }
 ],
 "people": [
 {
 "@id": "01F6N4YSSNTBT17Q5BXDD7R19Q",
 "@type": "borrower",
 "earns": [
 "01F6N4YSTNWAVCPDK0GTA32B9Z"
 ],
 "has_first_name": {
 "has_value": "JOHN"
 },
 "has_full_name": {
 "has_value": "JOHN DOE"
 },
 "has_last_name": {
 "has_value": "DOE"
 },
 "has_social_security_number": {
 "has_value": "999-00-0000"
 },
 "with_address": [
 "01F6N4YSSFY8EB5RAY0XNCQ7XD"
 ],
 "works_for": [
 "01F6N4YSTM8EWPM80PFYJA15JP"
 ]
 }
 ]
 }
 }
```

As we can see, there is one borrower, and property `with_address` links us to address in LOS ANGELES. To query borrower information with his address info embed into it, we should construct shape query, where we will specify list of all properties, that we want to retrieve

Show the rest
```
{
 "people": {
 "has_first_name": {},
 "has_last_name": {},
 "with_address": {
 "has_address_line_1_text": {},
 "has_address_line_2_text": {},
 "has_city_name": {},
 "has_full_address_text": {},
 "has_postal_code": {},
 "has_state_code": {}
 }
 }
}
```

As a result we will have

```
{
 "people": [
 {
 "@id": "01F6N4YSSNTBT17Q5BXDD7R19Q",
 "@type": "borrower",
 "has_first_name": {
 "has_value": "JOHN"
 },
 "has_last_name": {
 "has_value": "DOE"
 },
 "with_address": [
 {
 "@id": "01F6N4YSSFY8EB5RAY0XNCQ7XD",
 "@type": "address",
 "has_address_line_1_text": {
 "has_value": "1234 MAIN STREET"
 },
 "has_address_line_2_text": {
 "has_value": "SUITE 30"
 },
 "has_city_name": {
 "has_value": "LOS ANGELES"
 },
 "has_full_address_text": {
 "has_value": "1234 Main St, Suite 30, Los Angeles, CA 90210"
 },
 "has_postal_code": {
 "has_value": "90210"
 },
 "has_state_code": {
 "has_value": "CA"
 }
 }
 ]
 }
 ]
}
```

So, for retrieving data you should specify the structure, that you want it to have, you will get only property, that you specified as keys and `{}` as a value. For referencable properties, there is no need to specify `has_value` property.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "people": {
 "has_first_name": {},
 "earns": {
 "has_federal_tax_withheld_amount": {},
 "has_dependent_care_benefits_amount": {}
 }
 }
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Resolved graph query

```
{
 "people": [
 {
 "@id": "01F6N4YSSNTBT17Q5BXDD7R19Q",
 "@type": "borrower",
 "earns": [
 {
 "@id": "01F6N4YSTNWAVCPDK0GTA32B9Z",
 "@type": "employment_income",
 "has_dependent_care_benefits_amount": {
 "has_value": "1000.00"
 },
 "has_federal_tax_withheld_amount": {
 "has_value": "6835.00"
 }
 }
 ],
 "has_first_name": {
 "has_value": "JOHN"
 }
 }
 ]
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `collection_id` required | `string (ulid)` path | `01FJCAQW7EYJAA6FY05WRKRM3T` | <!--source:api-specifications-->Collection ID<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`200`

`POST` `/transactions/{transaction_id}/collections/{collection_id}/query`

<!--source:api-specifications-->

#### Query on Collection Level
<!--/source-->

`query_collection`

<!--source:api-specifications-->
This endpoint provides query capabilities on collection level. You can write query in one of two formats:

- JSONPath
- JMESPath

You can write queries, that will follow links in your collection to get results. For example, we have this collection:

```
{
 "addresses": [
 {
 "@id": "01F6N4YSSFY8EB5RAY0XNCQ7XD",
 "@type": "mailing_address",
 "has_city_name": {
 "has_value": "LOS ANGELES"
 },
 "has_state_code": {
 "has_value": "CA"
 }
 },
 {
 "@id": "01FFFRTHRP2FPT481FVT1R1Z0Q",
 "@type": "mailing_address",
 "has_city_name": {
 "has_value": "SAN FRANCISCO"
 },
 "has_state_code": {
 "has_value": "CA"
 }
 },
 {
 "@id": "01F6N4YSTP8PRC75SBT40JH0CM",
 "@type": "residential_address",
 "has_city_name": {
 "has_value": "SEATTLE"
 },
 "has_state_code": {
 "has_value": "WA"
 }
 },
 {
 "@id": "01FFFR2XWQTBGNNXN68X32QS8Y",
 "@type": "mailing_address",
 "has_city_name": {
 "has_value": "NEW YORK"
 },
 "has_state_code": {
 "has_value": "CA"
 }
 }
 ],
 "people": [
 {
 "@id": "01F6N4YSSNTBT17Q5BXDD7R19Q",
 "@type": "borrower",
 "has_first_name": {
 "has_value": "JOHN"
 },
 "has_full_name": {
 "has_value": "JOHN DOE"
 },
 "has_last_name": {
 "has_value": "DOE"
 },
 "with_address": [
 "01F6N4YSSFY8EB5RAY0XNCQ7XD",
 "01F6N4YSTP8PRC75SBT40JH0CM",
 "01FFFR2XWQTBGNNXN68X32QS8Y"
 ]
 },
 {
 "@id": "01FFFQSWKY384GKNQFMET31HTX",
 "@type": "co_borrower",
 "has_first_name": {
 "has_value": "Rakhim"
 },
 "has_full_name": {
 "has_value": "Rakhim Sterling"
 },
 "has_last_name": {
 "has_value": "Sterling"
 },
 "with_address": [
 "01FFFQZ4BE5NRJDGP7FJ20XA0H"
 ]
 }
 ]
}
```

As you see here we have two people, one borrower and one co-borrower. Three addresses is associated to borrower, two mailing and one residential. One mailing address is associated to co-borrower. Let's build query to retrieve city name of borrower mailing address. To do this, we need to get people, where type equals borrower and addresses, where type equals mailing address. JSONPath query:

Show the rest
```
{
 "format": "jsonpath",
 "query": "$.people[?(@['@type'] = 'borrower')].with_address[?(@['@type'] = 'mailing_address')].has_city_name.has_value"
}
```

Result:

```
{
 "result": ["LOS ANGELES", "NEW YORK"]
}
```

Same query using JMESPath, but with grabing state code and reformatting output:

```
{
 "format": "jmespath",
 "query": "people[?\"@type\" == 'borrower'].with_address[] | [?\"@type\" == 'mailing_address'].{city: has_city_name.has_value, state_code: has_state_code.has_value}"
}
```

Result:

```
{
 "result": [
 {
 "city": "LOS ANGELES",
 "state_code": "CA"
 },
 {
 "city": "NEW YORK",
 "state_code": "CA"
 }
 ]
}
```

<!--/source-->

##### Request

<!--source:api-specifications-->
jsonpathjmespath
<!--/source-->

<!--source:api-specifications-->
application/json Copy JSONPath query

```
{
 "format": "jsonpath",
 "query": "$.people[?(@['@type'] = 'borrower')].with_address[?(@['@type'] = 'mailing_address')].has_city_name.has_value"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy JMESPath query

```
{
 "format": "jmespath",
 "query": "people[?\"@type\" == 'borrower'].with_address[] | [?\"@type\" == 'mailing_address'].{city: has_city_name.has_value, state_code: has_state_code.has_value}"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `collection_id` required | `string (ulid)` path | `01FJCAQW7EYJAA6FY05WRKRM3T` | <!--source:api-specifications-->Collection ID<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `format`required | `string` | <!--source:api-specifications-->Query format.<!--/source-->`jmespath``jsonpath` |
| `query`required | `string` | <!--source:api-specifications-->Query.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Query results.
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `result` | `one of` | <!--source:api-specifications-->Query results.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`GET` `/transactions/{transaction_id}/collections`

<!--source:api-specifications-->

#### Retrieve Transaction Collections
<!--/source-->

`get_collections`

<!--source:api-specifications-->
Retrieve Transaction Collections. If transaction was replaced by the new one, it will return collections from the new transaction. This behavior can be changed by providing `ignore_replacement` query parameter. Collections can be filtered by collection_id or created_at fields. Supported operations per fields:

- collection_id:
- in:
- description: Get only collections with specified ids
- example: collection_id+in+01EZQ32PJQGKRA6HR8D72Q9FFF,01EZQ32NZ34WACWSAF54WGEM51
- created_at:
- gt:
- description: Get collections that were created after specified datetime in ISO format
- example: created_at+gt+2021-03-30T04:27:15.372006-04:00
- lt:
- description: Get collections that were created before specified datetime in ISO format
- example: created_at+lt+2021-03-30T04:27:15.372006-04:00

<!--/source-->

##### Response

<!--source:api-specifications-->
400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
7
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `filter` | `string` query | `collection_id+in+01EZQ32PJQGKRA6HR8D72Q9FFF,01EZQ32NZ34WACWSAF54WGEM51` | <!--source:api-specifications-->Filter expression in format {field_name}+{operation}+{value}<!--/source--> |
| `ignore_replacement` | `boolean` query | `true` | <!--source:api-specifications-->Ignores replacement for the transaction.<!--/source--> |
| `sort` | `string` query | `asc` | <!--source:api-specifications-->Order of sorting<!--/source--> |
| `limit` | `number` query | `5` | <!--source:api-specifications-->Amount of items to show<!--/source--> |
| `after_id` | `string` query | `01EZQ32PJQGKRA6HR8D72Q9FFF` | <!--source:api-specifications-->id of last evaluated collection<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
200 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `collection_id` | `string (ulid)` | <!--source:api-specifications-->Collection id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `data` | `object` | <!--source:api-specifications-->Data in Staircase language schema<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata about collection, f.e version of used Staircase schema. Maximum allowable length of the dumped json object - 400 000 symbols.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `422``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Unprocessable Entity
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `collections` | `object[]` | <!--source:api-specifications-->List of collections without 'data' field and with links to retrieve single collections.<!--/source--> |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source--> |
| `collection_id` | `string (ulid)` | <!--source:api-specifications-->Collection id<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata about collection, f.e version of used Staircase schema Maximum allowable length of the dumped json object - 400 000 symbols.<!--/source--> |
| `_links` | `object` | <!--source:api-specifications-->Links<!--/source--> |
| `collection` | `string (url)` | <!--source:api-specifications-->Link to retrieve full collection.<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`PUT` `/transactions/{transaction_id}/collections/{collection_id}`

<!--source:api-specifications-->

#### Update Collection
<!--/source-->

`update_collection`

<!--source:api-specifications-->
Update Collection. Collection data can not be updated, but it can be inserted, if previously it was an empty object.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "data": {
 "deal_sets": [
 {
 "assets": [
 {
 "account_identifier": "1523421245",
 "cash_or_market_value": 45000,
 "holder_name": "BankA",
 "type": "SavingsAccount"
 }
 ],
 "collaterals": [
 {
 "address": {
 "city": "Winston Salem",
 "line_text": "1234 Main St",
 "postal_code": "27104",
 "state_code": "NC"
 },
 "property_detail": {
 "attachment_type": "Detached",
 "construction_method_type": "SiteBuilt",
 "estate_type": "FeeSimple",
 "estimated_value": 225000,
 "financed_unit_count": 1,
 "is_existing_clean_energy_lien": false,
 "is_in_project": false,
 "is_mixed_usage": false,
 "is_pud": false,
 "usage_type": "PrimaryResidence"
 },
 "property_valuations": {
 "property_valuation": [
 {
 "property_valuation_detail": {
 "amount": 225000,
 "appraisal_identifier": "1100AA1111"
 }
 }
 ]
 },
 "sales_contracts": {
 "sales_contract": [
 {
 "sales_contract_detail": {
 "amount": 225000
 }
 }
 ]
 }
 }
 ],
 "expenses": [
 {
 "EXTENSION": "<EXTENSION xmlns:lpa=\"http://www.datamodelextension.org/Schema/LPA\" xmlns=\"http://www.mismo.org/residential/2009/schemas\" xmlns:lparqst=\"http://www.freddiemac.com/lpa/LPALoanAssessmentService/schemas\" xmlns:ulad=\"http://www.datamodelextension.org/Schema/ULAD\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><OTHER><EXPENSE_EXTENSION><ExpenseExclusionIndicator>false</ExpenseExclusionIndicator></EXPENSE_EXTENSION></OTHER></EXTENSION>",
 "monthly_payment": 127,
 "type": "JobRelatedExpenses"
 }
 ],
 "liabilities": [
 {
 "account_identifier": "913432",
 "holder_name": "Toyota Credit",
 "is_exclusion": false,
 "is_payoff_status": false,
 "monthly_payment": 500,
 "type": "Installment",
 "unpaid_balance": 15838
 }
 ],
 "loans": [
 {
 "amortization": {
 "loan_period_count": 360,
 "loan_period_type": "Month",
 "type": "Fixed"
 },
 "application_received_date": "2019-03-21",
 "cash_out_determination_type": null,
 "document_specific_data_sets": [
 {
 "EXTENSION": "<EXTENSION xmlns:lpa=\"http://www.datamodelextension.org/Schema/LPA\" xmlns=\"http://www.mismo.org/residential/2009/schemas\" xmlns:lparqst=\"http://www.freddiemac.com/lpa/LPALoanAssessmentService/schemas\" xmlns:ulad=\"http://www.datamodelextension.org/Schema/ULAD\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><OTHER><URLA_TOTAL_EXTENSION><URLATotalSellerCreditsAmount>2250</URLATotalSellerCreditsAmount></URLA_TOTAL_EXTENSION></OTHER></EXTENSION>",
 "estimated_closing_costs": 6750,
 "mi_and_funding_fee_financed": 0,
 "prepaid_items_estimated": 2300
 }
 ],
 "housing_expenses": [
 {
 "payment": 506.69,
 "timing_type": "Proposed",
 "type": "FirstMortgagePrincipalAndInterest"
 },
 {
 "payment": 153,
 "timing_type": "Proposed",
 "type": "HomeownersInsurance"
 },
 {
 "payment": 188,
 "timing_type": "Proposed",
 "type": "RealEstateTax"
 },
 {
 "payment": 123,
 "timing_type": "Proposed",
 "type": "Other",
 "type_other": "WaterSewerAssessment"
 }
 ],
 "is_balloon": false,
 "is_buydown_temporary_subsidy_funding": false,
 "is_construction": false,
 "is_interest_only": false,
 "is_prepayment_penalty": false,
 "loan_identifiers": [
 {
 "identifier": "1122334455",
 "type": "LenderLoan"
 },
 {
 "identifier": "111198756421356000",
 "type": "MERS_MIN"
 },
 {
 "identifier": "1234567890",
 "type": "UniversalLoan"
 }
 ],
 "loan_product": {
 "description": "30YrFixed",
 "discount_points_total": 2100
 },
 "loan_statuses": [
 {
 "identifier": "Underwriting"
 }
 ],
 "origination_systems": [
 {
 "loan_vendor_identifier": "000000",
 "loan_version_identifier": "2.7"
 }
 ],
 "projected_reserves": 100000,
 "purchase_credits": [
 {
 "amount": 1000,
 "source_type": "BorrowerPaidOutsideClosing",
 "type": "EarnestMoney"
 },
 {
 "amount": 750,
 "source_type": "Lender",
 "type": "Other",
 "type_other": "ClosingCosts"
 }
 ],
 "qualifying_rate_percent": null,
 "terms_of_loan": {
 "base": 100000,
 "lien_priority_type": "FirstLien",
 "mortgage_type": "Conventional",
 "note_rate_percent": 4.5,
 "purpose_type": "Purchase"
 }
 }
 ]
 }
 ]
 }
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy 200 response

```
{
 "transaction_id": "dfa22839-8ecd-40c0-9bcb-b70f78002cdb",
 "collection_id": "104592a7-fcbe-4fa3-92e9-90e2b648a0a4",
 "metadata": {},
 "data": {
 "deal_sets": [
 {
 "assets": [
 {
 "account_identifier": "1523421245",
 "cash_or_market_value": 45000,
 "holder_name": "BankA",
 "type": "SavingsAccount"
 }
 ],
 "collaterals": [
 {
 "address": {
 "city": "Winston Salem",
 "line_text": "1234 Main St",
 "postal_code": "27104",
 "state_code": "NC"
 },
 "property_detail": {
 "attachment_type": "Detached",
 "construction_method_type": "SiteBuilt",
 "estate_type": "FeeSimple",
 "estimated_value": 225000,
 "financed_unit_count": 1,
 "is_existing_clean_energy_lien": false,
 "is_in_project": false,
 "is_mixed_usage": false,
 "is_pud": false,
 "usage_type": "PrimaryResidence"
 },
 "property_valuations": {
 "property_valuation": [
 {
 "property_valuation_detail": {
 "amount": 225000,
 "appraisal_identifier": "1100AA1111"
 }
 }
 ]
 },
 "sales_contracts": {
 "sales_contract": [
 {
 "sales_contract_detail": {
 "amount": 225000
 }
 }
 ]
 }
 }
 ],
 "expenses": [
 {
 "EXTENSION": "<EXTENSION xmlns:lpa=\"http://www.datamodelextension.org/Schema/LPA\" xmlns=\"http://www.mismo.org/residential/2009/schemas\" xmlns:lparqst=\"http://www.freddiemac.com/lpa/LPALoanAssessmentService/schemas\" xmlns:ulad=\"http://www.datamodelextension.org/Schema/ULAD\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><OTHER><EXPENSE_EXTENSION><ExpenseExclusionIndicator>false</ExpenseExclusionIndicator></EXPENSE_EXTENSION></OTHER></EXTENSION>",
 "monthly_payment": 127,
 "type": "JobRelatedExpenses"
 }
 ],
 "liabilities": [
 {
 "account_identifier": "913432",
 "holder_name": "Toyota Credit",
 "is_exclusion": false,
 "is_payoff_status": false,
 "monthly_payment": 500,
 "type": "Installment",
 "unpaid_balance": 15838
 }
 ],
 "loans": [
 {
 "amortization": {
 "loan_period_count": 360,
 "loan_period_type": "Month",
 "type": "Fixed"
 },
 "application_received_date": "2019-03-21",
 "cash_out_determination_type": null,
 "document_specific_data_sets": [
 {
 "EXTENSION": "<EXTENSION xmlns:lpa=\"http://www.datamodelextension.org/Schema/LPA\" xmlns=\"http://www.mismo.org/residential/2009/schemas\" xmlns:lparqst=\"http://www.freddiemac.com/lpa/LPALoanAssessmentService/schemas\" xmlns:ulad=\"http://www.datamodelextension.org/Schema/ULAD\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><OTHER><URLA_TOTAL_EXTENSION><URLATotalSellerCreditsAmount>2250</URLATotalSellerCreditsAmount></URLA_TOTAL_EXTENSION></OTHER></EXTENSION>",
 "estimated_closing_costs": 6750,
 "mi_and_funding_fee_financed": 0,
 "prepaid_items_estimated": 2300
 }
 ],
 "housing_expenses": [
 {
 "payment": 506.69,
 "timing_type": "Proposed",
 "type": "FirstMortgagePrincipalAndInterest"
 },
 {
 "payment": 153,
 "timing_type": "Proposed",
 "type": "HomeownersInsurance"
 },
 {
 "payment": 188,
 "timing_type": "Proposed",
 "type": "RealEstateTax"
 },
 {
 "payment": 123,
 "timing_type": "Proposed",
 "type": "Other",
 "type_other": "WaterSewerAssessment"
 }
 ],
 "is_balloon": false,
 "is_buydown_temporary_subsidy_funding": false,
 "is_construction": false,
 "is_interest_only": false,
 "is_prepayment_penalty": false,
 "loan_identifiers": [
 {
 "identifier": "1122334455",
 "type": "LenderLoan"
 },
 {
 "identifier": "111198756421356000",
 "type": "MERS_MIN"
 },
 {
 "identifier": "1234567890",
 "type": "UniversalLoan"
 }
 ],
 "loan_product": {
 "description": "30YrFixed",
 "discount_points_total": 2100
 },
 "loan_statuses": [
 {
 "identifier": "Underwriting"
 }
 ],
 "origination_systems": [
 {
 "loan_vendor_identifier": "000000",
 "loan_version_identifier": "2.7"
 }
 ],
 "projected_reserves": 100000,
 "purchase_credits": [
 {
 "amount": 1000,
 "source_type": "BorrowerPaidOutsideClosing",
 "type": "EarnestMoney"
 },
 {
 "amount": 750,
 "source_type": "Lender",
 "type": "Other",
 "type_other": "ClosingCosts"
 }
 ],
 "qualifying_rate_percent": null,
 "terms_of_loan": {
 "base": 100000,
 "lien_priority_type": "FirstLien",
 "mortgage_type": "Conventional",
 "note_rate_percent": 4.5,
 "purpose_type": "Purchase"
 }
 }
 ]
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `collection_id` required | `string (ulid)` path | `01FJCAQW7EYJAA6FY05WRKRM3T` | <!--source:api-specifications-->Collection ID<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `data`required | `object` | <!--source:api-specifications-->Data for updating<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata for updating. Maximum allowable length of the dumped json object - 400 000 symbols.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
200 response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `collection_id` | `string (ulid)` | <!--source:api-specifications-->Collection id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `data` | `object` | <!--source:api-specifications-->Data in Staircase language schema<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata about collection, f.e version of used Staircase schema. Maximum allowable length of the dumped json object - 400 000 symbols.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`413``422`

`POST` `/models/convert`

<!--source:api-specifications-->

#### Convert Nested Model
<!--/source-->

`convert_nested_model`

<!--source:api-specifications-->
Convert nested models into flat Staircase collections
<!--/source-->

<!--source:api-specifications-->
This endpoint allows you to convert data structures with nested elements into a more manageable, flat format. It requires `data` field in it's body, and will flatten data according to V3 Lexicon

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "data": {
 "liabilities": [
 {
 "@type": "liability",
 "liability_account_identifier": "12340002",
 "has_liability_timeline": {
 "@type": "liability_timeline",
 "liability_unpaid_balance_amount": 2000
 }
 }
 ]
 }
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy New flattened data

```
{
 "data": {
 "liabilities": [
 {
 "@id": "01HHEEBDS82E4FXB7XKB2EFN54",
 "@type": "liability",
 "has_liability_timeline": "01HHKJY1QNZ5MFPEAHS4KSRNCW",
 "liability_account_identifier": "12340002"
 }
 ],
 "liability_timelines": [
 {
 "@id": "01HHKJY1QNZ5MFPEAHS4KSRNCW",
 "@type": "liability_timeline",
 "liability_unpaid_balance_amount": 2000
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `data` | `object` | <!--source:api-specifications-->Data<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
New flattened data
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `data` | `object` | <!--source:api-specifications-->Data<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

`PATCH` `/transactions/{transaction_id}/collections/{collection_id}`

<!--source:api-specifications-->

#### Patch Collection
<!--/source-->

`patch_collection`

<!--source:api-specifications-->
Patch collection
<!--/source-->

<!--source:api-specifications-->
This endpoint provides ability to patch collection. Collections are immutable, so as a result you will have new collection created for you with applied changes.

#### Operations

##### Remove

This operation gives you the ability to remove elements and/or properties from your collection along with its relationships. You can explicitly specify the element ID you want to remove or apply the query. Read more about queries by the link. You can also specify depth for graph traversing and relationships, you don't want to remove. For examples, we use this collection

Show the rest
```
{
 "metadata": {
 "version": 2
 },
 "data": {
 "addresses": [
 {
 "@id": "01F6N4YSSFY8EB5RAY0XNCQ7XD",
 "@type": "address",
 "has_address_line_1_text": {
 "has_value": "1234 MAIN STREET"
 },
 "has_address_line_2_text": {
 "has_value": "SUITE 30"
 },
 "has_city_name": {
 "has_value": "LOS ANGELES"
 },
 "has_full_address_text": {
 "has_value": "1234 Main St, Suite 30, Los Angeles, CA 90210"
 },
 "has_postal_code": {
 "has_value": "90210"
 },
 "has_state_code": {
 "has_value": "CA"
 }
 },
 {
 "@id": "01F6N4YSTP8PRC75SBT40JH0CM",
 "@type": "address",
 "has_address_line_1_text": {
 "has_value": "410 TERRY AVE. NORTH"
 },
 "has_address_line_2_text": {
 "has_value": ""
 },
 "has_city_name": {
 "has_value": "SEATTLE"
 },
 "has_full_address_text": {
 "has_value": "None"
 },
 "has_postal_code": {
 "has_value": "98109"
 },
 "has_state_code": {
 "has_value": "WA"
 }
 }
 ],
 "documents": [
 {
 "@id": "01F6N4YSRAQVA8FA1F5MKBYR55",
 "@type": "irs_w2",
 "has_data_owner_document_identifer": {
 "has_value": "None"
 },
 "has_document_data_extraction_confidence_score": {
 "has_value": 72.453
 },
 "has_document_identifier": {
 "has_value": "z354-43431"
 },
 "has_instance_identifier": {
 "has_value": "z354-43431"
 }
 }
 ],
 "employment": [
 {
 "@id": "01F6N4YSXSGAGJ0BKKMB7606V0",
 "@type": "employment",
 "has_retirement_plan_participant_indicator": {
 "has_value": "true"
 },
 "has_statutory_employee_indicator": {
 "has_value": "false"
 }
 }
 ],
 "income": [
 {
 "@id": "01F6N4YSTNWAVCPDK0GTA32B9Z",
 "@type": "employment_income",
 "earned_from": [
 "01F6N4YSXSGAGJ0BKKMB7606V0"
 ],
 "has_allocated_tips_amount": {
 "has_value": ""
 },
 "has_dependent_care_benefits_amount": {
 "has_value": "1000.00"
 },
 "has_federal_tax_withheld_amount": {
 "has_value": "6835.00"
 },
 "has_gross_income_amount": {
 "data_sourced_from": [
 "01F6N4YSRAQVA8FA1F5MKBYR55"
 ],
 "has_data_extraction_confidence_score": 32.38,
 "has_value": "48500.00"
 },
 "has_income_paid_by_third_parties_indicator": {
 "has_value": "false"
 },
 "has_local_1_income_amount": {
 "has_value": "50000.00"
 },
 "has_local_1_tax_withheld_amount": {
 "has_value": "750.00"
 },
 "has_local_2_income_amount": {
 "has_value": ""
 },
 "has_local_2_tax_withheld_amount": {
 "has_value": ""
 },
 "has_locality_1_name": {
 "has_value": "MU"
 },
 "has_locality_2_name": {
 "has_value": ""
 },
 "has_medicare_income_amount": {
 "has_value": "50000.00"
 },
 "has_medicare_tax_withheld_amount": {
 "has_value": "725.00"
 },
 "has_nonqualified_retirement_plan_distribution_amount": {
 "has_value": ""
 },
 "has_social_security_income_amount": {
 "has_value": "50000.00"
 },
 "has_social_security_tax_withheld_amount": {
 "has_value": "3100.00"
 },
 "has_social_security_tips_amount": {
 "has_value": "600.00"
 },
 "has_state_1_income_amount": {
 "data_owned_by": [
 "01F6N4YSTM8EWPM80PFYJA15JP"
 ],
 "data_sourced_from": [
 "01F6N4YSRAQVA8FA1F5MKBYR55"
 ],
 "has_data_extraction_confidence_score": 76.68,
 "has_value": "50000.00"
 },
 "has_state_1_tax_withheld_amount": {
 "has_value": "1535.00"
 },
 "has_state_2_income_amount": {
 "has_value": ""
 },
 "has_state_2_tax_withheld_amount": {
 "has_value": ""
 }
 }
 ],
 "mortgage_products": [
 {
 "@id": "01F6N4YSXSN7Y010QW2AG4M70W",
 "@type": "data_extraction",
 "product_used_for": [
 "01F6N4YSRAQVA8FA1F5MKBYR55"
 ]
 }
 ],
 "organizations": [
 {
 "@id": "01F6N4YSTM8EWPM80PFYJA15JP",
 "@type": "organization",
 "has_organization_identifier": "23-5247235",
 "has_organization_name": {
 "has_value": "AMAZON , INC."
 },
 "with_address": [
 "01F6N4YSTP8PRC75SBT40JH0CM"
 ]
 }
 ],
 "people": [
 {
 "@id": "01F6N4YSSNTBT17Q5BXDD7R19Q",
 "@type": "borrower",
 "earns": [
 "01F6N4YSTNWAVCPDK0GTA32B9Z"
 ],
 "has_first_name": {
 "has_value": "JOHN"
 },
 "has_full_name": {
 "has_value": "JOHN DOE"
 },
 "has_last_name": {
 "has_value": "DOE"
 },
 "has_social_security_number": {
 "has_value": "999-00-0000"
 },
 "with_address": [
 "01F6N4YSSFY8EB5RAY0XNCQ7XD"
 ],
 "works_for": [
 "01F6N4YSTM8EWPM80PFYJA15JP"
 ]
 }
 ]
 }
}
```

###### Remove element by `@id`

To remove element and all connected elements we just need to specify `@id` of it. Let's remove the only organization we have in our collection.

```
{
 "element_id": "01F6N4YSTM8EWPM80PFYJA15JP",
 "op": "remove"
}
```

As a result we have collection without organization and its address

```
{
 "metadata": {
 "version": 2
 },
 "data": {
 "addresses": [
 {
 "@id": "01F6N4YSSFY8EB5RAY0XNCQ7XD",
 "@type": "address",
 "has_address_line_1_text": {
 "has_value": "1234 MAIN STREET"
 },
 "has_address_line_2_text": {
 "has_value": "SUITE 30"
 },
 "has_city_name": {
 "has_value": "LOS ANGELES"
 },
 "has_full_address_text": {
 "has_value": "1234 Main St, Suite 30, Los Angeles, CA 90210"
 },
 "has_postal_code": {
 "has_value": "90210"
 },
 "has_state_code": {
 "has_value": "CA"
 }
 }
 ],
 "documents": [
 {
 "@id": "01F6N4YSRAQVA8FA1F5MKBYR55",
 "@type": "irs_w2",
 "has_data_owner_document_identifer": {
 "has_value": "None"
 },
 "has_document_data_extraction_confidence_score": {
 "has_value": 72.453
 },
 "has_document_identifier": {
 "has_value": "z354-43431"
 },
 "has_instance_identifier": {
 "has_value": "z354-43431"
 }
 }
 ],
 "employment": [
 {
 "@id": "01F6N4YSXSGAGJ0BKKMB7606V0",
 "@type": "employment",
 "has_retirement_plan_participant_indicator": {
 "has_value": "true"
 },
 "has_statutory_employee_indicator": {
 "has_value": "false"
 }
 }
 ],
 "income": [
 {
 "@id": "01F6N4YSTNWAVCPDK0GTA32B9Z",
 "@type": "employment_income",
 "earned_from": [
 "01F6N4YSXSGAGJ0BKKMB7606V0"
 ],
 "has_allocated_tips_amount": {
 "has_value": ""
 },
 "has_dependent_care_benefits_amount": {
 "has_value": "1000.00"
 },
 "has_federal_tax_withheld_amount": {
 "has_value": "6835.00"
 },
 "has_gross_income_amount": {
 "data_sourced_from": [
 "01F6N4YSRAQVA8FA1F5MKBYR55"
 ],
 "has_data_extraction_confidence_score": 32.38,
 "has_value": "48500.00"
 },
 "has_income_paid_by_third_parties_indicator": {
 "has_value": "false"
 },
 "has_local_1_income_amount": {
 "has_value": "50000.00"
 },
 "has_local_1_tax_withheld_amount": {
 "has_value": "750.00"
 },
 "has_local_2_income_amount": {
 "has_value": ""
 },
 "has_local_2_tax_withheld_amount": {
 "has_value": ""
 },
 "has_locality_1_name": {
 "has_value": "MU"
 },
 "has_locality_2_name": {
 "has_value": ""
 },
 "has_medicare_income_amount": {
 "has_value": "50000.00"
 },
 "has_medicare_tax_withheld_amount": {
 "has_value": "725.00"
 },
 "has_nonqualified_retirement_plan_distribution_amount": {
 "has_value": ""
 },
 "has_social_security_income_amount": {
 "has_value": "50000.00"
 },
 "has_social_security_tax_withheld_amount": {
 "has_value": "3100.00"
 },
 "has_social_security_tips_amount": {
 "has_value": "600.00"
 },
 "has_state_1_income_amount": {
 "data_sourced_from": [
 "01F6N4YSRAQVA8FA1F5MKBYR55"
 ],
 "has_data_extraction_confidence_score": 76.68,
 "has_value": "50000.00"
 },
 "has_state_1_tax_withheld_amount": {
 "has_value": "1535.00"
 },
 "has_state_2_income_amount": {
 "has_value": ""
 },
 "has_state_2_tax_withheld_amount": {
 "has_value": ""
 }
 }
 ],
 "mortgage_products": [
 {
 "@id": "01F6N4YSXSN7Y010QW2AG4M70W",
 "@type": "data_extraction",
 "product_used_for": [
 "01F6N4YSRAQVA8FA1F5MKBYR55"
 ]
 }
 ],
 "people": [
 {
 "@id": "01F6N4YSSNTBT17Q5BXDD7R19Q",
 "@type": "borrower",
 "earns": [
 "01F6N4YSTNWAVCPDK0GTA32B9Z"
 ],
 "has_first_name": {
 "has_value": "JOHN"
 },
 "has_full_name": {
 "has_value": "JOHN DOE"
 },
 "has_last_name": {
 "has_value": "DOE"
 },
 "has_social_security_number": {
 "has_value": "999-00-0000"
 },
 "with_address": [
 "01F6N4YSSFY8EB5RAY0XNCQ7XD"
 ]
 }
 ]
 }
}
```

###### Use depth

Let's remove borrower, but keep all elements, connected with it in collection. To do it, we need to specify borrower ID and depth = 1.

```
{
 "op": "remove",
 "element_id": "01F6N4YSSNTBT17Q5BXDD7R19Q",
 "depth": 1
}
```

As a result we have same collection, just without borrower element

```
{
 "metadata": {
 "version": 2
 },
 "data": {
 "addresses": [
 {
 "@id": "01F6N4YSSFY8EB5RAY0XNCQ7XD",
 "@type": "address",
 "has_address_line_1_text": {
 "has_value": "1234 MAIN STREET"
 },
 "has_address_line_2_text": {
 "has_value": "SUITE 30"
 },
 "has_city_name": {
 "has_value": "LOS ANGELES"
 },
 "has_full_address_text": {
 "has_value": "1234 Main St, Suite 30, Los Angeles, CA 90210"
 },
 "has_postal_code": {
 "has_value": "90210"
 },
 "has_state_code": {
 "has_value": "CA"
 }
 },
 {
 "@id": "01F6N4YSTP8PRC75SBT40JH0CM",
 "@type": "address",
 "has_address_line_1_text": {
 "has_value": "410 TERRY AVE. NORTH"
 },
 "has_address_line_2_text": {
 "has_value": ""
 },
 "has_city_name": {
 "has_value": "SEATTLE"
 },
 "has_full_address_text": {
 "has_value": "None"
 },
 "has_postal_code": {
 "has_value": "98109"
 },
 "has_state_code": {
 "has_value": "WA"
 }
 }
 ],
 "documents": [
 {
 "@id": "01F6N4YSRAQVA8FA1F5MKBYR55",
 "@type": "irs_w2",
 "has_data_owner_document_identifer": {
 "has_value": "None"
 },
 "has_document_data_extraction_confidence_score": {
 "has_value": 72.453
 },
 "has_document_identifier": {
 "has_value": "z354-43431"
 },
 "has_instance_identifier": {
 "has_value": "z354-43431"
 }
 }
 ],
 "employment": [
 {
 "@id": "01F6N4YSXSGAGJ0BKKMB7606V0",
 "@type": "employment",
 "has_retirement_plan_participant_indicator": {
 "has_value": "true"
 },
 "has_statutory_employee_indicator": {
 "has_value": "false"
 }
 }
 ],
 "income": [
 {
 "@id": "01F6N4YSTNWAVCPDK0GTA32B9Z",
 "@type": "employment_income",
 "earned_from": [
 "01F6N4YSXSGAGJ0BKKMB7606V0"
 ],
 "has_allocated_tips_amount": {
 "has_value": ""
 },
 "has_dependent_care_benefits_amount": {
 "has_value": "1000.00"
 },
 "has_federal_tax_withheld_amount": {
 "has_value": "6835.00"
 },
 "has_gross_income_amount": {
 "data_sourced_from": [
 "01F6N4YSRAQVA8FA1F5MKBYR55"
 ],
 "has_data_extraction_confidence_score": 32.38,
 "has_value": "48500.00"
 },
 "has_income_paid_by_third_parties_indicator": {
 "has_value": "false"
 },
 "has_local_1_income_amount": {
 "has_value": "50000.00"
 },
 "has_local_1_tax_withheld_amount": {
 "has_value": "750.00"
 },
 "has_local_2_income_amount": {
 "has_value": ""
 },
 "has_local_2_tax_withheld_amount": {
 "has_value": ""
 },
 "has_locality_1_name": {
 "has_value": "MU"
 },
 "has_locality_2_name": {
 "has_value": ""
 },
 "has_medicare_income_amount": {
 "has_value": "50000.00"
 },
 "has_medicare_tax_withheld_amount": {
 "has_value": "725.00"
 },
 "has_nonqualified_retirement_plan_distribution_amount": {
 "has_value": ""
 },
 "has_social_security_income_amount": {
 "has_value": "50000.00"
 },
 "has_social_security_tax_withheld_amount": {
 "has_value": "3100.00"
 },
 "has_social_security_tips_amount": {
 "has_value": "600.00"
 },
 "has_state_1_income_amount": {
 "data_sourced_from": [
 "01F6N4YSRAQVA8FA1F5MKBYR55"
 ],
 "has_data_extraction_confidence_score": 76.68,
 "has_value": "50000.00"
 },
 "has_state_1_tax_withheld_amount": {
 "has_value": "1535.00"
 },
 "has_state_2_income_amount": {
 "has_value": ""
 },
 "has_state_2_tax_withheld_amount": {
 "has_value": ""
 }
 }
 ],
 "mortgage_products": [
 {
 "@id": "01F6N4YSXSN7Y010QW2AG4M70W",
 "@type": "data_extraction",
 "product_used_for": [
 "01F6N4YSRAQVA8FA1F5MKBYR55"
 ]
 }
 ],
 "organizations": [
 {
 "@id": "01F6N4YSTM8EWPM80PFYJA15JP",
 "@type": "organization",
 "has_organization_identifier": "23-5247235",
 "has_organization_name": {
 "has_value": "AMAZON , INC."
 },
 "with_address": [
 "01F6N4YSTP8PRC75SBT40JH0CM"
 ]
 }
 ]
 }
}
```

###### Exclude relationships

Let's remove borrower and everything connected, except his adress. To do this, we need to specify `with_address` relationship in `exclude_relationships` field

```
{
 "op": "remove",
 "element_id": "01F6N4YSSNTBT17Q5BXDD7R19Q",
 "exclude_relationships": [
 "with_address"
 ]
}
```

Output:

```
{
 "metadata": {
 "version": 2
 },
 "data": {
 "addresses": [
 {
 "@id": "01F6N4YSSFY8EB5RAY0XNCQ7XD",
 "@type": "address",
 "has_address_line_1_text": {
 "has_value": "1234 MAIN STREET"
 },
 "has_address_line_2_text": {
 "has_value": "SUITE 30"
 },
 "has_city_name": {
 "has_value": "LOS ANGELES"
 },
 "has_full_address_text": {
 "has_value": "1234 Main St, Suite 30, Los Angeles, CA 90210"
 },
 "has_postal_code": {
 "has_value": "90210"
 },
 "has_state_code": {
 "has_value": "CA"
 }
 },
 {
 "@id": "01F6N4YSTP8PRC75SBT40JH0CM",
 "@type": "address",
 "has_address_line_1_text": {
 "has_value": "410 TERRY AVE. NORTH"
 },
 "has_address_line_2_text": {
 "has_value": ""
 },
 "has_city_name": {
 "has_value": "SEATTLE"
 },
 "has_full_address_text": {
 "has_value": "None"
 },
 "has_postal_code": {
 "has_value": "98109"
 },
 "has_state_code": {
 "has_value": "WA"
 }
 }
 ],
 "documents": [
 {
 "@id": "01F6N4YSRAQVA8FA1F5MKBYR55",
 "@type": "irs_w2",
 "has_data_owner_document_identifer": {
 "has_value": "None"
 },
 "has_document_data_extraction_confidence_score": {
 "has_value": 72.453
 },
 "has_document_identifier": {
 "has_value": "z354-43431"
 },
 "has_instance_identifier": {
 "has_value": "z354-43431"
 }
 }
 ],
 "mortgage_products": [
 {
 "@id": "01F6N4YSXSN7Y010QW2AG4M70W",
 "@type": "data_extraction",
 "product_used_for": [
 "01F6N4YSRAQVA8FA1F5MKBYR55"
 ]
 }
 ]
 }
}
```

###### Query

All capabilities mentioned eariler can be used with query mechanism. Instead of `element_id` you just need to provide query in the same format as in Query on Collection Level endpoint. With qeury you can remove either elements or proeprties.

Elements example:

```
{
 "op": "remove",
 "query": {
 "format": "jmespath",
 "query": "people[?\"@type\" == 'borrower'].with_address[] | [?\"@type\" == 'mailing_address']"
 }
}
```

Properties example:

```
{
 "op": "remove",
 "query": {
 "format": "jsonpath",
 "query": "$.people[?(@['@type'] = 'borrower')].with_address[?(@['@type'] = 'mailing_address')].has_city_name"
 }
}
```

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy Simple request

```
{
 "element_id": "01F6N4YSTM8EWPM80PFYJA15JP",
 "op": "remove"
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy New collection

```
{
 "transaction_id": "01FJCADX5QEXEDVRWNXAK206MA",
 "collection_id": "01FJCAQW7EYJAA6FY05WRKRM3T",
 "metadata": {
 "version": 2
 },
 "data": {
 "people": [
 {
 "@type": "borrower",
 "@id": "01FDF04MYHEZ98AD7T8ZGY5CMB",
 "has_first_name": {
 "has_value": "John"
 },
 "has_last_name": {
 "has_value": "Deere"
 },
 "has_birth_date": {
 "has_value": "01/01/1985"
 },
 "has_taxpayer_identifier_value": {
 "has_value": "999-00-0000"
 },
 "contact_at": [
 "01FDF09BNQCT03DCAX7M5KM52T"
 ],
 "employed_as": [
 "01FDF0DFYAHBRJGFA5RS26HVP1"
 ]
 }
 ],
 "addresses": [
 {
 "@id": "01FDF077N6V7R2RNC64DGT31DY",
 "@type": "business_address",
 "has_address_line_1_text": {
 "has_value": "33 IRVING PLACE",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_address_line_2_text": {
 "has_value": "additional_line_text",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_city_name": {
 "has_value": "NEW YORK",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_postal_code": {
 "has_value": "10003",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_country_name": {
 "has_value": "US",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 }
 }
 ],
 "contact_information": [
 {
 "@type": "contact_information",
 "@id": "01FDF09BNQCT03DCAX7M5KM52T",
 "has_phone_number": {
 "has_value": "+1234567890"
 }
 }
 ],
 "employment": [
 {
 "@type": "employment",
 "@id": "01FDF0DFYAHBRJGFA5RS26HVP1",
 "has_employment_position_description": {
 "has_value": "Engineer",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "provided_by": [
 "01FDF0G4BP9AE6B7FT5VDEWK5F"
 ]
 }
 ],
 "organizations": [
 {
 "@type": "organization",
 "@id": "01FDF0G4BP9AE6B7FT5VDEWK5F",
 "has_organization_name": {
 "has_value": "GRAIN PROCESSING COR",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "has_transaction_identifier": {
 "has_value": "e171ec31-75b4-4fd6-ada1",
 "data_sourced_from": [
 "01FDF10040SA2VTETKJQXJ3MQZ"
 ]
 },
 "with_address": [
 "01FDF077N6V7R2RNC64DGT31DY"
 ]
 }
 ],
 "mortgage_products": [
 {
 "@type": "employment",
 "@id": "01FDF10040SA2VTETKJQXJ3MQZ",
 "has_data_source_date": {
 "has_value": "01/01/1972"
 },
 "has_purpose_of_verification_description": {
 "has_value": "risk-assessment"
 }
 }
 ],
 "documents": [
 {
 "@type": "irs_w2",
 "has_staircase_document_category_type": {
 "has_value": "staircase"
 },
 "has_document_description": {
 "has_value": "Employment Verification Report prepared by Staircase"
 },
 "has_document_mime_type": {
 "has_value": "application/pdf"
 },
 "has_document_name": {
 "has_value": "01FD9X8V5N804Y0CFWY7F72ZCD.pdf"
 }
 }
 ]
 }
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "message": "{'data': ['Missing data for required field.']}"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Collection not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
3
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `transaction_id` required | `string (ulid)` path | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Transaction ID<!--/source--> |
| `collection_id` required | `string (ulid)` path | `01FJCAQW7EYJAA6FY05WRKRM3T` | <!--source:api-specifications-->Collection ID<!--/source--> |
| `x-sc-trace-id` required | `string` header | `01FJCADX5QEXEDVRWNXAK206MA` | <!--source:api-specifications-->Trace ID of the transaction<!--/source--> |

##### Request body`application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `op` | `string` | <!--source:api-specifications-->Remove<!--/source-->`remove` |
| `element_id` | `string` | <!--source:api-specifications-->Element ID<!--/source--> |
| `exclude_relationships` | `string[]` | <!--source:api-specifications-->Relationships to exclude<!--/source--> |
| `query` | `object` | <!--source:api-specifications-->query<!--/source--> |
| `format` | `string` | <!--source:api-specifications-->Query format.<!--/source-->`jmespath``jsonpath` |
| `query` | `string` | <!--source:api-specifications-->Query.<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
4 fields
<!--/source-->
<!--source:api-specifications-->
New collection
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id` | `string (ulid)` | <!--source:api-specifications-->Transaction id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `collection_id` | `string (ulid)` | <!--source:api-specifications-->Collection id<!--/source-->Example `01EZQ32PJQGKRA6HR8D72Q9FFF` |
| `data` | `object` | <!--source:api-specifications-->Data in Staircase language schema<!--/source--> |
| `metadata` | `object` | <!--source:api-specifications-->Metadata about collection, f.e version of used Staircase schema. Maximum allowable length of the dumped json object - 400 000 symbols.<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `one of` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `429``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
The user has sent too many requests in a given amount of time ("rate limiting")
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

<!--source:api-specifications-->

### Triggers
<!--/source-->

`POST` `/triggers`

<!--source:api-specifications-->

#### Create Trigger
<!--/source-->

`create_trigger`

<!--source:api-specifications-->
Create trigger
<!--/source-->

<!--source:api-specifications-->
Create a trigger with specific condition as a JMESPath expression. The condition is evaluated on every create/update action with the collections. If the condition is true, the webhook is triggered. The webhook request is sent in Cloudevents format and request contains x-api-key header with the api key of the environment, with collection_id, transaction_id, trigger and transaction label in data. Trigger might be configured to work for validated collections only by setting `"valid_collections_only": true`. In this case, the trigger is triggered only if collection has `"validation": true` in the metadata.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
{
 "trigger_name": "example_trigger",
 "condition": "contains(locations[].name, 'Some name')",
 "webhook_url": "https://example.com/webhook",
 "transaction_label": "example_transaction",
 "valid_collections_only": true
}
```

<!--/source-->

##### Response

<!--source:api-specifications-->
201400409
<!--/source-->

<!--source:api-specifications-->
application/json Copy Trigger created

```
{
 "trigger_id": 52341234,
 "trigger_name": "example_trigger",
 "condition": "contains(locations[].name, 'Some name')",
 "webhook_url": "https://example.com/webhook",
 "transaction_label": "example_transaction",
 "valid_collections_only": true
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Conflict

```
{
 "message": "Trigger name 'x' already exists"
}
```

<!--/source-->

##### Request body`application/json`

<!--source:api-specifications-->
5 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `trigger_name`required | `string` | <!--source:api-specifications-->Name of the trigger<!--/source-->Example `name` |
| `condition`required | `string` | <!--source:api-specifications-->Condition as jmespath query that returns a boolean response<!--/source-->Example `contains(locations[].name, 'Some name')` |
| `webhook_url`required | `string (uri)` | <!--source:api-specifications-->Webhook URL<!--/source-->Example `https://webhook.site/5f9b1b1f-1b1f-5f9b-1b1f-5f9b1b1f5f9b` |
| `transaction_label` | `string` | <!--source:api-specifications-->Transaction label to filter transactions with label<!--/source-->Example `optional_label` |
| `valid_collections_only` | `boolean` | <!--source:api-specifications-->Flag defining if the trigger is triggered only for collections with `"validation": true` in the `metadata`.<!--/source-->Example `true` |

##### Response `201``application/json`

<!--source:api-specifications-->
6 fields
<!--/source-->
<!--source:api-specifications-->
Trigger created
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `trigger_name`required | `string` | <!--source:api-specifications-->Name of the trigger<!--/source-->Example `name` |
| `condition`required | `string` | <!--source:api-specifications-->Condition as jmespath query that returns a boolean response<!--/source-->Example `contains(locations[].name, 'Some name')` |
| `webhook_url`required | `string (uri)` | <!--source:api-specifications-->Webhook URL<!--/source-->Example `https://webhook.site/5f9b1b1f-1b1f-5f9b-1b1f-5f9b1b1f5f9b` |
| `transaction_label` | `string` | <!--source:api-specifications-->Transaction label to filter transactions with label<!--/source-->Example `optional_label` |
| `valid_collections_only` | `boolean` | <!--source:api-specifications-->Flag defining if the trigger is triggered only for collections with `"validation": true` in the `metadata`.<!--/source-->Example `true` |
| `trigger_id`required | `string` | <!--source:api-specifications-->ID of the trigger<!--/source-->Example `5f9b1b1f-1b1f-5f9b-1b1f-5f9b1b1f5f9b` |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `409``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Conflict
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

`DELETE` `/triggers/{trigger_id}`

<!--source:api-specifications-->

#### Delete Trigger
<!--/source-->

`delete_trigger`

<!--source:api-specifications-->
Delete trigger
<!--/source-->

##### Response

<!--source:api-specifications-->
400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Trigger not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `trigger_id` required | `string` path | `52341234-1234-1234-1234-123412341234` | <!--source:api-specifications-->Trigger ID<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`204``422``500`

`PATCH` `/triggers/{trigger_id}`

<!--source:api-specifications-->

#### Patch Trigger
<!--/source-->

`patch_trigger`

<!--source:api-specifications-->
Patch trigger
<!--/source-->

<!--source:api-specifications-->
Patch trigger with an JSON Patch format object. Remove operation limitations:

- Supported only for `transaction_label` field.

<!--/source-->

##### Request

<!--source:api-specifications-->
application/json Copy
```
[
 {
 "op": "replace",
 "path": "trigger_name",
 "value": "example_trigger"
 },
 {
 "op": "replace",
 "path": "condition",
 "value": "contains(locations[].name, 'Some name')"
 },
 {
 "op": "replace",
 "path": "webhook_url",
 "value": "https://example.com/webhook"
 },
 {
 "op": "remove",
 "path": "transaction_label"
 }
]
```

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Patched trigger object

```
{
 "trigger_id": 52341234,
 "trigger_name": "example_trigger",
 "condition": "contains(locations[].name, 'Some name')",
 "webhook_url": "https://example.com/webhook",
 "transaction_label": "example_transaction"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Trigger not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
1
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `trigger_id` required | `string` path | `52341234-1234-1234-1234-123412341234` | <!--source:api-specifications-->Trigger ID<!--/source--> |

##### Response `200``application/json`

<!--source:api-specifications-->
6 fields
<!--/source-->
<!--source:api-specifications-->
Patched trigger object
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `trigger_name`required | `string` | <!--source:api-specifications-->Name of the trigger<!--/source-->Example `name` |
| `condition`required | `string` | <!--source:api-specifications-->Condition as jmespath query that returns a boolean response<!--/source-->Example `contains(locations[].name, 'Some name')` |
| `webhook_url`required | `string (uri)` | <!--source:api-specifications-->Webhook URL<!--/source-->Example `https://webhook.site/5f9b1b1f-1b1f-5f9b-1b1f-5f9b1b1f5f9b` |
| `transaction_label` | `string` | <!--source:api-specifications-->Transaction label to filter transactions with label<!--/source-->Example `optional_label` |
| `valid_collections_only` | `boolean` | <!--source:api-specifications-->Flag defining if the trigger is triggered only for collections with `"validation": true` in the `metadata`.<!--/source-->Example `true` |
| `trigger_id`required | `string` | <!--source:api-specifications-->ID of the trigger<!--/source-->Example `5f9b1b1f-1b1f-5f9b-1b1f-5f9b1b1f5f9b` |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`422``500`

`GET` `/triggers`

<!--source:api-specifications-->

#### List Triggers
<!--/source-->

`list_triggers`

<!--source:api-specifications-->
List triggers
<!--/source-->

<!--source:api-specifications-->
List triggers and query specific filter with a trigger_id or trigger_name parameter in query string. Filtering with trigger_name return all triggers that match trigger_name, else an empty array. Querying with trigger_id returns Not Found if trigger with specific id does not exist.

<!--/source-->

##### Response

<!--source:api-specifications-->
200400404
<!--/source-->

<!--source:api-specifications-->
application/json Copy Triggers listed

```
[
 {
 "trigger_id": 52341234,
 "trigger_name": "example_trigger",
 "condition": "contains(locations[].name, 'Some name')",
 "webhook_url": "https://example.com/webhook",
 "transaction_label": "example_transaction"
 }
]
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Request data failed validation

```
{
 "detailedMessage": "Bad request exception"
}
```

<!--/source-->

<!--source:api-specifications-->
application/json Copy Requested resource not found

```
{
 "message": "Trigger not found"
}
```

<!--/source-->

##### Parameters

<!--source:api-specifications-->
2
<!--/source-->

| Parameter | Type | Example | Description |
| --- | --- | --- | --- |
| `trigger_id` | `string` query | `52341234-1234-1234-1234-123412341234` | <!--source:api-specifications-->Trigger id<!--/source--> |
| `trigger_name` | `string` query | `example_trigger` | <!--source:api-specifications-->Trigger name<!--/source--> |

##### Response `400``application/json`

<!--source:api-specifications-->
2 fields
<!--/source-->
<!--source:api-specifications-->
Request data failed validation
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `detailedMessage` | `string` | <!--source:api-specifications-->Message<!--/source--> |
| `code` | `string` | <!--source:api-specifications-->Code<!--/source--> |

##### Response `403``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Missing API key
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Response `404``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
Requested resource not found
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `message` | `string` | <!--source:api-specifications-->Message<!--/source--> |

##### Other responses

`200``422``500`

<!--source:api-specifications-->

### Operations
<!--/source-->

`GET` `/data-share/public-key`

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
OK Response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `public_key` | `string` | — |

`POST` `/data-share/share`

##### Request body`application/json`

<!--source:api-specifications-->
3 fields
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `transaction_id`required | `string` | — |
| `collection_id`required | `string` | — |
| `to_public_key`required | `string` | — |

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
OK response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `share_id` | `string` | — |

`GET` `/data-share/shared`

<!--source:api-specifications-->

#### List of colelctions, that was sahred with you
<!--/source-->

##### Response `200``application/json`

<!--source:api-specifications-->
1 fields
<!--/source-->
<!--source:api-specifications-->
OK response
<!--/source-->

| Field | Type | Description |
| --- | --- | --- |
| `collections` | `object[]` | — |
| `transaction_id` | `string` | — |
| `collection_id` | `string` | — |
| `share_id` | `string` | — |

## Errors

`400``403``404``406``409``413``422``429``500`

## More in Data

- Previous product: ML
- Next product: Rule
