Ir al contenido

Create Ticket

Ver como Markdown
POST
/public/v1/tickets
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

Media typeapplication/json
PublicCreateTicketRequest

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
customerId
Any of:
string format: uuid
leadId
Any of:
string format: uuid
conversationId
Any of:
string format: uuid
subject
required
Subject
string
>= 1 characters <= 500 characters
assignedTo
Any of:
string format: uuid
comment
Any of:
string
>= 1 characters

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"
}

Successful Response

Media typeapplication/json
PublicTicketOut

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
id
required
Id
string
customerId
Any of:
string
leadId
Any of:
string
conversationId
Any of:
string
subject
required
Subject
string
status
required
Status
string
createdBy
required
Createdby
string
assignedTo
Any of:
string
createdAt
required
Createdat
string
updatedAt
required
Updatedat
string
comments
Comments
Array<object>
PublicTicketCommentOut

One comment in a ticket’s thread – same shape as the internal TicketCommentOut.

object
id
required
Id
string
authorUserId
required
Authoruserid
string
body
required
Body
string
createdAt
required
Createdat
string

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

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object

Examplegenerated

{
"detail": [
{
"loc": [
"example"
],
"msg": "example",
"type": "example",
"input": "example",
"ctx": {}
}
]
}