Document
A document in this context is a business document that is supplied as a receipt for a certain user transaction.
Contents of documents are extracted using OCR and LLM, then verified and metadata can be added. Once all this information is approved, the document record is stored on a network (blockchain).
Environments
Development
The FSCO development environment is a pre-prod environment that can be used for development and testing.
The development environment saves data on the network’s TestNet:
-
Authentication:
https://dev-api.authentication.dev.fsco.io/api/authentication
-
API:
https://dev-api.funded-here.dev.fsco.io/funded-here
Production
This is the FSCO production/operational environment. It persists data on the network’s MainNet.
-
Authentication:
https://prod-api.authentication.fsco.io/api/authentication
-
API:
https://prod-api.internal.fsco.io/funded-here
Endpoints
GET /document/${documentId}
Request
id: string
: The referenced document Id returned by the webhook
Response
-
HTTP 200 - Success:
-
body: object
-
documentId: uuid
ID of the document returned from webhook. -
documentOCrData: object
: Containing the tokens specified in/funded-here/start-bulk-upload
withtoken
(s) as key(s) and specifiedfield_type
as value type.<promptName>: string
: The name of a single promptid: uuid
:value: any
:type: string
:prompt: object
:id: uuid
: ID of prompt createdname: string
: The field name (token) to be extracted and returned from the documentdescription: string
: This is the LLM instruction to return the token, example: “What is the grand total of this invoice?”format: string
: This gives additional instructions to LLM to format the response, example: “A single string representing the grand total amount”field_type: string
: The response field type: this should usually be ‘str’ (string)
-
-
HTTP 404 - DOCUMENT_NOT_FOUND exception if no document with the specified refId exists.
Example
GET https://dev-api.funded-here.dev.fsco.io/funded-here/document/b7ab5be6-6ce6-4050-bd41-0ae8f236cf6d
content-type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR2cCI6IkpXKCJ9.eyJpZCI1ImRiMTJkMzBmLTkyYjMtNDZhYy1hYmFjLWViNDY2NWMwYmVkYyIsImFwcHMiOlsiOTM3ZjJhMTYtYjAwYi00ZmUyLTkyNTQtZDFkNjk4ZDkzNzgyIl0sImlzU3VwcGVyS2V5Ijp0cnVlLCJvcmdhbmlzYXRpb25JZCI6IjAwYjRiOGU2LTZlOWMtNGVjOC04YmMwLTRmMjdjYmE1N2UyNiIsImlzS2T5Ijp0cnVlLCJpYXQiOjE2OTY2NzM1NDUsImV4cCI6MTY5NDY4MDc0NX0.pW1gOpDZVDervOoirrzeyn0VDF6GTf7pLJtr8I4ZA7I
POST /enrich
Request
-
documentId: uuid
: The ID of the reference document -
enriched: array
: Containing the tokens specified in/funded-here/start-bulk-upload
withtoken
(s) as key(s) and specifiedfield_type
as value type.id: uuid
: The ID of the prompted created, can be found when querying the documentvalue: any
: The value on which you would like to save and write to chain
Response
-
HTTP 200 - Success:
-
documentId: uuid
: The ID of the reference document -
HTTP 404 - DOCUMENT_NOT_FOUND exception if no document with the specified refId exists.
POST /start-bulk-upload
Request
-
docType: string
: Custom defined by consumer, example: Tax Invoice, Purchase Order etc. -
uploadBatchId: string
: Custom unvalidated reference Id for the batch defined by user - for example, this could be an external id to identify this batch. -
webhookId (optional): string
: The ID of a created webhook. This allows for monitoring of document events once they have finished processing -
prompts: array
: Multiple config elements allowed, one for each extracted token. The tokens specified here will be extracted, stored and returned by the metadata service.name: string
: The field name (token) to be extracted and returned from the documentdescription: string
: This is the LLM instruction to return the token, example: “What is the grand total of this invoice?”format: string
: This gives additional instructions to LLM to format the response, example: “A single string representing the grand total amount”field_type: string
: The response field type: this should usually be ‘str’ (string)
Response
body: object
batchId: string
: The batch reference IduploadUrl: string
: The S3 upload Url. Default lifetime of the Url is 3600 seconds.
Example
POST https://dev-api.funded-here.dev.fsco.io/funded-here/start-bulk-upload
content-type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR2cCI6IkpXKCJ9.eyJpZCI1ImRiMTJkMzBmLTkyYjMtNDZhYy1hYmFjLWViNDY2NWMwYmVkYyIsImFwcHMiOlsiOTM3ZjJhMTYtYjAwYi00ZmUyLTkyNTQtZDFkNjk4ZDkzNzgyIl0sImlzU3VwcGVyS2V5Ijp0cnVlLCJvcmdhbmlzYXRpb25JZCI6IjAwYjRiOGU2LTZlOWMtNGVjOC04YmMwLTRmMjdjYmE1N2UyNiIsImlzS2T5Ijp0cnVlLCJpYXQiOjE2OTY2NzM1NDUsImV4cCI6MTY5NDY4MDc0NX0.pW1gOpDZVDervOoirrzeyn0VDF6GTf7pLJtr8I4ZA7I
{ docType: "Tax Invoice", uploadBatchId: "Payment Batch #299", prompts: [ { "name": "invoice_number", "format": "A single string representing the invoice No/number", "field_type": "str", "description": "What is the invoice No/number?" }, { "name": "total_amount", "format": "A single string representing the grand total amount", "field_type": "str", "description": "What is the grand total of this invoice?"
} ]}
Response: { body: { uploadUrl: "https://s3.aws.com/...", batchId: "ab17d10f-98b3-16uc-bbae-ab4625c0beyr" }}