Skip to content

This code is the companion to the [Box AI quickstart guide]() available in our developer documentation. The project will walk you through the steps to get a BoxClient, extract key/value pairs from Box AI based on an invoice, and push that data back to Box as Box Metadata.

Notifications You must be signed in to change notification settings

box-community/box-ai-extract-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Box AI Extract Quickstart

A Python application that demonstrates how to use Box AI to extract structured metadata from files and attach it back to the file in Box. This quickstart guide will walk you through these steps.

Prerequisites

  • Python 3.11+
  • Box Developer Account
  • Box App with appropriate permissions

Setup

  1. Clone the repository

    git clone https://github.com/box-community/box-ai-extract-quickstart.git
    cd box-ai-extract-quickstart
  2. Create virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install python-dotenv "boxsdk>=10"
  4. Configure environment variables

    cp .env.template .env

    Edit .env and add your values:

    • BOX_DEVELOPER_TOKEN: Your Box developer token
    • BOX_FILE_ID: ID of the file to extract metadata from
    • BOX_METADATA_TEMPLATE_KEY: Key of your metadata template

Usage

Run the extraction script:

python extract.py

The script will:

  1. Authenticate with Box using your developer token
  2. Extract structured metadata from the specified file using Box AI
  3. Attach the extracted metadata to the file

Box Setup Requirements

  1. Create a Box App with Client Credentials Grant authentication
  2. Create a metadata template in your Box enterprise
  3. Ensure your app has permissions to read files and manage metadata
  4. Upload a file to Box and note its file ID

Project Structure

  • extract.py - Main application script
  • .env.template - Environment variables template
  • .env - Your environment variables (not tracked in git)
  • .gitignore - Git ignore rules for Python projects

About

This code is the companion to the [Box AI quickstart guide]() available in our developer documentation. The project will walk you through the steps to get a BoxClient, extract key/value pairs from Box AI based on an invoice, and push that data back to Box as Box Metadata.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages