Create Ticket
const url = 'https://api.aymaragents.com/public/v1/tickets';const options = { method: 'POST', headers: {'X-API-Key': '<X-API-Key>', 'Content-Type': 'application/json'}, body: '{"customerId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","leadId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","conversationId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","subject":"example","assignedTo":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","comment":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.aymaragents.com/public/v1/tickets \ --header 'Content-Type: application/json' \ --header 'X-API-Key: <X-API-Key>' \ --data '{ "customerId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "leadId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "conversationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "subject": "example", "assignedTo": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "comment": "example" }'Create a ticket against one of the tenant’s own customers/leads/conversations (SPEC_API_PUBLICA.md §2.5).
At least one of customerId/leadId/conversationId is required -> 422 otherwise.
Each id GIVEN, foreign or unknown, -> 404, zero persistence. assignedTo, when given,
must resolve to an assignable tenant user -> 404 otherwise, zero persistence.
Idempotency-Key (API-3, D-API-4) is optional: a repeat with the SAME header and SAME body
replays the original response without creating a second ticket; the SAME header with a
DIFFERENT body -> 422 IDEMPOTENCY_KEY_REUSE_MISMATCH.
Permiso necesario: tenant:tickets.manage
Authorizations
Sección titulada «Authorizations»Request Bodyrequired
Sección titulada «Request Bodyrequired»POST /public/v1/tickets body – at least one of customerId/leadId/
conversationId is required (enforced by TicketService, same rule as the internal
endpoint, SPEC_TCK.md D1).
object
Examplegenerated
{ "customerId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "leadId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "conversationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "subject": "example", "assignedTo": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "comment": "example"}Responses
Sección titulada «Responses»Successful Response
A single ticket with its embedded comment thread – same shape as the internal
TicketOut (nothing curated away: every field here is already an id/status/text a third
party legitimately needs to track its own ticket).
object
One comment in a ticket’s thread – same shape as the internal TicketCommentOut.
object
Examplegenerated
{ "id": "example", "customerId": "example", "leadId": "example", "conversationId": "example", "subject": "example", "status": "example", "createdBy": "example", "assignedTo": "example", "createdAt": "example", "updatedAt": "example", "comments": [ { "id": "example", "authorUserId": "example", "body": "example", "createdAt": "example" } ]}Validation Error
object
object
object
Examplegenerated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}