Skip to Content
Quickstart

Quickstart Guide

Get started with the Zazmic Agents API in under 5 minutes.

Prerequisites

  • A Zazmic Agents account (sign up at agents.zazmic.com )
  • An API key (generate from your account settings)
  • Basic knowledge of REST APIs

Step 1: Get Your API Key

  1. Log in to your Zazmic Agents account
  2. Navigate to Settings > API Keys
  3. Click Generate New API Key
  4. Copy and securely store your API key

Warning: Keep your API key secret! Never commit it to version control or share it publicly.

Step 2: Make Your First API Call

Execute a Task

Tasks are asynchronous agent executions that process your input and return results.

curl -X POST https://agents.zazmic.com/api/tasks \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "endpointId": "endpoint_id_here", "params": { "message": "Analyze this text for sentiment" } }'

Response:

{ "taskId": "task_abc123", "status": "pending", "message": "Task queued successfully" }

Step 3: Check Task Status

Tasks are processed asynchronously. Poll the task status endpoint:

curl https://agents.zazmic.com/api/tasks/task_abc123 \ -H "Authorization: Bearer YOUR_API_KEY"

Response (Completed):

{ "id": "task_abc123", "status": "completed", "request": {"message": "Analyze this text for sentiment"}, "response": { "sentiment": "positive", "confidence": 0.92, "details": "..." }, "createdAt": "2024-01-15T10:30:00Z", "completedAt": "2024-01-15T10:30:05Z" }

Code Examples

Python

import requests import time API_KEY = "your_api_key_here" BASE_URL = "https://agents.zazmic.com/api" # Execute task response = requests.post( f"{BASE_URL}/tasks", headers={ "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" }, json={ "endpointId": "endpoint_id_here", "params": {"message": "Hello, agent!"} } ) task = response.json() task_id = task["taskId"] # Poll for completion while True: response = requests.get( f"{BASE_URL}/tasks/{task_id}", headers={"Authorization": f"Bearer {API_KEY}"} ) task_status = response.json() if task_status["status"] == "completed": print("Result:", task_status["response"]) break elif task_status["status"] == "failed": print("Error:", task_status.get("error")) break time.sleep(2) # Wait 2 seconds before polling again

JavaScript/Node.js

const API_KEY = 'your_api_key_here'; const BASE_URL = 'https://agents.zazmic.com/api'; async function executeTask() { // Execute task const response = await fetch(`${BASE_URL}/tasks`, { method: 'POST', headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ endpointId: 'endpoint_id_here', params: { message: 'Hello, agent!' } }) }); const { taskId } = await response.json(); // Poll for completion while (true) { const statusResponse = await fetch(`${BASE_URL}/tasks/${taskId}`, { headers: { 'Authorization': `Bearer ${API_KEY}` } }); const task = await statusResponse.json(); if (task.status === 'completed') { console.log('Result:', task.response); break; } else if (task.status === 'failed') { console.error('Error:', task.error); break; } await new Promise(resolve => setTimeout(resolve, 2000)); } } executeTask();

Next Steps

Need Help?

  • Browse the API Reference for detailed documentation
  • Check error responses in the Errors section