Upload files via API

To add documents to an Doc+Search node you can call the following endpoint

https://stack-intext.onrender.com/index_documents_api

This endpoint requires the following variables:

  1. flow_id: the id displayed on the url of your flow.

  2. node_id: the id of the node where to upload the files (e.g. 'docemb-0').

  3. org: your organization name.

The body of the request needs to be a list of files opened in bytes. Additionally, the request needs to be signed with your private api key. Example of usage:

import requests

# API endpoint URL
url = f"https://stack-intext.onrender.com/index_documents_api?flow_id={'FLOW_ID'}&node_id={'NODE_ID'}&org={'YOUR_ORGANIZATION'}"

# Request data
headers = {
    "Authorization": "Bearer <PRIVATE_API_KEY>",
}

# Load the list of files
file_list = {"files": [("file1.txt", open("path_to_your_file1.txt", "rb")), 
("file2.txt", open("path_to_your_file2.txt", "rb"))]}

# Make the API request
response = requests.post(url, files=file_list, headers=headers)

# Check the response
if response.status_code == 200:
    print("API request successful")
else:
    print("API request failed:", response.text)

Last updated