Prerequisites
In :- If you haven’t already, create an account.
- Get your API key.
- Install the app.
- Enter your API key in the app.
- If you want to parse documents staged in Snowflake, grant the app access to the stages that have the files you want to parse.
Parse
To parse documents, use theapi.parse user-defined function (UDF). The files you specify will be sent to the -hosted service, and the results will display directly in Snowsight.
The api.parse function reads a document from a Snowflake stage or publicly accessible URL and returns a structured VARIANT object containing the parsed content.
Using the api.parse function is the same as calling the endpoint. For full details about this endpoint and its response, go to .
Sample Scenarios
This section provides examples of how to run theapi.parse function in different scenarios.
Parse a File at a Publicly Accessible URL
Run the command below to parse a single file at a publicly accessible URL. We’ve provided a sample file to help you get started. Replace this placeholder with your information:APP_NAME.
Parse a Staged File
Run the command below to parse a single file in a Snowflake stage. Replace these placeholders with your information:APP_NAME, your_db, your_schema, your_stage, and path/to/file.pdf.
Sample Script: Parse a Staged File
Let’s say you have the following setup:- APP_NAME: AGENTIC_DOCUMENT_EXTRACTION__APP
- Database: DEMO_DB
- Schema: DEMO_SCHEMA
- Stage: DEMO_STAGE
- PDF: statement-jane-harper.pdf
Parse a Batch of Files in a Table
One way to process multiple documents is to create a table that lists the filenames of documents stored in a Snowflake stage. Then, write a SQL script that processes each file by using the file paths from the table. This approach uses the concatenation operator (||) to connect the file paths in your table to the actual documents in your stage.
Use the following script to process multiple files from a table. Replace these placeholders with your information: APP_NAME, your_db, your_schema, your_stage, and documents.
The script assumes you have a table called documents with a file_path column that lists document filenames.
Sample Script: Parse a Batch of Files in a Table
Let’s say you have the following setup:- APP_NAME: AGENTIC_DOCUMENT_EXTRACTION__APP
- Database: DEMO_DB
- Schema: DEMO_SCHEMA
- Stage: DEMO_STAGE (contains PDFs and images)
- Table: STATEMENTS
file_path. The file_path column contains the following filenames:
- statement-george-mathew.png
- statement-jane-harper.pdf
- statement-john-doe.png
- statement-john-smith.png


