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.
Set Up the Session
Before running a parse or extract procedure, run the command below to set your session to use the Agentic Document Extraction application and procedures. Replace this placeholder with the name of your instance of Agentic Document Extraction:APP_NAME.
Parse
To parse documents, use theapi.parse procedure.
The api.parse procedure sends a document from a Snowflake stage or publicly accessible URL to the -hosted service, and saves the parsed content to an output table (defaults to db.parse_output).
The api.parse procedure runs the ADE Parse Jobs API.
Optional Parameters
Theapi.parse procedure supports these optional parameters:
model: Specify the model version to use for parsing. For full details on parsing models, go to Document Pre-Trained Transformers (Parsing Models).split: Specify how to split the document.output_table: Specify a custom output table name instead of the defaultparse_output.
Specify a Custom Output Table
You can specify a custom table name for storing parse results instead of using the defaultparse_output:
- DOC_ID
- SOURCE_URL
- FILENAME
- PAGE_COUNT
- MODEL_VERSION
- PARSED_AT
- STATUS_CODE
- MARKDOWN
- CHUNKS
- SPLITS
- GROUNDING
- METADATA
- ERROR
Example with Optional Parameters
Parse Return Object
Theapi.parse procedure returns an OBJECT with the following fields:
message: Success or error messageoutput_table: Name of the table where results were saved (such as “db.parse_output”)doc_id: Unique document identifier for the parsed documentstatus_code: HTTP status code for the request
api.extract.
Example of capturing the return object:
Use build_scoped_file_url for Staged Files
You can use thebuild_scoped_file_url() function to reference files in Snowflake stages.
Sample Scenarios
This section provides examples of how to run theapi.parse procedure 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
Before parsing staged files, you must grant the application access to your stage. For more information, go to Grant Access to Stages.
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 Multiple Staged Files
Before parsing staged files, you must grant the application access to your stage. For more information, go to Grant Access to Stages.
api.parse procedure for each file. The procedure saves the results to the db.parse_output table, where you can query all parsed documents.
Here’s an example of processing multiple files and then viewing the results. Replace these placeholders with your information: APP_NAME, your_db, your_schema, and your_stage.
Sample Script: Parse Multiple Staged Files
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)
- statement-george-mathew.png
- statement-jane-harper.pdf
- statement-john-doe.png
- statement-john-smith.png
Remove Parse Output Tables
Each time you run theapi.parse procedure, the results are saved to an output table (defaults to db.parse_output). Over time, you may want to remove these tables to start fresh or clean up old results. This is especially useful if you have specified custom output table names and accumulated multiple tables.
To remove parse output tables:
- Go to Catalog > Apps > Agentic Document Extraction - App.
- Click Settings.
- Navigate to SQL Execution.
- Enter the following SQL command in the SQL field:
- Replace these placeholders with your information:
APP_NAME: The name of your app instanceDB: The app’s database name (usedb)TABLE_NAME: The name of the table you want to remove (such asparse_outputor your custom table name)
- Click Run Query.

