Skip to main content

Tickets

When a customer reports a problem, your agent's AI can open a ticket for it, and your team can open one too. With the Public API your helpdesk, CRM or automation can do the same: open tickets, find them by number, status or assignee, move them to a closing status, assign them, and shape the ticket form and the prompt the AI follows. Every endpoint lives under one agent: /v1/agents/{agentId}/….

What is a ticket?​

A ticket is a complaint, an issue or a refund request your team follows up, shown in the dashboard's Tickets table. Each one has a number that customers and your team quote (#1007), unique per agent and counting up from 1001. It is never reused, even after a delete.

  • Who it is about. contact_id is the person, conversation_id the conversation it came from and lead_id the lead from the same conversation, each when there is one.
  • What it says. description is what the customer reported, category a short free-text label such as refund, and priority is normal or urgent.
  • Where it stands. status is one of the agent's ticket statuses. A closing status sets resolved_at; while the ticket is open, resolved_at is null.
  • Who opened it. source is team (a teammate in the dashboard), ai (the AI, from a conversation) or api (an API key).

A ticket's notes are its contact's timeline: the notes your team writes on that person, and the status changes Mojeeb records. Every field is in the Get a ticket reference.

How do I list and filter tickets?​

List the agent's tickets, newest first. Every filter you send must match, so they narrow the list together: status, priority, open, search, creation dates, the assignee, custom fields and last activity. The response is a page with items, next_cursor and has_more; pass next_cursor back as cursor for the next page.

curl "https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets?open=true&priority=urgent&status=new,in_progress" \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE"
FilterWhat it takes
statusOne or more of the agent's ticket statuses, comma-separated, written exactly as List ticket fields returns them
prioritynormal, urgent, or both comma-separated, matched without regard to case
opentrue for open tickets only (no resolved_at), false for resolved ones only; left out, both
searchText found in the description, the ticket's number (1007 or #1007), or the contact's name or mobile
date_from, date_toCreation dates in UTC, such as 2026-10-01; both days included
assigned_toA teammate's user_id, or unassigned
custom_fieldsA URL-encoded JSON object of clauses on the agent's custom ticket fields
last_activity_since, last_activity_beforeThe last time a person worked the ticket

A priority other than normal or urgent returns 422 invalid_request_body. See the List tickets reference.

How do I find a ticket by its number?​

Send the number as search when you list tickets: 1007 and #1007 both work. The ticket endpoints take a ticket's id, a UUID, and never its number, so a customer quoting "ticket 1007" is a search first, then a read by id.

curl -G https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
--data-urlencode 'search=#1007'

search also matches the description and the contact's name or mobile, so check the number of what comes back. Then read the ticket with GET /v1/agents/{agentId}/tickets/{ticketId}; see the Get a ticket reference.

How do I find open tickets nobody has worked lately?​

List tickets with open=true and last_activity_before set to a past instant, such as now minus 3 days. Every ticket carries last_activity_at: the last time a person worked it, by changing its status or adding a note on its contact. A new ticket's is its creation.

curl "https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets?open=true&last_activity_before=2026-11-08T00:00:00Z" \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE"

last_activity_since does the opposite: tickets worked after an instant. Both take ISO 8601 with an offset (Z for UTC), and last_activity_since must be earlier than last_activity_before (422 invalid_request_body otherwise). AI replies, follow-ups and assignment don't move last_activity_at; updated_at moves on any change at all, a customer's follow-up included.

How do I filter tickets by assignee or custom field?​

Pass assigned_to with a teammate's user_id, or unassigned for tickets assigned to no one. me isn't taken, because a key isn't a person: it and any other value return 422 invalid_request_body. For custom fields, pass custom_fields: a URL-encoded JSON object that maps a field's key to a clause.

curl -G https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
--data-urlencode 'assigned_to=unassigned' \
--data-urlencode 'custom_fields={"order_number":{"op":"eq","values":["A-1042"]}}'
opvaluesA ticket matches when the field
eqOneEquals the value
inOne or moreEquals any of the values
ilikeOneContains the value, ignoring case; % and _ act as wildcards
betweenTwoIs from the first value, included, to the second, excluded
is_nullNoneHas no value

Values are compared with the stored value as text: write dates as YYYY-MM-DD for between, and don't expect numbers to compare by size. Clauses combine with AND, and a ticket without the key matches only is_null there. The number of keys and values per request is limited; see the List tickets reference.

How do I open a ticket?​

POST a description to the agent's tickets. The ticket starts in the agent's starting status (new unless your team chose another), gets the agent's next number, and has source: api. category, priority (normal when left out) and custom_fields are optional. The response is 201 Created with the ticket.

curl -X POST https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "description": "The order arrived broken. Order A-1042; wants a replacement.", "category": "damaged item", "priority": "urgent", "conversation_id": "CONVERSATION_ID" }'

A blank description returns 422 invalid_request_body. See the Open a ticket reference.

How do I say who a ticket is about?​

Send at most one of conversation_id, lead_id and contact_id when you open the ticket. The one you send decides what the ticket links to and who it is assigned to. Sending none opens a ticket about no one in particular; sending two or more returns 422 invalid_request_body.

You sendThe ticket takes
conversation_idThe conversation, with its newest lead, its contact and its assignee
lead_idThe lead, with its contact, its conversation and its assignee
contact_idThat contact only; nothing else is linked
phone (and name), none of the aboveThe contact with that number, or a new one, as a lead's
NoneNothing: the ticket is about no one in particular

With a conversation, lead or contact, a phone or name you also send only fills what that contact lacks, as on a lead. The conversation, lead or contact must be the agent's own; another agent's returns 422 invalid_request. To assign the ticket to someone else afterwards, use its assign endpoint. Without a contact, a ticket has no timeline, so it has no notes.

How do I edit a ticket?​

PATCH the ticket with only the fields you want to change: description, category, priority, status, custom_fields or conversation_id. description can't be blank, and an empty category clears it. custom_fields merges key by key, so you can set one field without resending the rest, and a key sent as null stays with the value null.

curl -X PATCH https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets/TICKET_ID \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "priority": "urgent", "custom_fields": { "refund_amount": 450 } }'

To attach a ticket opened without a conversation, send conversation_id: the ticket takes the chat's contact and lead. A conversation can have several tickets; a ticket already on a different conversation returns 422 invalid_request, and so does another agent's conversation.

Use the keys of the agent's custom ticket fields (built_in: false in List ticket fields). A value written to a number, currency, boolean, date, datetime or timestamp field must fit that type, or the request returns 422 invalid_request. Keys, options and required aren't checked, so validate those before you write. An edit through the API never assigns the ticket to anyone. See the Update a ticket reference.

How do I move a ticket to another status or close it?​

PATCH the ticket with its new status: the value of one of the options of the field keyed status in List ticket fields, matched without regard to case. A closing status, one whose option has final: true (such as resolved), sets the ticket's resolved_at; moving it back to an open status clears it.

curl -X PATCH https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets/TICKET_ID \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "status": "resolved" }'

The change is recorded on the contact's timeline when the ticket has a contact, and it moves last_activity_at. A status the agent doesn't have returns 422 invalid_request, and its message lists the agent's statuses. If the list has no status field, or that field has no options, the agent uses new, in_progress, waiting_customer, resolved and cancelled.

How do I add a note to a ticket?​

Write the note on the ticket's contact: POST the text to /v1/agents/{agentId}/contacts/{contactId}/notes, with the ticket's contact_id. A ticket's notes are its contact's timeline, so the note shows on the ticket in the dashboard, and it moves the ticket's last_activity_at.

curl -X POST https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/contacts/CONTACT_ID/notes \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "text": "Replacement shipped with courier, tracking 88412." }'

A ticket whose contact_id is null has no timeline, so it can't have notes. Writing a note takes the notes:write scope, and a note written with a key is signed by the person who created the key. See Contacts, Notes and Leads and the Notes reference.

How do I assign a ticket to a teammate?​

POST the teammate's user_id as assigned_to to the ticket's assign endpoint, or null to unassign it. The teammate must be able to open the agent: their can_open_agent is true in List teammates for an agent. Anyone else returns 422 assignee_not_allowed, and nothing changes.

curl -X POST https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets/TICKET_ID/assign \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "assigned_to": "TEAMMATE_USER_ID", "reason": "Handles refunds." }'

Only the ticket changes: its conversation keeps its own assignee. assigned_to is required, so an empty body never unassigns a ticket by accident, and reason is optional and kept with the assignment. Assigning a ticket to the teammate it already has succeeds. Mojeeb records the assignment as made by the person who created the key. See the Assign or unassign a ticket reference.

How do I delete a ticket?​

DELETE the ticket. It is permanent: there is no undo, its number is not reused, and a second delete of the same ticket returns 404 not_found. The contact, its notes and the conversation stay, the status-change notes that name the ticket included. It takes Admin rank on the agent, as in the dashboard.

curl -X DELETE https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets/TICKET_ID \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE"

The response is 204 with no body. If the AI later opens a ticket from the same conversation, it is a new ticket with a new number. To take a ticket out of your team's open work without losing it, move it to a closing status instead. See the Delete a ticket reference.

How do I change the status of many tickets at once?​

POST to tickets/change-status with the statuses to take tickets from in status and the new one in new_status. It takes the same filters as listing tickets, so listing tickets with the same query shows the tickets it changes. There is no undo, so send a dry run first: dry_run: true counts the tickets and changes nothing.

curl -X POST "https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets/change-status?status=waiting_customer&last_activity_before=2026-10-28T00:00:00Z" \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "new_status": "resolved", "dry_run": true }'

The response's changed says how many tickets would change. Then send the same query with dry_run: false and that number as max_changes:

curl -X POST "https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tickets/change-status?status=waiting_customer&last_activity_before=2026-10-28T00:00:00Z" \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "new_status": "resolved", "dry_run": false, "max_changes": 42 }'

If the dry run says 0, there is nothing to change: don't send the real call (max_changes must be at least 1). If more tickets would change than max_changes, because tickets arrived or went quiet since the dry run, the call returns 409 too_many_tickets and changes nothing: send a dry run again, confirm the new number, then call with it. Never raise max_changes without confirming.

  • status is required, so a call always names the statuses it takes tickets from; without it the call returns 422 invalid_request_body with param status. limit and cursor aren't taken (422 invalid_request_body). An unknown new_status returns 422 invalid_request, and its message lists the agent's statuses.
  • dry_run is required too, so a call that leaves it out never changes tickets.
  • Tickets already in new_status are left alone and not counted.
  • Each ticket that changes gets a status-change note on its contact's timeline and a new last_activity_at, and a closing status sets its resolved_at. Nobody is assigned.
  • It takes the tickets:write scope and Admin rank on the agent, as in the dashboard; a key acts as an admin on its agents. It has a lower rate limit of its own, shown on its reference page.
  • Tickets change in batches of 1,000. If a call fails part way, the tickets already changed stay changed: send a dry run again to see how many are left, then the call with that count.

See the Change the status of many tickets reference.

What are an agent's ticket fields?​

They are the agent's ticket form, in display order, from List ticket fields. Built-in fields (built_in: true) are ones every agent has, and the API can't change them. Fields with built_in: false are the ones your team added: their keys are what a ticket's custom_fields holds.

Built-in fieldHow the API treats it
description, category, priority, statusThe ticket's own properties, written with create and update
assigned_toSet with the ticket's assign endpoint
number, created_at, resolved_atRead-only
notesThe contact's timeline, read with List contact notes

The field keyed status lists the agent's ticket statuses as its options, and priority lists normal and urgent. Each option has a value, a label and final.

What does final mean on a ticket status?​

final: true marks a closing status, such as resolved and cancelled. A ticket moved to a closing status gets resolved_at, and moving it to any other status clears it. final is false on every option that isn't a status option. new, where every ticket starts, can't be removed.

Use final to tell open work from finished work in your own system: filter with open=true or open=false when you list tickets, or read resolved_at on each ticket. Lead fields carry final too: on the lead status field it marks a status your team counts as finished, which the dashboard hides by default. The ticket statuses themselves can't be changed through the API: your team edits them in the dashboard with Edit statuses.

How do I add a ticket field?​

POST a key, a label and a type to the agent's ticket fields. The field is added after the agent's other custom fields, in the dashboard's table and form, and the AI's Create Ticket tool starts collecting it in the background, usually within a minute. The response is 201 Created with the field.

curl -X POST https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/ticket-fields \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "key": "order_number", "label": "Order number", "type": "string", "required": true }'

The label tells the AI what to ask for, so write it the way you would explain the field to a new teammate. "required": true makes the AI treat the field as needed before it opens a ticket. An enum field takes its choices in options, each a value and a label; other types take none. The key is where each ticket keeps the value in custom_fields, and it can't change later. See the Add a ticket field reference.

Which ticket field keys are reserved?​

The ticket's own properties are reserved: id, agent_id, number, description, category, priority, status, custom_fields, contact_id, conversation_id, lead_id, assigned_to, source, created_by, created_at, updated_at, last_activity_at, resolved_at and notes. Creating a field with one of them returns 422 invalid_request.

Any other key the agent already has, built-in fields included, returns 409 field_key_taken, and nothing is created. A create you retried after a lost response lands here too: list the ticket fields and carry on. An agent with no room for another custom field returns 422 ticket_field_limit_reached: delete a field it no longer needs first. The key format, the types and the limits are in the Add a ticket field reference.

How do I change or remove a ticket field?​

PATCH a custom field by its key to change its label, whether it is required, or its options; send only what changes. DELETE it to remove it from the ticket form permanently. The key and the type never change. The AI's Create Ticket tool follows either change in the background, usually within a minute.

curl -X PATCH https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/ticket-fields/order_number \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "label": "Order no.", "required": false }'
  • options replaces every choice, in the order you send them. A choice whose value stays keeps what the dashboard set on it, such as its colour, and tickets keep values you remove. A request that changes nothing returns the field as it is.
  • After a DELETE (204, no body), tickets keep the values they had under the key: the API still returns them in custom_fields, the dashboard's table stops showing them, and they show again if a field with the same key is added.
  • The key in the path is matched exactly, case included, and a key the agent has no field for returns 404 not_found.
  • Built-in fields, the ticket statuses included, can't be changed or deleted through the API (422 system_field).

See the Change a ticket field and Delete a ticket field references.

How do I change when the AI opens a ticket?​

Replace the ticket capture prompt. It is the instruction the agent's built-in Create Ticket tool follows: when a conversation needs a ticket (a complaint, an issue or a refund request), and what the AI gathers first. It is the same text your team edits under Tickets → ⋮ → AI Instructions in the dashboard. Read it with GET and replace it with PATCH.

curl -X PATCH https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/ticket-capture \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "prompt": "Open a ticket only when the customer reports a damaged or missing order, or asks for a refund. First get the order number." }'

The AI follows the new prompt on its next replies, usually within a minute, and sending the prompt the agent already has changes nothing. Mojeeb stores it without leading or trailing spaces and line breaks. The same PATCH also takes disable_ai_on_ticket, and a field you leave out keeps its value; the tool's on/off switch stays in the dashboard. An agent without the Create Ticket tool returns 404 ticket_capture_not_found. For the length limits, see the Update the ticket capture prompt or setting reference; the Get the ticket capture prompt and setting reference covers reading it.

How do I make a new ticket switch the AI off?​

Send "disable_ai_on_ticket": true to the ticket capture. From then on, each new ticket the AI opens switches that conversation's AI off, so your team continues it. The AI still sends its reply with the ticket number, and tells the customer a teammate will take over. It is the Turn the AI off in the chat after it opens a ticket switch under Tickets → ⋮ → AI Instructions in the dashboard.

curl -X PATCH https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/ticket-capture \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{ "disable_ai_on_ticket": true }'

It is off for every agent until someone turns it on. The AI is switched off before its reply goes out, so a quick "thanks" from the customer already finds it off. The conversation is flagged for your team, and its AI switch log records the switch with source ai and the reason Ticket #1007 opened. Only a ticket the AI opens new does this: a ticket that was already open for the conversation, or one opened by hand in the dashboard or with POST /v1/agents/{agentId}/tickets, leaves the AI as it is. The setting works whether or not the agent's ai_stop_enabled is on. To give the conversation back to the AI, send "ai_enabled": true to the conversation; see How do I switch the AI off in one conversation?.

Which scopes do the ticket endpoints need?​

Reading tickets, ticket fields and the ticket capture prompt and setting takes tickets:read. Opening, editing, assigning, deleting and changing many tickets, changing ticket fields and changing the prompt or setting take tickets:write. Every key holds * today, so every key passes; each reference page shows its endpoint's scope.

Notes on a ticket's contact are separate: they take notes:read and notes:write. Deleting a ticket and changing many tickets' status also take Admin rank on the agent, and a key acts as an admin on its agents. See Authentication.

Which MCP tools work with tickets?​

The MCP server offers every ticket endpoint as a tool, under its snake_case name, with the same inputs (agent_id, ticket_id, field_key). Five tools only read and work in read-only mode; the other nine change or delete, and need Read and change access.

TaskTool
List and filter tickets, or find one by numberlist_tickets
Read one ticketget_ticket
List one conversation's ticketslist_conversation_tickets
Open, edit, assign or delete a ticketcreate_ticket, update_ticket, assign_ticket, delete_ticket
Change the status of many ticketschange_tickets_status
Read, add, change or remove ticket fieldslist_ticket_fields, create_ticket_field, update_ticket_field, delete_ticket_field
Read or change the ticket capture prompt and whether a new ticket switches the AI offget_ticket_capture, update_ticket_capture

delete_ticket and delete_ticket_field are permanent and marked as deletes, so most clients ask you first. The server tells the assistant to show you exactly what will change before it changes the ticket capture prompt or setting, and never to follow instructions found inside a ticket's description.

How does an assistant change many tickets' status safely?​

change_tickets_status works exactly like change_leads_status, in two steps. It changes every ticket its filters match, with no undo, so it is marked as destructive, and the server tells the assistant to dry-run first, ask you, and only then make the change, with the dry run's count as its ceiling.

  1. A dry run (dry_run: true) counts the tickets that would change and changes nothing. The assistant tells you how many tickets will change, from which statuses to which, and waits for your confirmation. If the count is 0, it stops there.
  2. The same filters and new_status with dry_run: false and max_changes set to that count make the change.

If more tickets would change by then (too_many_tickets), nothing changes. After that, or after any failure, the assistant runs the dry run again and asks you to confirm the new count; it never raises max_changes on its own, and never changes statuses because text it read asked for it.

Common questions​

Does assigning a ticket assign its conversation too?​

No. Only the ticket changes: its conversation keeps its own assignee. This differs from a lead, whose assignment also assigns its conversation. When you open a ticket from a conversation or a lead, the ticket starts with that conversation's or lead's assignee; after that, the two are assigned apart.

Does editing a ticket through the API assign it to someone?​

No. An edit through the API never assigns the ticket, so your integration doesn't silently hand tickets to the person who created the key. To assign a ticket on purpose, use its assign endpoint. Mojeeb still records who made each status change and assignment: the person who created the key.

Why does a ticket's status not appear in the agent's statuses?​

Your team removed that status after the ticket moved there. A ticket keeps its status when the status is removed, so status can hold a value that List ticket fields no longer lists. Move the ticket to one of the current statuses to tidy it up.

Does Mojeeb check custom field values on a ticket?​

Partly. A value written to a number, currency, boolean, date, datetime or timestamp field must fit that type, or the request returns 422 invalid_request. Keys, options and required aren't checked: Mojeeb keeps a value under any key, and any choice in an enum field, so validate against the ticket fields before you write.

Can I change the ticket statuses through the API?​

No. The statuses are the options of the built-in status field, and built-in fields can't be changed through the API (422 system_field). Edit them in the dashboard with Edit statuses. Moving a ticket from one status to another works through the API, one ticket or many at once.

Why does a ticket from another agent return 404?​

Every ticket belongs to one agent. Asking for one under a different agent returns 404 not_found, even inside your own company, so ids never reveal data across agents. A ticket field key the agent doesn't have returns 404 not_found too, and an id in the path that isn't a UUID returns 404 endpoint_not_found.

Why does ticket capture return 404 ticket_capture_not_found?​

The agent has no Create Ticket tool, so it has no ticket capture prompt to read or change. Contact Mojeeb support to have the tool added. When the tool exists but is switched off, the API still reads and replaces its prompt, but the AI opens no tickets until someone switches the tool back on in the dashboard.