API
How to use GET/POST API requests with Integrail.
Last updated
How to use GET/POST API requests with Integrail.
Last updated
Agents, when deployed (requires Builder license or higher, deployment is done with a 🚀 icon), can receive INPUT with POST requests, and provide output with GET requests.
To be able to work with Agent cloud deployment and GET/POST API, you need to have a Builder license or above. That gives you “Deploy agent to cloud” capability.
Create an agent with desired Inputs, Outputs, and processing nodes. Deploy it to the cloud by pressing a button.
Click on the main popup menu (bottom left), and select Settings.
Open the “App Token” tab and create an API key.
Open the “Agents” tab. It will list all agents you deployed to the cloud. From here, you can copy full POST and GET commands that you can use with your API caller of choice.
Please make sure to introduce a check on the GET command to check the status of the agent. If it says “running,” you need to wait.
Select POST request and input your /execute
path provided by the POST curl request on the Settings → Agents page.
Example:
POST https://cloud.integrail.ai/api/your-agent-path/execute
Copy your API key. In the httpie.io/app, input the key into the “Auth” tab with the “Bearer token” authentication type.
Input the body from the POST request into the “Body” tab as text.
Click “SEND”. It should return the status and execution ID.
Example Response:
Now run a GET request to the /status
endpoint. Substitute {execution-id}
with the actual ID from the execution response.
Example:
.../agent/{execution-id}/status
Check the status. If the status is “finished,” you will see the outputs below. If the status is “running,” repeat the GET request.
You can upload files directly from your local disk for processing by agents using multipart execution. This is done by sending a multipart POST request instead of a standard POST request.
Instead of sending your request to the standard /execute
endpoint, send it to /execute/multipart
.
Example:
If your standard /execute
URL is:
Then for multipart execution, send your request to:
Use forms to upload inputs:
String inputs should be included in a payload form.
File inputs should be in separate forms, where the form name matches the input name.
Examples are provided for an Agent with a userPrompt (string input) and doc (file input)
Note that the file name should be equal to the file's input name in Agen Inputs.
Escaping Characters: In command-line environments, double quotes ("
) must be escaped (e.g., with \
on Windows).
File Paths: In the example above, Questionnaire.pdf
is in the same folder as curl.exe, that's why it is passed as
'doc="@.\Questionnaire.pdf"'. You can also use absolute paths.