POST · Modifier avec OAuth
Rédigé par Red Blue
Mis à jour le
POST /api/v1/tickets/delegated/commands
operationId : tickets_delegated_command
Accès | Permission | Consentements OAuth |
|---|---|---|
OAuth : délégation d’un équipier pour l’API | support.write | api:connect, support:write |
KHONY_ORIGIN est l’origine HTTPS de votre application Khony, sans chemin final. Remplacez les identifiants de l’exemple par ceux de vos ressources autorisées. Les données de réponse ci-dessous illustrent le format ; elles ne sont pas le résultat d’un appel à votre organisation.
Paramètres et en-têtes
Nom | Emplacement | Requis | Type et contraintes |
|---|---|---|---|
idempotency-key | header | Oui | string ; uuid |
Champs du corps JSON
Nom | Emplacement | Requis | Type et contraintes |
|---|---|---|---|
productId | JSON | Oui | string |
request | JSON | Oui | object |
Variantes de la requête
Sélecteur | Valeur | Autres champs requis dans request |
|---|---|---|
request.operation | "create" | title |
request.operation | "create_typed" | conversationId, typeId, catalogRevision, contextRevision, draft |
request.operation | "edit_typed" | ticketId, expectedRevision |
request.operation | "status" | ticketId, status, expectedStatus |
request.operation | "priority" | ticketId, priority, expectedPriority |
request.operation | "assign" | ticketId, assigneeUserId, expectedAssigneeUserId |
request.operation | "note" | ticketId |
request.operation | "link_conversation" | ticketId, conversationId, linked |
request.operation | "link_tracker" | trackerTicketId, ticketId, linked |
request.operation | "conversation_status" | conversationId, status, expectedTicketId, expectedStatus |
request.operation | "definition_create" | expectedCatalogRevision, definition |
request.operation | "catalog_save" | catalog |
request.operation | "defaults_save" | expectedRevision, settings |
Choisissez une variante et respectez son schéma complet : les contraintes des champs optionnels et les unions imbriquées restent applicables.
Exemple de requête
curl --request POST "$KHONY_ORIGIN/api/v1/tickets/delegated/commands" \
--header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
--header 'idempotency-key: 0198f886-9f71-4000-8000-000000000010' \
--header 'Content-Type: application/json' \
--data-raw '{
"productId": "product_01k3w8d7vhe008000000000001",
"request": {
"operation": "create",
"title": "Diagnostic de l’import",
"description": "## Contexte\n\nVérifier le **fichier** avant reprise.",
"category": "backoffice",
"priority": "normal",
"shareWithRequester": false
}
}'Réponse de succès · HTTP 200
{
"data": {
"id": "ticket_01k3w8d7vhe008000000000002",
"productId": "product_01k3w8d7vhe008000000000001",
"number": 42,
"status": "new",
"priority": "normal",
"assigneeUserId": null,
"updatedAt": "2026-10-23T10:00:00.000Z"
}
}Schéma complet du corps JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"productId": {
"type": "string",
"pattern": "^product_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"request": {
"oneOf": [
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "create"
},
"title": {
"$ref": "#/$defs/__schema0"
},
"description": {
"default": "",
"$ref": "#/$defs/__schema1"
},
"descriptionDocument": {
"$ref": "#/$defs/__schema2"
},
"category": {
"type": "string",
"enum": [
"customer",
"backoffice",
"tracker"
]
},
"priority": {
"$ref": "#/$defs/__schema4"
},
"contactId": {
"type": "string",
"pattern": "^contact_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"companyId": {
"type": "string",
"pattern": "^company_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"conversationId": {
"$ref": "#/$defs/__schema5"
},
"shareWithRequester": {
"default": false,
"type": "boolean"
}
},
"required": [
"operation",
"title"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "create_typed"
},
"conversationId": {
"$ref": "#/$defs/__schema5"
},
"typeId": {
"type": "string",
"pattern": "^ticket_type_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"catalogRevision": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"contextRevision": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"draft": {
"$ref": "#/$defs/__schema6"
}
},
"required": [
"operation",
"conversationId",
"typeId",
"catalogRevision",
"contextRevision",
"draft"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"$ref": "#/$defs/__schema8"
},
"ticketId": {
"$ref": "#/$defs/__schema9"
},
"expectedRevision": {
"$ref": "#/$defs/__schema10"
},
"statusId": {
"$ref": "#/$defs/__schema11"
},
"draft": {
"$ref": "#/$defs/__schema12"
}
},
"required": [
"operation",
"ticketId",
"expectedRevision"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "status"
},
"ticketId": {
"$ref": "#/$defs/__schema9"
},
"status": {
"$ref": "#/$defs/__schema13"
},
"expectedStatus": {
"$ref": "#/$defs/__schema13"
},
"message": {
"type": "string",
"maxLength": 100000
},
"messageDocument": {
"$ref": "#/$defs/__schema2"
}
},
"required": [
"operation",
"ticketId",
"status",
"expectedStatus"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "priority"
},
"ticketId": {
"$ref": "#/$defs/__schema9"
},
"priority": {
"$ref": "#/$defs/__schema4"
},
"expectedPriority": {
"$ref": "#/$defs/__schema4"
}
},
"required": [
"operation",
"ticketId",
"priority",
"expectedPriority"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "assign"
},
"ticketId": {
"$ref": "#/$defs/__schema9"
},
"assigneeUserId": {
"anyOf": [
{
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
{
"type": "null"
}
]
},
"expectedAssigneeUserId": {
"anyOf": [
{
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
{
"type": "null"
}
]
}
},
"required": [
"operation",
"ticketId",
"assigneeUserId",
"expectedAssigneeUserId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "note"
},
"ticketId": {
"$ref": "#/$defs/__schema9"
},
"message": {
"default": "",
"type": "string",
"maxLength": 100000
},
"messageDocument": {
"$ref": "#/$defs/__schema2"
}
},
"required": [
"operation",
"ticketId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "link_conversation"
},
"ticketId": {
"$ref": "#/$defs/__schema9"
},
"conversationId": {
"$ref": "#/$defs/__schema5"
},
"linked": {
"type": "boolean"
}
},
"required": [
"operation",
"ticketId",
"conversationId",
"linked"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "link_tracker"
},
"trackerTicketId": {
"$ref": "#/$defs/__schema9"
},
"ticketId": {
"$ref": "#/$defs/__schema9"
},
"linked": {
"type": "boolean"
}
},
"required": [
"operation",
"trackerTicketId",
"ticketId",
"linked"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "conversation_status"
},
"conversationId": {
"$ref": "#/$defs/__schema5"
},
"status": {
"$ref": "#/$defs/__schema13"
},
"expectedTicketId": {
"anyOf": [
{
"$ref": "#/$defs/__schema9"
},
{
"type": "null"
}
]
},
"expectedStatus": {
"anyOf": [
{
"$ref": "#/$defs/__schema13"
},
{
"type": "null"
}
]
}
},
"required": [
"operation",
"conversationId",
"status",
"expectedTicketId",
"expectedStatus"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "definition_create"
},
"expectedCatalogRevision": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"definition": {
"oneOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "type"
},
"value": {
"type": "object",
"properties": {
"name": {
"$ref": "#/$defs/__schema14"
},
"icon": {
"$ref": "#/$defs/__schema15"
},
"color": {
"$ref": "#/$defs/__schema16"
},
"category": {
"$ref": "#/$defs/__schema17"
},
"description": {
"$ref": "#/$defs/__schema18"
},
"titlePlaceholder": {
"$ref": "#/$defs/__schema19"
},
"descriptionPlaceholder": {
"$ref": "#/$defs/__schema20"
},
"visibility": {
"$ref": "#/$defs/__schema21"
},
"segmentIds": {
"$ref": "#/$defs/__schema22"
},
"agentEnabled": {
"$ref": "#/$defs/__schema24"
},
"customerEnabled": {
"$ref": "#/$defs/__schema25"
},
"archived": {
"$ref": "#/$defs/__schema26"
},
"fields": {
"$ref": "#/$defs/__schema27"
},
"statusIds": {
"$ref": "#/$defs/__schema29"
},
"initialStatusId": {
"$ref": "#/$defs/__schema31"
}
},
"required": [
"name",
"icon",
"category",
"description",
"titlePlaceholder",
"descriptionPlaceholder",
"visibility",
"segmentIds",
"agentEnabled",
"archived",
"fields",
"statusIds",
"initialStatusId"
],
"additionalProperties": false
}
},
"required": [
"kind",
"value"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "field"
},
"value": {
"type": "object",
"properties": {
"label": {
"$ref": "#/$defs/__schema14"
},
"kind": {
"$ref": "#/$defs/__schema32"
},
"placeholder": {
"$ref": "#/$defs/__schema33"
},
"internal": {
"$ref": "#/$defs/__schema34"
},
"answerVisible": {
"$ref": "#/$defs/__schema35"
},
"options": {
"$ref": "#/$defs/__schema36"
},
"archived": {
"$ref": "#/$defs/__schema38"
}
},
"required": [
"label",
"kind",
"placeholder",
"internal",
"answerVisible",
"options",
"archived"
],
"additionalProperties": false
}
},
"required": [
"kind",
"value"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "status"
},
"value": {
"type": "object",
"properties": {
"label": {
"$ref": "#/$defs/__schema14"
},
"color": {
"$ref": "#/$defs/__schema39"
},
"behavior": {
"$ref": "#/$defs/__schema40"
},
"archived": {
"$ref": "#/$defs/__schema41"
}
},
"required": [
"label",
"color",
"behavior",
"archived"
],
"additionalProperties": false
}
},
"required": [
"kind",
"value"
],
"additionalProperties": false
}
]
}
},
"required": [
"operation",
"expectedCatalogRevision",
"definition"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "catalog_save"
},
"catalog": {
"type": "object",
"properties": {
"version": {
"type": "number",
"const": 1
},
"revision": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"types": {
"maxItems": 100,
"type": "array",
"items": {
"$ref": "#/$defs/__schema42"
}
},
"fields": {
"maxItems": 200,
"type": "array",
"items": {
"$ref": "#/$defs/__schema43"
}
},
"statuses": {
"minItems": 1,
"maxItems": 100,
"type": "array",
"items": {
"$ref": "#/$defs/__schema44"
}
}
},
"required": [
"version",
"revision",
"types",
"fields",
"statuses"
],
"additionalProperties": false
}
},
"required": [
"operation",
"catalog"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"operation": {
"type": "string",
"const": "defaults_save"
},
"expectedRevision": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
},
"settings": {
"type": "object",
"properties": {
"ticketDefaultCategory": {
"$ref": "#/$defs/__schema45"
},
"ticketDefaultPriority": {
"$ref": "#/$defs/__schema46"
},
"ticketDefaultStatus": {
"$ref": "#/$defs/__schema47"
},
"ticketAssignToCreator": {
"$ref": "#/$defs/__schema48"
}
},
"additionalProperties": false
}
},
"required": [
"operation",
"expectedRevision",
"settings"
],
"additionalProperties": false
}
]
}
},
"required": [
"productId",
"request"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"type": "string",
"minLength": 2,
"maxLength": 240
},
"__schema1": {
"type": "string",
"maxLength": 100000
},
"__schema2": {
"$ref": "#/$defs/__schema3"
},
"__schema3": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/__schema3"
}
},
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema3"
}
}
]
},
"__schema4": {
"type": "string",
"enum": [
"low",
"normal",
"high",
"urgent"
]
},
"__schema5": {
"type": "string",
"pattern": "^support_conversation_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"__schema6": {
"type": "object",
"properties": {
"title": {
"$ref": "#/$defs/__schema0"
},
"description": {
"default": "",
"$ref": "#/$defs/__schema1"
},
"descriptionDocument": {
"$ref": "#/$defs/__schema2"
},
"answerDocuments": {
"type": "object",
"propertyNames": {
"type": "string",
"pattern": "^ticket_field_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"additionalProperties": {
"$ref": "#/$defs/__schema2"
}
},
"answers": {
"default": {},
"type": "object",
"propertyNames": {
"type": "string",
"pattern": "^ticket_field_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"additionalProperties": {
"anyOf": [
{
"type": "string",
"maxLength": 100000
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"maxItems": 30,
"type": "array",
"items": {
"$ref": "#/$defs/__schema7"
}
}
]
}
}
},
"required": [
"title"
],
"additionalProperties": false
},
"__schema7": {
"type": "string",
"maxLength": 500
},
"__schema8": {
"type": "string",
"const": "edit_typed"
},
"__schema9": {
"type": "string",
"pattern": "^ticket_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"__schema10": {
"type": "integer",
"exclusiveMinimum": 0,
"maximum": 9007199254740991
},
"__schema11": {
"type": "string",
"pattern": "^ticket_status_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"__schema12": {
"$ref": "#/$defs/__schema6"
},
"__schema13": {
"type": "string",
"enum": [
"new",
"open",
"pending",
"resolved"
]
},
"__schema14": {
"type": "string",
"minLength": 1,
"maxLength": 120
},
"__schema15": {
"type": "string",
"enum": [
"ticket",
"bug",
"receipt",
"question",
"tools",
"flag"
]
},
"__schema16": {
"type": "string",
"enum": [
"neutral",
"blue",
"green",
"orange",
"purple",
"red"
]
},
"__schema17": {
"type": "string",
"enum": [
"customer",
"backoffice",
"tracker"
]
},
"__schema18": {
"type": "string",
"maxLength": 1000
},
"__schema19": {
"type": "string",
"maxLength": 240
},
"__schema20": {
"type": "string",
"maxLength": 1000
},
"__schema21": {
"type": "string",
"enum": [
"team",
"requester",
"company"
]
},
"__schema22": {
"maxItems": 30,
"type": "array",
"items": {
"$ref": "#/$defs/__schema23"
}
},
"__schema23": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"__schema24": {
"type": "boolean"
},
"__schema25": {
"type": "boolean"
},
"__schema26": {
"type": "boolean"
},
"__schema27": {
"maxItems": 30,
"type": "array",
"items": {
"$ref": "#/$defs/__schema28"
}
},
"__schema28": {
"type": "object",
"properties": {
"fieldId": {
"type": "string",
"pattern": "^ticket_field_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"required": {
"type": "boolean"
}
},
"required": [
"fieldId",
"required"
],
"additionalProperties": false
},
"__schema29": {
"minItems": 1,
"maxItems": 30,
"type": "array",
"items": {
"$ref": "#/$defs/__schema30"
}
},
"__schema30": {
"type": "string",
"pattern": "^ticket_status_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"__schema31": {
"type": "string",
"pattern": "^ticket_status_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"__schema32": {
"type": "string",
"enum": [
"text",
"long_text",
"number",
"select",
"multi_select",
"checkbox",
"date",
"file"
]
},
"__schema33": {
"type": "string",
"maxLength": 240
},
"__schema34": {
"type": "boolean"
},
"__schema35": {
"type": "boolean"
},
"__schema36": {
"maxItems": 50,
"type": "array",
"items": {
"$ref": "#/$defs/__schema37"
}
},
"__schema37": {
"type": "object",
"properties": {
"id": {
"$ref": "#/$defs/__schema14"
},
"label": {
"$ref": "#/$defs/__schema14"
}
},
"required": [
"id",
"label"
]
},
"__schema38": {
"type": "boolean"
},
"__schema39": {
"type": "string",
"enum": [
"neutral",
"blue",
"green",
"orange",
"purple",
"red"
]
},
"__schema40": {
"type": "string",
"enum": [
"new",
"open",
"pending",
"resolved"
]
},
"__schema41": {
"type": "boolean"
},
"__schema42": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^ticket_type_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"name": {
"$ref": "#/$defs/__schema14"
},
"icon": {
"$ref": "#/$defs/__schema15"
},
"color": {
"$ref": "#/$defs/__schema16"
},
"category": {
"$ref": "#/$defs/__schema17"
},
"description": {
"$ref": "#/$defs/__schema18"
},
"titlePlaceholder": {
"$ref": "#/$defs/__schema19"
},
"descriptionPlaceholder": {
"$ref": "#/$defs/__schema20"
},
"visibility": {
"$ref": "#/$defs/__schema21"
},
"segmentIds": {
"$ref": "#/$defs/__schema22"
},
"agentEnabled": {
"$ref": "#/$defs/__schema24"
},
"customerEnabled": {
"$ref": "#/$defs/__schema25"
},
"archived": {
"$ref": "#/$defs/__schema26"
},
"fields": {
"$ref": "#/$defs/__schema27"
},
"statusIds": {
"$ref": "#/$defs/__schema29"
},
"initialStatusId": {
"$ref": "#/$defs/__schema31"
}
},
"required": [
"id",
"name",
"icon",
"category",
"description",
"titlePlaceholder",
"descriptionPlaceholder",
"visibility",
"segmentIds",
"agentEnabled",
"archived",
"fields",
"statusIds",
"initialStatusId"
],
"additionalProperties": false
},
"__schema43": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^ticket_field_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"label": {
"$ref": "#/$defs/__schema14"
},
"kind": {
"$ref": "#/$defs/__schema32"
},
"placeholder": {
"$ref": "#/$defs/__schema33"
},
"internal": {
"$ref": "#/$defs/__schema34"
},
"answerVisible": {
"$ref": "#/$defs/__schema35"
},
"options": {
"$ref": "#/$defs/__schema36"
},
"archived": {
"$ref": "#/$defs/__schema38"
}
},
"required": [
"id",
"label",
"kind",
"placeholder",
"internal",
"answerVisible",
"options",
"archived"
],
"additionalProperties": false
},
"__schema44": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^ticket_status_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
},
"label": {
"$ref": "#/$defs/__schema14"
},
"color": {
"$ref": "#/$defs/__schema39"
},
"behavior": {
"$ref": "#/$defs/__schema40"
},
"archived": {
"$ref": "#/$defs/__schema41"
}
},
"required": [
"id",
"label",
"color",
"behavior",
"archived"
],
"additionalProperties": false
},
"__schema45": {
"type": "string",
"enum": [
"customer",
"backoffice",
"tracker"
]
},
"__schema46": {
"$ref": "#/$defs/__schema4"
},
"__schema47": {
"type": "string",
"enum": [
"new",
"open"
]
},
"__schema48": {
"type": "boolean"
}
}
}Schéma complet de la réponse
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"data": {
"$ref": "#/$defs/__schema0"
}
},
"required": [
"data"
],
"additionalProperties": false,
"$defs": {
"__schema0": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
},
{
"type": "array",
"items": {
"$ref": "#/$defs/__schema0"
}
},
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"$ref": "#/$defs/__schema0"
}
}
]
}
}
}Refus et reprise
Les statuts documentés pour cette opération sont 400, 401, 402, 403, 404, 409, 428, 429, 500, 503. Identifiez la cause avec error.code et, lorsqu’il est présent, error.reason. Une réponse 409 peut demander une relecture de révision ou signaler une commande incompatible ; une réponse 428 demande une confirmation humaine. Ne rejouez une écriture que selon son contrat.
Notes du contrat
{
"description": "Dedicated API OAuth bearer with api:connect and support:write. Same native commands, complete article documents and durable principal-scoped receipts as tickets_command; uses the actual teammate and its current Inbox visibility. A stable Idempotency-Key UUID is mandatory. Catalog/default settings still require native product administrator authority. Replays return the saved receipt and never reapply old edits; current access is checked again. Private ticket notes do not become customer messages."
}