Creating a ticket in Alga PSA is straightforward once you have the right IDs. The key point is that tickets reference existing boards, board-scoped statuses, priorities, and clients, so the usual workflow is lookup first, then create.
Ticket statuses are board-scoped, so you cannot safely hard-code a status without knowing which board you are using.
curl -X GET "https://algapsa.com/api/v1/boards" \
-H "X-API-Key: $ALGA_API_KEY"
curl -X GET "https://algapsa.com/api/v1/tickets/statuses?board_id=$BOARD_ID" \
-H "X-API-Key: $ALGA_API_KEY"curl -X GET "https://algapsa.com/api/v1/tickets/priorities" \
-H "X-API-Key: $ALGA_API_KEY"
curl -X GET "https://algapsa.com/api/v1/clients?page=1&limit=25" \
-H "X-API-Key: $ALGA_API_KEY"curl -X POST "https://algapsa.com/api/v1/tickets" \
-H "Content-Type: application/json" \
-H "X-API-Key: $ALGA_API_KEY" \
-d '{
"title": "VPN disconnects every 15 minutes",
"board_id": "$BOARD_ID",
"client_id": "$CLIENT_ID",
"status_id": "$STATUS_ID",
"priority_id": "$PRIORITY_ID",
"tags": ["network", "vpn"]
}'type CreateTicketPayload = {
title: string;
board_id: string;
client_id: string;
status_id: string;
priority_id: string;
assigned_to?: string;
category_id?: string;
tags?: string[];
};
async function createTicket(payload: CreateTicketPayload) {
const response = await fetch('https://algapsa.com/api/v1/tickets', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': process.env.ALGA_API_KEY!,
},
body: JSON.stringify(payload),
});
const result = await response.json();
if (!response.ok) {
throw new Error(result.error?.message ?? 'Ticket creation failed');
}
return result.data;
}