Examples

API Examples

Working snippets for every live endpoint, in curl, Node.js and Python. All examples assume the API key is in TIXALLO_API_KEY — never hard-code keys in source files.

Conventions

  • Base URL: https://tixallo.com/api/v1.
  • Auth: every request needs Authorization: Bearer $TIXALLO_API_KEY.
  • All examples check the response status before parsing the body and use a request timeout in Python.
  • Never call the Tixallo API from a browser — your key would be exposed in network requests.

List tickets

GET /api/v1/tickets?limit=20 — newest first.

curl

curl -sS -o response.json -w "%{http_code}\n" \
  "https://tixallo.com/api/v1/tickets?limit=20" \
  -H "Authorization: Bearer $TIXALLO_API_KEY" \
  -H "Content-Type: application/json"

Node.js

// Node 18+ has fetch built-in.
const apiKey = process.env.TIXALLO_API_KEY;
if (!apiKey) throw new Error("TIXALLO_API_KEY is not set");

const res = await fetch("https://tixallo.com/api/v1/tickets?limit=20", {
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
});

if (!res.ok) {
  throw new Error(`Tixallo API error: ${res.status}`);
}

const { data } = await res.json();
console.log(`Fetched ${data.length} tickets`);

Python

import os
import requests

api_key = os.environ["TIXALLO_API_KEY"]

resp = requests.get(
    "https://tixallo.com/api/v1/tickets",
    params={"limit": 20},
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    timeout=10,
)
resp.raise_for_status()

payload = resp.json()
print(f"Fetched {len(payload['data'])} tickets")

Create a ticket

POST /api/v1/tickets — Tixallo resolves or creates the customer by customer_email within your workspace.

curl

curl -sS -X POST "https://tixallo.com/api/v1/tickets" \
  -H "Authorization: Bearer $TIXALLO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "subject": "Webhook delivery delayed",
    "description": "Our order.created webhook took 12s to fire.",
    "customer_email": "alex@example.com",
    "customer_name": "Alex Example",
    "priority": "high"
  }'

Node.js

const apiKey = process.env.TIXALLO_API_KEY;
if (!apiKey) throw new Error("TIXALLO_API_KEY is not set");

const res = await fetch("https://tixallo.com/api/v1/tickets", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    subject: "Webhook delivery delayed",
    description: "Our order.created webhook took 12s to fire.",
    customer_email: "alex@example.com",
    customer_name: "Alex Example",
    priority: "high",
  }),
});

if (res.status !== 201) {
  const detail = await res.text();
  throw new Error(`Create failed (${res.status}): ${detail}`);
}

const { data: ticket } = await res.json();
console.log("Created ticket", ticket.id, "#" + ticket.ticket_number);

Python

import os
import requests

api_key = os.environ["TIXALLO_API_KEY"]

resp = requests.post(
    "https://tixallo.com/api/v1/tickets",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    json={
        "subject": "Webhook delivery delayed",
        "description": "Our order.created webhook took 12s to fire.",
        "customer_email": "alex@example.com",
        "customer_name": "Alex Example",
        "priority": "high",
    },
    timeout=10,
)

if resp.status_code != 201:
    raise RuntimeError(f"Create failed ({resp.status_code}): {resp.text}")

ticket = resp.json()["data"]
print(f"Created ticket {ticket['id']} #{ticket['ticket_number']}")

Fetch a single ticket

GET /api/v1/tickets/{ticket_id} — returns the ticket plus its public conversation. Internal notes are never included.

curl

TICKET_ID="9f6c1a3e-2b8d-4e7f-9a1c-d4b2e6c8a1b3"

curl -sS "https://tixallo.com/api/v1/tickets/$TICKET_ID" \
  -H "Authorization: Bearer $TIXALLO_API_KEY"

Node.js

const apiKey = process.env.TIXALLO_API_KEY;
if (!apiKey) throw new Error("TIXALLO_API_KEY is not set");

const ticketId = "9f6c1a3e-2b8d-4e7f-9a1c-d4b2e6c8a1b3";

const res = await fetch(`https://tixallo.com/api/v1/tickets/${ticketId}`, {
  headers: { Authorization: `Bearer ${apiKey}` },
});

if (res.status === 404) {
  console.log("Ticket not found in this workspace");
} else if (!res.ok) {
  throw new Error(`Fetch failed: ${res.status}`);
} else {
  const { data: ticket } = await res.json();
  console.log(ticket.subject, "—", ticket.messages.length, "messages");
}

Python

import os
import requests

api_key = os.environ["TIXALLO_API_KEY"]
ticket_id = "9f6c1a3e-2b8d-4e7f-9a1c-d4b2e6c8a1b3"

resp = requests.get(
    f"https://tixallo.com/api/v1/tickets/{ticket_id}",
    headers={"Authorization": f"Bearer {api_key}"},
    timeout=10,
)

if resp.status_code == 404:
    print("Ticket not found in this workspace")
else:
    resp.raise_for_status()
    ticket = resp.json()["data"]
    print(ticket["subject"], "—", len(ticket["messages"]), "messages")

Add a message to a ticket

POST /api/v1/tickets/{ticket_id}/messages — appends a public, customer-attributed message and dispatches the ticket.message.created webhook.

curl

TICKET_ID="9f6c1a3e-2b8d-4e7f-9a1c-d4b2e6c8a1b3"

curl -sS -X POST "https://tixallo.com/api/v1/tickets/$TICKET_ID/messages" \
  -H "Authorization: Bearer $TIXALLO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "body": "Thanks — could you share a screenshot?" }'

Node.js

const apiKey = process.env.TIXALLO_API_KEY;
if (!apiKey) throw new Error("TIXALLO_API_KEY is not set");

const ticketId = "9f6c1a3e-2b8d-4e7f-9a1c-d4b2e6c8a1b3";

const res = await fetch(
  `https://tixallo.com/api/v1/tickets/${ticketId}/messages`,
  {
    method: "POST",
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      body: "Thanks — could you share a screenshot?",
    }),
  },
);

if (res.status !== 201) {
  throw new Error(`Message failed: ${res.status}`);
}

const { data: message } = await res.json();
console.log("Posted message", message.id);

Python

import os
import requests

api_key = os.environ["TIXALLO_API_KEY"]
ticket_id = "9f6c1a3e-2b8d-4e7f-9a1c-d4b2e6c8a1b3"

resp = requests.post(
    f"https://tixallo.com/api/v1/tickets/{ticket_id}/messages",
    headers={
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json",
    },
    json={"body": "Thanks — could you share a screenshot?"},
    timeout=10,
)

if resp.status_code != 201:
    raise RuntimeError(f"Message failed ({resp.status_code}): {resp.text}")

message = resp.json()["data"]
print("Posted message", message["id"])