Uploading Documents via API

To get started, create a workflow with two input nodes: an Input Node that represents the query and a Document Node that contains the data to be processed.

To make API calls, you’ll need the following information:

  • user_id: Your user ID with a handle for the specific conversation (user_id-conversation_id)
  • org: Your organization id
  • flow_id: The ID of your project
  • node_id: The ID of your Document Node (defaults to doc-0 if you have only one Document Node)

These parameters are used to uniquely identify where to store and associate uploaded documents within your Stack AI workspace.

API Endpoint

Stack AI’s API endpoints allow you to programmatically upload documents, enabling seamless integration with your applications and automation of the upload process.

Before making API calls, you’ll need to obtain your API Keys. Navigate to Settings -> API Keys to generate your credentials. For more information about API authentication, visit: API authentication.

Once you have your credentials (public Api Key) and understand the required parameters you can do your first call.

Example API Call

Here’s an example of how to upload a document using cURL:

curl -X POST "https://api.stack-ai.com/upload_to_supabase_user?org=your-organization&user_id=your-user-id&flow_id=your-flow-id&node_id=doc-0" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@/path/to/your/document.pdf"