Create a view
curl --request POST \
--url http://localhost:8000/v1/views \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Banking information for wire transfers",
"document_type": "capital_call",
"fields": [
"fund_name",
"bank_name",
"account_number",
"routing_number"
],
"is_default": false,
"name": "wire_details"
}
'import requests
url = "http://localhost:8000/v1/views"
payload = {
"description": "Banking information for wire transfers",
"document_type": "capital_call",
"fields": ["fund_name", "bank_name", "account_number", "routing_number"],
"is_default": False,
"name": "wire_details"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'Banking information for wire transfers',
document_type: 'capital_call',
fields: ['fund_name', 'bank_name', 'account_number', 'routing_number'],
is_default: false,
name: 'wire_details'
})
};
fetch('http://localhost:8000/v1/views', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/v1/views",
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([
'description' => 'Banking information for wire transfers',
'document_type' => 'capital_call',
'fields' => [
'fund_name',
'bank_name',
'account_number',
'routing_number'
],
'is_default' => false,
'name' => 'wire_details'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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 := "http://localhost:8000/v1/views"
payload := strings.NewReader("{\n \"description\": \"Banking information for wire transfers\",\n \"document_type\": \"capital_call\",\n \"fields\": [\n \"fund_name\",\n \"bank_name\",\n \"account_number\",\n \"routing_number\"\n ],\n \"is_default\": false,\n \"name\": \"wire_details\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("http://localhost:8000/v1/views")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Banking information for wire transfers\",\n \"document_type\": \"capital_call\",\n \"fields\": [\n \"fund_name\",\n \"bank_name\",\n \"account_number\",\n \"routing_number\"\n ],\n \"is_default\": false,\n \"name\": \"wire_details\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/v1/views")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Banking information for wire transfers\",\n \"document_type\": \"capital_call\",\n \"fields\": [\n \"fund_name\",\n \"bank_name\",\n \"account_number\",\n \"routing_number\"\n ],\n \"is_default\": false,\n \"name\": \"wire_details\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2024-01-15T10:30:00Z",
"description": "Fields needed for accounting workflow",
"document_type": "capital_call",
"fields": [
"fund_name",
"due_date",
"call_amount_lp",
"bank_name"
],
"is_default": true,
"name": "accounting",
"updated_at": "2024-01-15T10:30:00Z",
"view_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"available_fields": [
"fund_name",
"notice_date",
"due_date",
"call_amount_lp"
],
"error": "invalid_fields",
"invalid_fields": [
"foo_bar",
"xyz"
],
"message": "The following fields are not available for document type 'capital_call': foo_bar, xyz"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}views
Create a view
Create a new view for a document type.
Views define which fields are returned when querying document data. Fields must be valid for the specified document type’s schema.
If is_default is true, any existing default view for this document
type will be unset.
Returns: ViewResponse with created view details.
Raises: HTTPException 400: Invalid fields or duplicate name HTTPException 404: Document type not found
POST
/
v1
/
views
Create a view
curl --request POST \
--url http://localhost:8000/v1/views \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Banking information for wire transfers",
"document_type": "capital_call",
"fields": [
"fund_name",
"bank_name",
"account_number",
"routing_number"
],
"is_default": false,
"name": "wire_details"
}
'import requests
url = "http://localhost:8000/v1/views"
payload = {
"description": "Banking information for wire transfers",
"document_type": "capital_call",
"fields": ["fund_name", "bank_name", "account_number", "routing_number"],
"is_default": False,
"name": "wire_details"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'Banking information for wire transfers',
document_type: 'capital_call',
fields: ['fund_name', 'bank_name', 'account_number', 'routing_number'],
is_default: false,
name: 'wire_details'
})
};
fetch('http://localhost:8000/v1/views', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "8000",
CURLOPT_URL => "http://localhost:8000/v1/views",
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([
'description' => 'Banking information for wire transfers',
'document_type' => 'capital_call',
'fields' => [
'fund_name',
'bank_name',
'account_number',
'routing_number'
],
'is_default' => false,
'name' => 'wire_details'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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 := "http://localhost:8000/v1/views"
payload := strings.NewReader("{\n \"description\": \"Banking information for wire transfers\",\n \"document_type\": \"capital_call\",\n \"fields\": [\n \"fund_name\",\n \"bank_name\",\n \"account_number\",\n \"routing_number\"\n ],\n \"is_default\": false,\n \"name\": \"wire_details\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("http://localhost:8000/v1/views")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Banking information for wire transfers\",\n \"document_type\": \"capital_call\",\n \"fields\": [\n \"fund_name\",\n \"bank_name\",\n \"account_number\",\n \"routing_number\"\n ],\n \"is_default\": false,\n \"name\": \"wire_details\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:8000/v1/views")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Banking information for wire transfers\",\n \"document_type\": \"capital_call\",\n \"fields\": [\n \"fund_name\",\n \"bank_name\",\n \"account_number\",\n \"routing_number\"\n ],\n \"is_default\": false,\n \"name\": \"wire_details\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2024-01-15T10:30:00Z",
"description": "Fields needed for accounting workflow",
"document_type": "capital_call",
"fields": [
"fund_name",
"due_date",
"call_amount_lp",
"bank_name"
],
"is_default": true,
"name": "accounting",
"updated_at": "2024-01-15T10:30:00Z",
"view_id": "550e8400-e29b-41d4-a716-446655440000"
}{
"available_fields": [
"fund_name",
"notice_date",
"due_date",
"call_amount_lp"
],
"error": "invalid_fields",
"invalid_fields": [
"foo_bar",
"xyz"
],
"message": "The following fields are not available for document type 'capital_call': foo_bar, xyz"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Body
application/json
Request for creating a new view (POST /v1/views).
Response
Created view
Tenant view response.
Views define which fields from extracted data are returned when querying documents.