POST /api/v1/interact
Enables interaction with a Zams AI agent to process messages, execute actions, and receive responses.
Authentication
| Header |
Value |
| X-API-Key |
******** |
| accept |
application/json |
| Content-Type |
application/json |
Example Requests
cURL
curl --location '<https://api.zams.com/api/v1/interact>' \\
--header 'accept: application/json' \\
--header 'X-API-Key: ********' \\
--header 'Content-Type: application/json' \\
--data '{
"messages": [
{
"role": "user",
"content": "Show me the last 5 emails in my inbox."
}
],
"agent_id": "63a9c4f2e08bd157291af46d825c09741b3e",
"files": [
{
"id": "file-library-id-123",
"name": "data.csv"
}
],
"actions": [
"75b2c8d4a6f931e0572849c63b1a50d7e94c28f5"
]
}'
Python
import requests
import json
def interact_with_agent(agent_id, messages, actions):
url = "<https://api.zams.com/api/v1/interact>"
headers = {
"accept": "application/json",
"X-API-Key": "********",
"Content-Type": "application/json"
}
payload = {
"messages": messages,
"agent_id": agent_id,
"actions": actions
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
return response.json()
else:
raise Exception(f"Error: {response.status_code}")
# Example usage
messages = [
{
"role": "user",
"content": "show me the last 5 emails in my inbox"
}
]
actions = [
"75b2c8d4a6f931e0572849c63b1a50d7e94c28f5"
]
response = interact_with_agent("63a9c4f2e08bd157291af46d825c09741b3e", messages, actions)
print(response)
Request Body
| Field |
Type |
Description |
| messages |
array |
Array of message objects containing conversation history |
| agent_id |
string |
ID of the agent to interact with |
| actions |
array |
Array of action IDs that the agent can execute |
| files |
array |
Array of file ids and names that the agent has access to |
Message Object Format
| Field |
Type |
Description |
| role |
string |
Role of the message sender (system, user, assistant) |
| content |
string |
Content of the message |
Example Response
{
"response": "Here are the last 5 emails in your inbox:\\n\\n---\\n\\n<b>1. Subject:</b> Re: [CompanyX/project-alpha] merge feature update (PR #42) \\n<b>From:</b> dev-team <a href=\\"<mailto:[email protected]>\\">[email protected]</a> \\n<b>To:</b> \\"CompanyX/project-alpha\\" <a href=\\"<mailto:[email protected]>\\">[email protected]</a> \\n<b>Date:</b> Mon, 23 Jun 2025 11:17:36 -0700 \\n<b>Snippet:</b> @dev-team approved this pull request. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread...\\n\\n---\\n\\n<b>2. Subject:</b> Order Confirmation - Delicious Eats - 06/24/2025 07:00 AM \\n<b>From:</b> Delicious Eats <a href=\\"<mailto:[email protected]>\\">[email protected]</a> \\n<b>To:</b> Jane Smith <a href=\\"<mailto:[email protected]>\\">[email protected]</a> \\n<b>Date:</b> Mon, 23 Jun 2025 18:06:55 +0000 \\n<b>Snippet:</b> Hi Jane, Thanks for your breakfast order scheduled for 06/24/2025 07:00 AM. Any questions? Contact us at <a href=\\"<mailto:[email protected]>\\">[email protected]</a>...\\n\\n---\\n\\n<b>3. Subject:</b> Team Lunch Reminder \\n<b>From:</b> Office Admin <a href=\\"<mailto:[email protected]>\\">[email protected]</a> \\n<b>To:</b> \\"<a href=\\"<http://example.com/\\>">Example Team</a>\\" <a href=\\"<mailto:[email protected]>\\">[email protected]</a> \\n<b>Date:</b> Mon, 23 Jun 2025 11:00:00 -0700 \\n<b>Snippet:</b> Hello team, Reminder to submit your lunch preferences by 4 PM today. Tomorrow we'll have special options from Tasty Bites Catering including vegetarian and gluten-free choices...\\n\\n---\\n\\n<b>4. Subject:</b> Jane, interested in our services? \\n<b>From:</b> Marketing Team <a href=\\"<mailto:[email protected]>\\">[email protected]</a> \\n<b>To:</b> <a href=\\"<mailto:[email protected]>\\">[email protected]</a> \\n<b>Date:</b> Mon, 23 Jun 2025 17:56:53 +0000 \\n<b>Snippet:</b> Hi Jane, I'm reaching out because we help companies like yours streamline operations. Last month, we helped Example Corp increase productivity by 25% while reducing costs...\\n\\n---\\n\\n<b>5. Subject:</b> Re: [CompanyX/project-alpha] Fix/login issue (PR #41) \\n<b>From:</b> \\"system[bot]\\" <a href=\\"<mailto:[email protected]>\\">[email protected]</a> \\n<b>To:</b> \\"CompanyX/project-alpha\\" <a href=\\"<mailto:[email protected]>\\">[email protected]</a> \\n<b>Date:</b> Mon, 23 Jun 2025 10:53:11 -0700 \\n<b>Snippet:</b> @system[bot] commented on this pull request. Issue: Authentication token validation needs improvement. The current implementation doesn't properly handle expired tokens...\\n\\n---\\n\\nWould you like to see the complete content of any specific email?",
"exchange_id": "abc123def456ghi789jkl012mno345pqr"
}
Response Format
| Field |
Type |
Description |
| response |
string |
The agent's response to the conversation, including results of executed actions |
| exchange_id |
string |
Unique identifier for this conversation exchange |