Method: https://oms.tpl.com.br/api/put/create_ticket

Objective: Creates a new ticket in Zoho Desk linked to the authenticated client. Accepts two payload formats: dynamic form (with layoutId/departmentId) or traditional form (with titulo/descricao/departamento_id/categoria_id). To simplify the request, use the get/ticket_fields_department endpoint which returns a ready-to-use JSON template — just fill in the fields. Also supports sending base64 attachments along with the ticket.
          
            
Method: PUT or POST
URL: https://oms.tpl.com.br/api/put/create_ticket

Authentication
Base64 token generated by /api/get/auth endpoint ("auth" field)

Ready-to-use template
Use the get/ticket_fields_department endpoint providing the desired department name or ID.
It returns a "template" field with a ready-to-use JSON payload for this endpoint, including departmentId, layoutId, contactId and all custom fields (cf) for the department.
Simply copy the template, fill in the subject, description, priority, category and custom fields, then send it to this endpoint.

Request JSON (Dynamic Form - with layout)
{
"auth": "BASE64_TOKEN",
"subject": "Ticket subject",
"description": "Detailed ticket description",
"departmentId": "123456789",
"departmentName": "TECNOLOGIA",
"layoutId": "987654321",
"priority": "Medium",
"status": "Open",
"category": "Category Name",
"cf": {
"cf_numero_do_pedido": "12345",
"cf_numero_da_nota_fiscal": "67890",
"cf_custom_field": "value"
},
"anexos": [
{
"nome_arquivo": "document.pdf",
"tipo_arquivo": "application/pdf",
"arquivo_base64": "JVBERi0xLjQK..."
}
]
}

Note: departmentId can be omitted if departmentName is provided.
Note: layoutId can be omitted (the default department layout will be fetched automatically).
Note: To get the ready-to-use template with all department fields, use get/ticket_fields_department.

Request JSON (Traditional Form - without layout)
{
"auth": "BASE64_TOKEN",
"titulo": "Ticket subject",
"descricao": "Detailed description",
"departamento_id": "123456789",
"categoria_id": "Category Name",
"prioridade": "Medium",
"nome": "Contact Name",
"email": "contact@company.com",
"telefone": "11999999999",
"empresa": "Company Name",
"observacoes": "Additional notes"
}

Required fields (traditional): titulo, descricao, departamento_id, categoria_id
Required fields (dynamic): subject, description + (departmentId or departmentName)

Response JSON (Success - HTTP 200/201)
{
"success": true,
"ticket_id": "123456789012345678",
"ticket_number": "12345",
"numero_pedido": "12345",
"numero_nf": "67890",
"message": "Chamado criado com sucesso"
}

Response JSON (Error)
HTTP 400:
{ "success": false, "error": "Campo obrigatório ausente: subject" }

HTTP 401:
{ "success": false, "error": "Credenciais inválidas" }

HTTP 403:
{ "success": false, "error": "Cliente bloqueado" }

HTTP 405:
{ "success": false, "error": "Método não permitido" }

HTTP 500:
{ "success": false, "error": "Erro ao criar chamado no Zoho" }