Finalize a collection
curl --request POST \
--url https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/ \
--header 'Content-Type: application/json' \
--header 'X-Access-Client-Id: <api-key>' \
--header 'X-Access-Secret: <api-key>' \
--data '
{
"document_ids": [
"d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6",
"a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4"
],
"product_type": "income"
}
'import requests
url = "https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/"
payload = {
"document_ids": ["d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6", "a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4"],
"product_type": "income"
}
headers = {
"X-Access-Client-Id": "<api-key>",
"X-Access-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Access-Client-Id': '<api-key>',
'X-Access-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
document_ids: ['d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6', 'a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4'],
product_type: 'income'
})
};
fetch('https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'document_ids' => [
'd1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6',
'a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4'
],
'product_type' => 'income'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Access-Client-Id: <api-key>",
"X-Access-Secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/"
payload := strings.NewReader("{\n \"document_ids\": [\n \"d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6\",\n \"a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4\"\n ],\n \"product_type\": \"income\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Access-Client-Id", "<api-key>")
req.Header.Add("X-Access-Secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/")
.header("X-Access-Client-Id", "<api-key>")
.header("X-Access-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"document_ids\": [\n \"d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6\",\n \"a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4\"\n ],\n \"product_type\": \"income\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Access-Client-Id"] = '<api-key>'
request["X-Access-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document_ids\": [\n \"d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6\",\n \"a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4\"\n ],\n \"product_type\": \"income\"\n}"
response = http.request(request)
puts response.read_body{
"users": [
{
"id": "a1b2c3d4e5f6478899aabbccddeeff00",
"links": [
{
"link_id": "c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9",
"status": "done",
"documents": [
{
"id": "d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6",
"document_type": "PAYSTUB",
"document_subtype": null
}
]
}
],
"external_user_id": "ext_user_789"
}
]
}{
"error": {
"code": "incorrect_parameters",
"message": "Incorrect request parameters",
"extra": {
"invalid-params": [
{
"field": "access_token",
"message": "This field is required."
}
]
}
}
}{
"error": {
"code": "authentication_failed",
"message": "No such token"
}
}{
"error": {
"code": "not_authenticated",
"message": "Authentication credentials were not provided."
}
}{
"detail": "Not Found."
}Document Collections
Finalize a collection
The endpoint finalizes a document collection by creating or updating links for all matched documents and users. Optionally accepts a subset of document IDs to finalize. If no document_ids provided, all recognized documents in the collection will be finalized.
POST
/
v1
/
documents
/
collections
/
{collection_id}
/
finalize
/
Finalize a collection
curl --request POST \
--url https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/ \
--header 'Content-Type: application/json' \
--header 'X-Access-Client-Id: <api-key>' \
--header 'X-Access-Secret: <api-key>' \
--data '
{
"document_ids": [
"d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6",
"a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4"
],
"product_type": "income"
}
'import requests
url = "https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/"
payload = {
"document_ids": ["d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6", "a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4"],
"product_type": "income"
}
headers = {
"X-Access-Client-Id": "<api-key>",
"X-Access-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Access-Client-Id': '<api-key>',
'X-Access-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
document_ids: ['d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6', 'a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4'],
product_type: 'income'
})
};
fetch('https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'document_ids' => [
'd1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6',
'a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4'
],
'product_type' => 'income'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Access-Client-Id: <api-key>",
"X-Access-Secret: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/"
payload := strings.NewReader("{\n \"document_ids\": [\n \"d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6\",\n \"a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4\"\n ],\n \"product_type\": \"income\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Access-Client-Id", "<api-key>")
req.Header.Add("X-Access-Secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/")
.header("X-Access-Client-Id", "<api-key>")
.header("X-Access-Secret", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"document_ids\": [\n \"d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6\",\n \"a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4\"\n ],\n \"product_type\": \"income\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://prod.truv.com/v1/documents/collections/{collection_id}/finalize/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Access-Client-Id"] = '<api-key>'
request["X-Access-Secret"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document_ids\": [\n \"d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6\",\n \"a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4\"\n ],\n \"product_type\": \"income\"\n}"
response = http.request(request)
puts response.read_body{
"users": [
{
"id": "a1b2c3d4e5f6478899aabbccddeeff00",
"links": [
{
"link_id": "c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9",
"status": "done",
"documents": [
{
"id": "d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6",
"document_type": "PAYSTUB",
"document_subtype": null
}
]
}
],
"external_user_id": "ext_user_789"
}
]
}{
"error": {
"code": "incorrect_parameters",
"message": "Incorrect request parameters",
"extra": {
"invalid-params": [
{
"field": "access_token",
"message": "This field is required."
}
]
}
}
}{
"error": {
"code": "authentication_failed",
"message": "No such token"
}
}{
"error": {
"code": "not_authenticated",
"message": "Authentication credentials were not provided."
}
}{
"detail": "Not Found."
}Authorizations
Client ID
Client Access Key
Path Parameters
Collection ID
Body
application/json
Optional list of document IDs to finalize. If not provided, all recognized documents in the collection will be finalized.
Example:
[
"d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6",
"a9b8c7d6e5f4a3b2c1d0e9f8a7b6c5d4"
]
Product type for finalization. Defaults to 'income' if not provided.
Available options:
income, employment Example:
"income"
Response
List of users with their links and documents
Show child attributes
Show child attributes
Was this page helpful?
⌘I