Skip to main content

Code Examples

Copy-paste examples for the most common API operations. All examples assume you have already authenticated and have your session token and workspace ID ready. For cURL examples, we assume:
  • Session cookie saved to cookies.txt (via curl -c cookies.txt during sign-in)
  • Workspace ID exported as $TENANT_ID
For Node.js examples, we assume:
  • sessionToken contains your session_token value
  • tenantId contains your workspace UUID

Workflows

List All Workflows

cURL
curl https://api.agentixx.io/api/workflows \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID"
Node.js
const res = await fetch('https://api.agentixx.io/api/workflows', {
  headers: {
    'Cookie': `session_token=${sessionToken}`,
    'x-tenant-id': tenantId,
  },
});
const { items } = await res.json();

Create a Workflow

cURL
curl -X POST https://api.agentixx.io/api/workflows \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{"name": "My New Workflow"}'
Node.js
const res = await fetch('https://api.agentixx.io/api/workflows', {
  method: 'POST',
  headers: {
    'Cookie': `session_token=${sessionToken}`,
    'x-tenant-id': tenantId,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ name: 'My New Workflow' }),
});
const workflow = await res.json();

Publish a Workflow

cURL
curl -X POST https://api.agentixx.io/api/workflows/{workflowId}/publish \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{}'
Node.js
const res = await fetch(
  `https://api.agentixx.io/api/workflows/${workflowId}/publish`,
  {
    method: 'POST',
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': tenantId,
      'Content-Type': 'application/json',
    },
    body: '{}',
  }
);

Contacts

List Contacts (with Pagination)

cURL
curl "https://api.agentixx.io/api/contacts?limit=20&offset=0" \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID"
Node.js
const res = await fetch(
  'https://api.agentixx.io/api/contacts?limit=20&offset=0',
  {
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': tenantId,
    },
  }
);
const { items, total } = await res.json();

Create a Contact

cURL
curl -X POST https://api.agentixx.io/api/contacts \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Jane Doe",
    "phone": "+14155551234"
  }'
Node.js
const res = await fetch('https://api.agentixx.io/api/contacts', {
  method: 'POST',
  headers: {
    'Cookie': `session_token=${sessionToken}`,
    'x-tenant-id': tenantId,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    name: 'Jane Doe',
    phone: '+14155551234',
  }),
});
const contact = await res.json();

Update a Contact

cURL
curl -X PATCH https://api.agentixx.io/api/contacts/{contactId} \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{"name": "Jane Smith"}'
Node.js
const res = await fetch(
  `https://api.agentixx.io/api/contacts/${contactId}`,
  {
    method: 'PATCH',
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': tenantId,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ name: 'Jane Smith' }),
  }
);

Conversations

List Conversations

cURL
curl "https://api.agentixx.io/api/conversations?limit=10&offset=0" \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID"
Node.js
const res = await fetch(
  'https://api.agentixx.io/api/conversations?limit=10&offset=0',
  {
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': tenantId,
    },
  }
);
const { items, total } = await res.json();

Get Conversation Messages

cURL
curl https://api.agentixx.io/api/conversations/{conversationId}/messages \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID"
Node.js
const res = await fetch(
  `https://api.agentixx.io/api/conversations/${conversationId}/messages`,
  {
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': tenantId,
    },
  }
);
const { messages } = await res.json();

Send a Message in a Conversation

cURL
curl -X POST https://api.agentixx.io/api/conversations/{conversationId}/messages \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{"body": "Hello! How can I help you today?"}'
Node.js
const res = await fetch(
  `https://api.agentixx.io/api/conversations/${conversationId}/messages`,
  {
    method: 'POST',
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': tenantId,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      body: 'Hello! How can I help you today?',
    }),
  }
);
Sending messages is subject to WhatsApp’s 24-hour customer service window. Messages can only be sent within 24 hours of the customer’s last inbound message. Outside this window, use approved message templates via broadcasts.

Runs

List Recent Runs

cURL
curl "https://api.agentixx.io/api/runs?limit=10&offset=0" \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID"
Node.js
const res = await fetch(
  'https://api.agentixx.io/api/runs?limit=10&offset=0',
  {
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': tenantId,
    },
  }
);
const { items, total } = await res.json();

Get Run Details and Steps

cURL
# Get run overview
curl https://api.agentixx.io/api/runs/{runId} \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID"

# Get execution steps
curl https://api.agentixx.io/api/runs/{runId}/steps \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID"
Node.js
// Get run overview
const runRes = await fetch(
  `https://api.agentixx.io/api/runs/${runId}`,
  {
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': tenantId,
    },
  }
);
const run = await runRes.json();

// Get execution steps
const stepsRes = await fetch(
  `https://api.agentixx.io/api/runs/${runId}/steps`,
  {
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': tenantId,
    },
  }
);
const { steps } = await stepsRes.json();

Replay a Run

cURL
curl -X POST https://api.agentixx.io/api/runs/{runId}/replay \
  -b cookies.txt \
  -H "x-tenant-id: $TENANT_ID" \
  -H "Content-Type: application/json" \
  -d '{}'
Node.js
const res = await fetch(
  `https://api.agentixx.io/api/runs/${runId}/replay`,
  {
    method: 'POST',
    headers: {
      'Cookie': `session_token=${sessionToken}`,
      'x-tenant-id': tenantId,
      'Content-Type': 'application/json',
    },
    body: '{}',
  }
);