Viewing Documents
FSCO provides APIs for retrieving document details and tracking document activity. This guide covers both viewing document information and monitoring document processing status.
Prerequisites
Section titled “Prerequisites”Before you begin, ensure you have:
- A valid FSCO API key
- Your application’s environment configured with the API key
- A document ID to view
- A collection ID (if filtering by collection)
Get Document by ID
Section titled “Get Document by ID”Endpoint
Section titled “Endpoint”GET /v2/document/{documentId}
Example Request
Section titled “Example Request”#!/bin/bash
curl -X GET "https://api.fsco.io/v2/document/8c1d496f-2827-4750-a11f-74b48c11108d" \ -H "x-api-key: $FSCO_API_KEY" \ -H "x-api-secret: $FSCO_API_SECRET" \ -H "Content-Type: application/json"
import axios from 'axios';
const apiKey = process.env.FSCO_API_KEY;const apiSecret = process.env.FSCO_API_SECRET;
async function getDocumentById() { try { const response = await axios.get( 'https://api.fsco.io/v2/document/8c1d496f-2827-4750-a11f-74b48c11108d', { headers: { 'x-api-key': apiKey, 'x-api-secret': apiSecret, 'Content-Type': 'application/json' } } ); console.log('Document:', response.data); } catch (error) { console.error('Error getting document:', error); }}
// Example usagegetDocumentById();
import osimport requests
api_key = os.getenv('FSCO_API_KEY')api_secret = os.getenv('FSCO_API_SECRET')
def get_document_by_id(): document_id = '8c1d496f-2827-4750-a11f-74b48c11108d' url = f'https://api.fsco.io/v2/document/{document_id}' headers = { 'x-api-key': api_key, 'x-api-secret': api_secret, 'Content-Type': 'application/json' }
try: response = requests.get(url, headers=headers) response.raise_for_status() print('Document:', response.json()) except requests.exceptions.RequestException as e: print('Error getting document:', e)
# Example usageget_document_by_id()
using System;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;
class DocumentGetter{ static async Task Main() { var documentId = "8c1d496f-2827-4750-a11f-74b48c11108d";
var apiKey = Environment.GetEnvironmentVariable("FSCO_API_KEY"); var apiSecret = Environment.GetEnvironmentVariable("FSCO_API_SECRET");
var client = new HttpClient(); client.DefaultRequestHeaders.Add("x-api-key", apiKey); client.DefaultRequestHeaders.Add("x-api-secret", apiSecret); client.DefaultRequestHeaders.Add("Content-Type", "application/json");
var response = await client.GetAsync($"https://api.fsco.io/v2/document/{documentId}"); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Document: " + responseString); }}
Response
Section titled “Response”{ "id": "84d2e1b7-84ff-41b1-89db-a908708917eb", "createdAt": "2025-05-19T23:44:05.298Z", "updatedAt": "2025-05-19T23:44:05.298Z", "isTest": false, "config": null, "fileData": null, "ocrProvider": "GOOGLE_DOCUMENT_AI", "ocrData": null, "docExt": "application/pdf", "docName": "my_invoice_2025-05-06.pdf", "docType": "invoice", "uploadBatchId": "2993F653-E268-4CE6-A6A0-A5FC05DB1888", "refId": "2a2e4823-017c-4acd-a683-87e91c647500", "blobId": "88151bc0-3cd3-46c8-9c49-49e82a54597b", "isPublic": false, "isUploaded": false, "source": "My API", "webhookId": null, "organisationId": "00b4b8e6-6e9c-4ec8-8bc0-4f27cba57e26", "userId": "0d05e804-cb6c-4bd4-8bf7-2d283b466eca", "status": "created", "version": 1, "prompts": [ { "id": "91e0fd01-4df3-422b-afa7-adfd489cc0f5", "name": "Issuer", "format": "", "children": [], "itemType": "singleLine", "fieldType": "string", "description": "Who is the issuer of this invoice" } ], "providerModelId": "7b313983-7d8c-43ca-9714-c6767201bd3f", "documentGroups": [], "providerModel": { "providerModelId": "7b313983-7d8c-43ca-9714-c6767201bd3f", "providerName": "OPENAI", "modelName": "GPT_4O", "description": "Default provider model", "displayName": "GPT_4O" }, "uploadUrl": "url-to-upload-the-document", "downloadUrl": "url-to-download-the-document"}
Get Document Activity
Section titled “Get Document Activity”The document activity endpoint allows you to track the processing status and history of a document. This includes information about when the document was created, processed, and any errors that may have occurred.
Endpoint
Section titled “Endpoint”GET /v2/document/{documentId}/activity
Example Request
Section titled “Example Request”#!/bin/bash
curl -X GET "https://api.fsco.io/v2/document/8c1d496f-2827-4750-a11f-74b48c11108d/activity?page[number]=1&limit=10" \ -H "x-api-key: $FSCO_API_KEY" \ -H "x-api-secret: $FSCO_API_SECRET" \ -H "Content-Type: application/json"
import axios from 'axios';
const apiKey = process.env.FSCO_API_KEY;const apiSecret = process.env.FSCO_API_SECRET;
async function getDocumentActivity() { try { const response = await axios.get( 'https://api.fsco.io/v2/document/8c1d496f-2827-4750-a11f-74b48c11108d/activity', { headers: { 'x-api-key': apiKey, 'x-api-secret': apiSecret, 'Content-Type': 'application/json' }, params: { page: 1, limit: 10 } } ); console.log('Document activity:', response.data); } catch (error) { console.error('Error getting document activity:', error); }}
// Example usagegetDocumentActivity();
import osimport requests
# Get API credentials from environment variablesapi_key = os.getenv("FSCO_API_KEY")api_secret = os.getenv("FSCO_API_SECRET")
# Print the responseprint("Template created:", response.json())
def get_document_activity(): document_id = '8c1d496f-2827-4750-a11f-74b48c11108d' url = f'https://api.fsco.io/v2/document/{document_id}/activity' headers = { 'x-api-key': api_key, 'x-api-secret': api_secret, 'Content-Type': 'multipart/form-data' } params = { 'page': 1, 'limit': 10 }
try: response = requests.get(url, headers=headers, params=params) response.raise_for_status() print('Document activity:', response.json()) except requests.exceptions.RequestException as e: print('Error getting document activity:', e)
# Example usageget_document_activity()
using System;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;
class DocumentActivityGetter{ static async Task Main() { var apiKey = Environment.GetEnvironmentVariable("FSCO_API_KEY"); var apiSecret = Environment.GetEnvironmentVariable("FSCO_API_SECRET");
var client = new HttpClient(); client.DefaultRequestHeaders.Add("x-api-key", apiKey); client.DefaultRequestHeaders.Add("x-api-secret", apiSecret); client.DefaultRequestHeaders.Add("Content-Type", "application/json");
var documentId = "8c1d496f-2827-4750-a11f-74b48c11108d"; var response = await client.GetAsync($"https://api.fsco.io/v2/document/{documentId}/activity?page[number]=1&limit=10"); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Document activity: " + responseString); }}
Response
Section titled “Response”{ "page": { "number": 1, "size": 10, "totalCount": 4, "totalPages": 1, "hasNext": false, "hasPrev": false }, "items": [ { "id": "43b9f67f-b836-4ee8-ac81-087e5943526f", "domainId": "1533aa81-aef6-4c4e-b1ef-c618719fab6b", "eventSignature": "io.fsco.ocr.event.ocrStarted", "message": { "s3Key": "s3key", "blobId": "758dc83b-66d6-4870-80b1-952bec60139e", "blobKey": "hiiro/1533aa81-aef6-4c4e-b1ef-c618719fab6b/my_invoice_2025-05-06.pdf", "s3Bucket": "s3bucket", "documentId": "1533aa81-aef6-4c4e-b1ef-c618719fab6b" }, "createdAt": "2025-05-19T06:54:13.952Z" }, { "id": "850ef3a6-f433-482c-9cbb-56c94e12c125", "domainId": "1533aa81-aef6-4c4e-b1ef-c618719fab6b", "eventSignature": "io.fsco.ocr.event.ocrCompleted", "message": { "prompt": "", "documentId": "1533aa81-aef6-4c4e-b1ef-c618719fab6b", "ocrResultBlobKey": "1533aa81-aef6-4c4e-b1ef-c618719fab6b.json" }, "createdAt": "2025-05-19T06:54:18.301Z" }, { "id": "2a406b98-18c4-4bf1-a736-bbddc2164ce4", "domainId": "1533aa81-aef6-4c4e-b1ef-c618719fab6b", "eventSignature": "io.fsco.ai.event.documentTypeSelected", "message": { "result": { "document_type": "financial" }, "documentId": "1533aa81-aef6-4c4e-b1ef-c618719fab6b" }, "createdAt": "2025-05-19T06:54:21.774Z" }, { "id": "62895163-5ee6-4fd8-a390-8eabacdaff6b", "domainId": "1533aa81-aef6-4c4e-b1ef-c618719fab6b", "eventSignature": "io.fsco.ai.event.documentProcessed", "message": { "model": "GPT_4O", "result": { "Issuer": { "value": "Figma, Inc.", "promptId": "91e0fd01-4df3-422b-afa7-adfd489cc0f5", "promptName": "Issuer" } }, "documentId": "1533aa81-aef6-4c4e-b1ef-c618719fab6b" }, "createdAt": "2025-05-19T06:54:23.009Z" } ]}
Get Document List
Section titled “Get Document List”Endpoint
Section titled “Endpoint”GET /v2/document
Query Parameters
Section titled “Query Parameters”All parameters are required:
page
: Page number for pagination (number)limit
: Number of items per page (number)groupId
: Group ID to filter documents (string)
Example Request
Section titled “Example Request”#!/bin/bash
curl -X GET "https://api.fsco.io/v2/document?page[number]=1&limit=10" \ -H "x-api-key: $FSCO_API_KEY" \ -H "x-api-secret: $FSCO_API_SECRET" \ -H "Content-Type: application/json"
import axios from 'axios';
const apiKey = process.env.FSCO_API_KEY;const apiSecret = process.env.FSCO_API_SECRET;
async function getDocumentList() { try { const response = await axios.get( 'https://api.fsco.io/v2/document', { headers: { 'x-api-key': apiKey, 'x-api-secret': apiSecret, 'Content-Type': 'application/json' }, params: { page: 1, limit: 10 } } ); console.log('Document list:', response.data); } catch (error) { console.error('Error getting document list:', error); }}
// Example usagegetDocumentList();
import osimport requests
api_key = os.getenv('FSCO_API_KEY')api_secret = os.getenv('FSCO_API_SECRET')
def get_document_list(): url = 'https://api.fsco.io/v2/document' headers = { 'x-api-key': api_key, 'x-api-secret': api_secret, 'Content-Type': 'multipart/form-data' } params = { 'page': 1, 'limit': 10, 'groupId': 'your-group-id' }
try: response = requests.get(url, headers=headers, params=params) response.raise_for_status() print('Document list:', response.json()) except requests.exceptions.RequestException as e: print('Error getting document list:', e)
# Example usageget_document_list()
using System;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;
class DocumentLister{ static async Task Main() { var apiKey = Environment.GetEnvironmentVariable("FSCO_API_KEY"); var apiSecret = Environment.GetEnvironmentVariable("FSCO_API_SECRET");
var client = new HttpClient(); client.DefaultRequestHeaders.Add("x-api-key", apiKey); client.DefaultRequestHeaders.Add("x-api-secret", apiSecret); client.DefaultRequestHeaders.Add("Content-Type", "application/json");
var response = await client.GetAsync("https://api.fsco.io/v2/document?page[number]=1&limit=10"); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Document list: " + responseString); }}
Response
Section titled “Response”{ "items": [ { "id": "84d2e1b7-84ff-41b1-89db-a908708917eb", "createdAt": "2025-05-19T23:44:05.298Z", "updatedAt": "2025-05-19T23:44:05.298Z", "isTest": false, "config": null, "fileData": null, "ocrProvider": "GOOGLE_DOCUMENT_AI", "ocrData": null, "docExt": "application/pdf", "docName": "my_invoice_2025-05-06.pdf", "docType": "invoice", "uploadBatchId": "2993F653-E268-4CE6-A6A0-A5FC05DB1888", "refId": "2a2e4823-017c-4acd-a683-87e91c647500", "blobId": "88151bc0-3cd3-46c8-9c49-49e82a54597b", "isPublic": false, "isUploaded": false, "source": "My API", "webhookId": null, "organisationId": "00b4b8e6-6e9c-4ec8-8bc0-4f27cba57e26", "userId": "0d05e804-cb6c-4bd4-8bf7-2d283b466eca", "status": "created", "version": 1, "prompts": [ { "id": "91e0fd01-4df3-422b-afa7-adfd489cc0f5", "name": "Issuer", "format": "", "children": [], "itemType": "singleLine", "fieldType": "string", "description": "Who is the issuer of this invoice" } ], "providerModelId": "7b313983-7d8c-43ca-9714-c6767201bd3f", "documentGroups": [], "providerModel": { "providerModelId": "7b313983-7d8c-43ca-9714-c6767201bd3f", "providerName": "OPENAI", "modelName": "GPT_4O", "description": "Default provider model", "displayName": "GPT_4O" }, "uploadUrl": "url-to-upload-the-document", "downloadUrl": "url-to-download-the-document" } ], "total": 1, "page": 1, "limit": 10}
Get Documents by Collection
Section titled “Get Documents by Collection”Endpoint
Section titled “Endpoint”GET /v2/document/collection/{collectionId}
Query Parameters
Section titled “Query Parameters”All parameters are required:
page
: Page number for pagination (number)limit
: Number of items per page (number)
Example Request
Section titled “Example Request”#!/bin/bash
curl -X GET "https://api.fsco.io/v2/document/collection/8c1d496f-2827-4750-a11f-74b48c11108d?page[number]=1&limit=10" \ -H "x-api-key: $FSCO_API_KEY" \ -H "x-api-secret: $FSCO_API_SECRET" \ -H "Content-Type: application/json"
import axios from 'axios';
const apiKey = process.env.FSCO_API_KEY;const apiSecret = process.env.FSCO_API_SECRET;
async function getDocumentsByCollection() { try { const response = await axios.get( 'https://api.fsco.io/v2/document/collection/8c1d496f-2827-4750-a11f-74b48c11108d', { headers: { 'x-api-key': apiKey, 'x-api-secret': apiSecret, 'Content-Type': 'application/json' }, params: { page: 1, limit: 10 } } ); console.log('Documents in collection:', response.data); } catch (error) { console.error('Error getting documents by collection:', error); }}
// Example usagegetDocumentsByCollection();
import osimport requests
api_key = os.getenv('FSCO_API_KEY')api_secret = os.getenv('FSCO_API_SECRET')
def get_documents_by_collection(): collection_id = '8c1d496f-2827-4750-a11f-74b48c11108d' url = f'https://api.fsco.io/v2/document/collection/{collection_id}' headers = { 'x-api-key': api_key, 'x-api-secret': api_secret, 'Content-Type': 'multipart/form-data' } params = { 'page': 1, 'limit': 10 }
try: response = requests.get(url, headers=headers, params=params) response.raise_for_status() print('Documents in collection:', response.json()) except requests.exceptions.RequestException as e: print('Error getting documents by collection:', e)
# Example usageget_documents_by_collection()
using System;using System.Net.Http;using System.Net.Http.Headers;using System.Threading.Tasks;
class CollectionDocumentLister{ static async Task Main() { var apiKey = Environment.GetEnvironmentVariable("FSCO_API_KEY"); var apiSecret = Environment.GetEnvironmentVariable("FSCO_API_SECRET");
var client = new HttpClient(); client.DefaultRequestHeaders.Add("x-api-key", apiKey); client.DefaultRequestHeaders.Add("x-api-secret", apiSecret); client.DefaultRequestHeaders.Add("Content-Type", "application/json");
var collectionId = "8c1d496f-2827-4750-a11f-74b48c11108d";
var response = await client.GetAsync($"https://api.fsco.io/v2/document/collection/{collectionId}?page[number]=1&limit=10"); var responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine("Documents in collection: " + responseString); }}
Response
Section titled “Response”{ "items": [ { "id": "84d2e1b7-84ff-41b1-89db-a908708917eb", "createdAt": "2025-05-19T23:44:05.298Z", "updatedAt": "2025-05-19T23:44:05.298Z", "isTest": false, "config": null, "fileData": null, "ocrProvider": "GOOGLE_DOCUMENT_AI", "ocrData": null, "docExt": "application/pdf", "docName": "my_invoice_2025-05-06.pdf", "docType": "invoice", "uploadBatchId": "2993F653-E268-4CE6-A6A0-A5FC05DB1888", "refId": "2a2e4823-017c-4acd-a683-87e91c647500", "blobId": "88151bc0-3cd3-46c8-9c49-49e82a54597b", "isPublic": false, "isUploaded": false, "source": "My API", "webhookId": null, "organisationId": "00b4b8e6-6e9c-4ec8-8bc0-4f27cba57e26", "userId": "0d05e804-cb6c-4bd4-8bf7-2d283b466eca", "status": "created", "version": 1, "prompts": [ { "id": "91e0fd01-4df3-422b-afa7-adfd489cc0f5", "name": "Issuer", "format": "", "children": [], "itemType": "singleLine", "fieldType": "string", "description": "Who is the issuer of this invoice" } ], "providerModelId": "7b313983-7d8c-43ca-9714-c6767201bd3f", "documentGroups": [ { "id": "d2e75489-324d-4a37-8cb6-9514217f4622", "documentId": "84d2e1b7-84ff-41b1-89db-a908708917eb", "groupId": "3429793f-eb82-4a06-ab55-d641d5a26aa4", "createdAt": "2025-05-20T01:46:33.127Z" } ], "providerModel": { "providerModelId": "7b313983-7d8c-43ca-9714-c6767201bd3f", "providerName": "OPENAI", "modelName": "GPT_4O", "description": "Default provider model", "displayName": "GPT_4O" }, "uploadUrl": "url-to-upload-the-document", "downloadUrl": "url-to-download-the-document" } ], "total": 1, "page": 1, "limit": 10}
Important Notes
Section titled “Important Notes”- The list endpoint supports pagination for efficient data retrieval
- Results are scoped to your organization
- Documents can be filtered by both group and collection
- The response includes metadata about the documents such as creation date and status