API Reference
Helpdesk
Create helpdesk tickets from external sources like contact forms using the secret key, and read, search, reply to, annotate and update tickets, email someone from a help desk address, and manage drafts with a personal access token (e.g. from the CLI). Anything that writes acts as the token's user and needs help desk edit access.
Create a Ticket
/api/v1/helpdesk/tickets
Secret Key
10/min
Creates a new helpdesk conversation with an initial message. Finds or creates a contact by email and links to a company by email domain if one exists.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| subject | string | Yes | Ticket subject line |
| message | string | Yes | Message body (plain text) |
| string | Yes | Contact email address | |
| name | string | No | Contact name (defaults to email) |
| priority | string | No | low, normal, high, or urgent (defaults to none) |
Success Response (201)
{
"id": 42,
"subject": "Question about pricing",
"state": "new",
"priority": "normal",
"contact": {
"email": "visitor@example.com",
"name": "Visitor"
},
"created_at": "2026-02-21T10:30:00Z"
}
Error Responses
// 401 Unauthorized
{ "error": "Invalid API key" }
// 404 Not Found (helpdesk not enabled)
// 422 Unprocessable Entity
{ "error": "subject is required" }
{ "error": "message is required" }
{ "error": "email is required" }
{ "error": "priority must be one of: low, normal, high, urgent" }
// 429 Too Many Requests (rate limited)
Example
curl -X POST https://squirrelstack.app/api/v1/helpdesk/tickets \
-H "X-Api-Key: sk_live_your_secret_key" \
-H "Content-Type: application/json" \
-d '{
"subject": "Question about pricing",
"message": "Hi, I would like to know more about your pricing plans.",
"email": "visitor@example.com",
"name": "Visitor",
"priority": "normal"
}'
Send an Email
/api/v1/helpdesk/emails
PAT
20 req/min per token
Starts a conversation by emailing someone outside the account, from one of its help desk addresses. The email is sent as the token's user, who is assigned the conversation, through the account's verified sending domain. The recipient's reply threads back into the same conversation. Finds or creates the contact by email.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| from | string | Yes | One of the account's help desk email addresses |
| to | string | Yes | Recipient email address (one) |
| name | string | No | Recipient name, used if they aren't a contact yet |
| subject | string | Yes | Subject line |
| message | string | Yes | Message body (plain text) |
| priority | string | No | low, normal, high, or urgent |
| draft | boolean | No | true: save it for review in the app instead of sending |
Success Response (201)
{
"conversation_id": 57,
"subject": "Your open data feed",
"from": "TenFive <hello@tenfive.uk>",
"to": "operator@example.com",
"state": "assigned",
"draft": false,
"message_id": 903
}
The email is queued, not yet sent. Its delivery status shows on the conversation (GET /api/v1/tickets/:id).
Error Responses
// 401 Unauthorized (no personal access token)
{ "error": "Missing or malformed bearer token" }
// 403 Forbidden (no edit access to the help desk)
// 404 Not Found (helpdesk not enabled)
// 422 Unprocessable Entity
{
"error": "From must be one of this account's help desk addresses",
"errors": { "from": ["must be one of this account's help desk addresses"] }
}
// also: subject, message or to missing; to not an email address;
// no verified sending domain ("base"); unknown priority
// 429 Too Many Requests (rate limited)
Example
curl -X POST https://squirrelstack.app/api/v1/helpdesk/emails \
-H "Authorization: Bearer pat_your_token" \
-H "X-Account-Slug: your_account_slug" \
-H "Content-Type: application/json" \
-d '{
"from": "hello@tenfive.uk",
"to": "operator@example.com",
"name": "Sam Operator",
"subject": "Your open data feed",
"message": "Hi Sam, do you publish an open data feed of your charge points?"
}'
Reply to a Ticket
/api/v1/tickets/:id/replies
PAT
60 req/min per token
Replies to a ticket as the token's user, from the ticket's help desk address through the account's verified sending domain (or in the chat widget for chat tickets). With draft: true the reply is saved for review in the app instead of being sent.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| message | string | Yes | Reply body (plain text) |
| draft | boolean | No | true: save as a draft, don't send |
Success Response (201)
{
"id": 904,
"type": "email",
"body": "Here's the fix.",
"author": "Jane Agent",
"direction": "outbound",
"status": "sending",
"from": "Acme Support <support@acme.example.com>",
"to": "bob@example.com",
...
}
Message objects now include status on outbound email: sending, sent, failed or draft.
Error Responses
// 401 Unauthorized (no personal access token)
// 403 Forbidden (no edit access to the help desk)
// 404 Not Found (helpdesk not enabled, or not on this account)
// 422 Unprocessable Entity
{ "error": "Description can't be blank" }
{ "error": "This account has no verified sending domain" }
Example
curl -X POST https://squirrelstack.app/api/v1/tickets/42/replies \
-H "Authorization: Bearer pat_your_token" \
-H "X-Account-Slug: your_account_slug" \
-H "Content-Type: application/json" \
-d '{ "message": "Thanks, that is fixed now.", "draft": true }'
Add a Note to a Ticket
/api/v1/tickets/:id/notes
PAT
60 req/min per token
Adds an internal note as the token's user. Notes support @mentions and links to tickets and stories, as in the app.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| body | string | Yes | Note text (message is accepted too) |
Success Response (201)
{ "id": 905, "type": "note", "body": "Customer is on the old plan", "author": "Jane Agent", "created_at": "..." }
Update a Ticket
/api/v1/tickets/:id
PAT
60 req/min per token
Closes or reopens a ticket, assigns it or sets its priority. Send only the fields to change. As in the app, assigning makes a ticket assigned (reopening it if closed) and unassigning makes it new.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| state | string | No | open, waiting or closed |
| assignee_id | integer | null | No | A member of the account (see GET /api/v1/members), or null to unassign |
| priority | string | null | No | low, normal, high, urgent, or null to clear |
Success Response (200)
{ "ticket": { "id": 42, "state": "closed", "priority": "high", "assignee": null, ... } }
Error Responses
// 401 Unauthorized (no personal access token)
// 403 Forbidden (no edit access to the help desk)
// 404 Not Found (helpdesk not enabled, or not on this account)
// 422 Unprocessable Entity
{ "error": "state must be one of: open, waiting, closed" }
{ "error": "assignee_id must be a member of this account" }
Drafts
Replies and new emails saved with draft: true, or with "Save draft" in the app. They show on the conversation with Send, Edit and Discard, and under Drafts in the help desk, so someone can review what an agent wrote before it goes out. Anyone with help desk edit access can manage any draft on the account.
/api/v1/helpdesk/drafts
PAT
60 req/min per token
Lists the account's drafts, oldest first, each with its ticket.
Success Response (200)
{
"drafts": [
{
"id": 904,
"type": "email",
"body": "Thanks, that is fixed now.",
"author": "Jane Agent",
"status": "draft",
"to": "bob@example.com",
"ticket_id": 42,
"ticket_subject": "Billing question",
...
}
]
}
/api/v1/helpdesk/drafts/:id
PAT
60 req/min per token
Changes a draft's text. Takes message.
/api/v1/helpdesk/drafts/:id/send
PAT
60 req/min per token
Sends a draft as it stands, from the address the ticket would use now. It takes the send time as its own. Returns the message, with status sending (or sent, for chat).
/api/v1/helpdesk/drafts/:id
PAT
60 req/min per token
Discards a draft. Returns 204.
Error Responses
// 401 Unauthorized (no personal access token)
// 403 Forbidden (no edit access to the help desk)
// 404 Not Found (helpdesk not enabled, or not on this account)
// (also when the message isn't a draft any more, e.g. already sent)
// 422 Unprocessable Entity (send)
{ "error": "This account has no verified sending domain" }
List Tickets
/api/v1/tickets
Secret Key / PAT
120 req/min per token
Lists helpdesk tickets for the account, most recently updated first (or by relevance when searching). Returns open tickets (new, assigned and waiting) by default.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| state | string | No | open (default), new, assigned, waiting, closed, or all |
| priority | string | No | low, normal, high, or urgent |
| q | string | No | Search subjects and message text (results ranked by relevance) |
| contact | string | No | Only this contact's tickets, by email |
| drafts | boolean | No | true: only tickets with a draft waiting |
| limit | integer | No | Max tickets to return, 1–100 (defaults to 50) |
Success Response (200)
{
"tickets": [
{
"id": 42,
"subject": "Billing question",
"state": "assigned",
"priority": "high",
"source": "email",
"contact": { "id": 7, "email": "bob@example.com", "name": "Bob Jones" },
"assignee": { "id": 5, "name": "Jane Agent" },
"created_at": "2026-02-21T10:30:00Z",
"updated_at": "2026-02-21T11:05:00Z",
"messages_count": 3
}
]
}
assignee is null when the ticket is unassigned.
Error Responses
// 401 Unauthorized
{ "error": "Invalid or revoked token" }
// 404 Not Found (helpdesk not enabled)
// 422 Unprocessable Entity
{ "error": "state must be one of: open, all, new, assigned, waiting, closed" }
// 429 Too Many Requests (rate limited)
Example
curl https://squirrelstack.app/api/v1/tickets?state=open \
-H "Authorization: Bearer pat_your_token" \
-H "X-Account-Slug: your_account_slug"
Get a Ticket
/api/v1/tickets/:id
Secret Key / PAT
120 req/min per token
Returns a single ticket with its summary and full message history (inbound and outbound emails plus internal notes) in chronological order.
Success Response (200)
{
"ticket": {
"id": 42,
"subject": "Billing question",
"state": "assigned",
"priority": "high",
"source": "email",
"contact": { "id": 7, "email": "bob@example.com", "name": "Bob Jones" },
"assignee": { "id": 5, "name": "Jane Agent" },
"created_at": "2026-02-21T10:30:00Z",
"updated_at": "2026-02-21T11:05:00Z",
"summary": "Customer is querying a charge on their latest invoice.",
"messages": [
{
"id": 101,
"type": "email",
"body": "I have a question about my latest bill.",
"author": "Bob Jones",
"created_at": "2026-02-21T10:30:00Z",
"direction": "inbound",
"subject": "Billing question",
"from": "bob@example.com",
"to": "support@acme.example.com",
"received_at": "2026-02-21T10:30:00Z"
}
]
}
}
Message objects use the same shape as List Messages on a Ticket below — email messages include a files array when attachments are present, and notes omit the email-only fields.
Error Responses
// 401 Unauthorized
{ "error": "Invalid or revoked token" }
// 404 Not Found (helpdesk not enabled, or ticket not on this account)
// 429 Too Many Requests (rate limited)
List Messages on a Ticket
/api/v1/helpdesk/tickets/:ticket_id/messages
Secret Key
60/min
Lists the messages on a ticket — inbound and outbound emails plus internal notes — in chronological order. The ticket ID is returned when creating a ticket.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| ticket_id | integer | Yes | Ticket ID (URL segment) |
| limit | integer | No | Max messages to return, 1–100 (defaults to 50) |
Success Response (200)
{
"messages": [
{
"id": 101,
"type": "email",
"body": "I have a question about my latest bill.",
"author": "Bob Jones",
"created_at": "2026-02-21T10:30:00Z",
"direction": "inbound",
"subject": "Billing question",
"from": "bob@example.com",
"to": "support@acme.example.com",
"received_at": "2026-02-21T10:30:00Z"
},
{
"id": 102,
"type": "note",
"body": "Internal: VIP customer, expedite.",
"author": "Jane Agent",
"created_at": "2026-02-21T10:35:00Z"
}
]
}
Email messages also include a files array (id, filename, content_type, byte_size) when attachments are present. Notes omit the email-only fields (direction, subject, from, to, received_at).
Error Responses
// 401 Unauthorized
{ "error": "Invalid API key" }
// 404 Not Found (helpdesk not enabled, or ticket not on this account)
// 429 Too Many Requests (rate limited)
Example
curl https://squirrelstack.app/api/v1/helpdesk/tickets/42/messages \
-H "X-Api-Key: sk_live_your_secret_key"
Get a Message
/api/v1/helpdesk/tickets/:ticket_id/messages/:id
Secret Key
60/min
Returns a single message on a ticket. The message must belong to the given ticket.
Success Response (200)
{
"id": 103,
"type": "email",
"body": "Thanks, looking into your bill now.",
"author": "Jane Agent",
"created_at": "2026-02-21T10:40:00Z",
"direction": "outbound",
"subject": "Re: Billing question",
"from": "support@acme.example.com",
"to": "bob@example.com",
"received_at": null,
"files": [
{ "id": 7, "filename": "invoice.pdf", "content_type": "application/pdf", "byte_size": 18234 }
]
}
Error Responses
// 401 Unauthorized
{ "error": "Invalid API key" }
// 404 Not Found (helpdesk not enabled, or message not on this ticket)
// 429 Too Many Requests (rate limited)