Skip to content

Tickets

MC0RE edited this page Jul 20, 2026 · 2 revisions

Tickets

Manage tickets (support cases) in Teamleader Focus.

Overview

The Tickets resource manages support cases linked to customers, with messages (replies, internal notes, imported messages) and project linkage.

Access via Teamleader::tickets().

Project linkage (v1.2.8): A ticket links to a legacy milestone via milestone_id, or to a new-projects project via project_id β€” either one, but not both. Passing both throws InvalidArgumentException.

No deletion: there is no delete endpoint for tickets.

Endpoint

tickets

Capabilities

Capability Supported
Pagination βœ… Supported
Filtering βœ… Supported
Sorting ❌ Not supported
Sideloading ❌ Not supported
Creation βœ… Supported
Update βœ… Supported
Deletion ❌ Not supported

Methods

list(array $filters = [], array $options = [])

use McoreServices\TeamleaderSDK\Facades\Teamleader;

$tickets = Teamleader::tickets()->list();

$tickets = Teamleader::tickets()->list([
    'relates_to'  => ['type' => 'company', 'id' => 'company-uuid'],
    'project_ids' => ['project-uuid'],
]);

info(mixed $id, mixed $includes = null)

$ticket = Teamleader::tickets()->info('ticket-uuid');

create(array $data)

Required: subject, customer (type + id), ticket_status_id.

Optional: assignee (type: user), participant (customer must be a company), description, custom_fields, initial_reply (automatic | disabled), and project linkage β€” milestone_id or project_id (mutually exclusive).

$ticket = Teamleader::tickets()->create([
    'subject'          => 'Login issue',
    'customer'         => ['type' => 'company', 'id' => 'company-uuid'],
    'ticket_status_id' => 'status-uuid',
    'assignee'         => ['type' => 'user', 'id' => 'user-uuid'],
    'project_id'       => 'project-uuid',   // new-projects linkage (v1.2.8)
]);

update(mixed $id, array $data)

The id is injected into the request body. Accepts the same optional fields as create(), including milestone_id / project_id (nullable β€” pass null to unlink; still mutually exclusive).

Teamleader::tickets()->update('ticket-uuid', [
    'subject'          => 'Updated subject',
    'ticket_status_id' => 'new-status-uuid',
]);

// Move a ticket from a legacy milestone to a new-projects project
Teamleader::tickets()->update('ticket-uuid', [
    'milestone_id' => null,
    'project_id'   => 'project-uuid',
]);

Message methods

Method Description
addReply(string $ticketId, string $body, ?string $ticketStatusId = null, array $attachments = []) Customer-facing reply
addInternalMessage(string $ticketId, string $body, ...) Internal note
importMessage(string $ticketId, string $body, string $sentByType, string $sentById, string $sentAt, ...) Import an existing message (e.g. from email)
getMessage(string $messageId) Fetch a single message
listMessages(string $ticketId, array $filters = [], array $options = []) List a ticket's messages
Teamleader::tickets()->addReply('ticket-uuid', '<p>Thank you for your inquiry…</p>', 'status-uuid');
Teamleader::tickets()->addInternalMessage('ticket-uuid', '<p>Internal note…</p>');
$messages = Teamleader::tickets()->listMessages('ticket-uuid');

sentByType for importMessage() must be one of company, contact, user.


Helper Methods

Method Filter applied
forCustomer(string $type, string $id, ...) relates_to
forProjects(array $projectIds, ...) project_ids
byIds(array $ids, ...) ids
excludeStatuses(array $statusIds, ...) exclude.status_ids
$tickets = Teamleader::tickets()->forCustomer('company', 'company-uuid');
$tickets = Teamleader::tickets()->forProjects(['project-uuid-1', 'project-uuid-2']);

Filters

Filter Type Description
ids array Filter by ticket UUIDs
relates_to object Related entity ({type: contact|company, id})
project_ids array Filter by project UUIDs
exclude.status_ids array Status UUIDs to exclude

Enumerated Values

  • customer types: contact, company
  • initial_reply: automatic, disabled
  • message types: customer, internal, thirdParty
  • importMessage sent_by types: company, contact, user

Related Resources

  • Companies β€” Ticket customer / participant
  • Contacts β€” Ticket customer
  • Projects β€” project_id linkage (new projects)
  • Users β€” Ticket assignees

Clone this wiki locally