POST · Modifier un Copilot hérité

Conversations : Modifier un Copilot hérité. Paramètres, accès et exemples de réponse.

Rédigé par Red Blue

Mis à jour le

Conversations

POST /api/v1/inbox/copilot

operationId : inbox_copilot_write

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.

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

"chat_send"

conversationId, turnId, message

request.operation

["review_prepare","command_request","review_reject"]

conversationId, commandId, draftIdentity, expectedDraftRevision, reviewedInternal, messageId

request.operation

"command_reject"

conversationId, commandId, decision

request.operation

"observation_feedback"

conversationId, messageId, surface, vote, expectedRevision

request.operation

"attachment_upload"

conversationId, name, contentType, dataBase64

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

Shell
curl --request POST "$KHONY_ORIGIN/api/v1/inbox/copilot" \
  --header "Authorization: Bearer $KHONY_ACCESS_TOKEN" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "productId": "product_01k3w8d7vhe008000000000001",
  "request": {
    "operation": "chat_send",
    "conversationId": "support_conversation_01k3w8d7vhe008000000000002",
    "turnId": "0198f886-9f71-7000-8000-000000000099",
    "message": "Summarize this case privately.",
    "composerDocument": {
      "type": "doc",
      "content": [
        {
          "type": "paragraph",
          "content": [
            {
              "type": "text",
              "text": "Diagnostic",
              "marks": [
                {
                  "type": "bold"
                }
              ]
            }
          ]
        },
        {
          "type": "callout",
          "attrs": {
            "variant": "info"
          },
          "content": [
            {
              "type": "paragraph",
              "content": [
                {
                  "type": "text",
                  "text": "Keep the original source document."
                }
              ]
            }
          ]
        },
        {
          "type": "table",
          "content": [
            {
              "type": "tableRow",
              "content": [
                {
                  "type": "tableHeader",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "Step"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "tableHeader",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "Result"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "type": "tableRow",
              "content": [
                {
                  "type": "tableCell",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "Read"
                        }
                      ]
                    }
                  ]
                },
                {
                  "type": "tableCell",
                  "content": [
                    {
                      "type": "paragraph",
                      "content": [
                        {
                          "type": "text",
                          "text": "Verified"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "type": "paragraph",
          "content": [
            {
              "type": "text",
              "text": "Documentation",
              "marks": [
                {
                  "type": "link",
                  "attrs": {
                    "href": "https://example.test/help"
                  }
                }
              ]
            }
          ]
        }
      ]
    }
  }
}'
Shell

Réponse de succès · HTTP 200

JSON
{
  "data": []
}
JSON
Schéma complet du corps JSON
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": {
              "$ref": "#/$defs/__schema0"
            },
            "conversationId": {
              "$ref": "#/$defs/__schema1"
            },
            "turnId": {
              "$ref": "#/$defs/__schema2"
            },
            "message": {
              "$ref": "#/$defs/__schema3"
            },
            "attachmentIds": {
              "$ref": "#/$defs/__schema4"
            },
            "composerDraft": {
              "$ref": "#/$defs/__schema6"
            },
            "composerDocument": {
              "$ref": "#/$defs/__schema7"
            }
          },
          "required": [
            "operation",
            "conversationId",
            "turnId",
            "message"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "operation": {
              "type": "string",
              "enum": [
                "review_prepare",
                "command_request",
                "review_reject"
              ]
            },
            "conversationId": {
              "$ref": "#/$defs/__schema1"
            },
            "commandId": {
              "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)$"
            },
            "draftIdentity": {
              "type": "string",
              "maxLength": 80000
            },
            "expectedDraftRevision": {
              "type": "integer",
              "minimum": 0,
              "maximum": 2147483646
            },
            "reviewedInternal": {
              "type": "boolean"
            },
            "reviewedDocumentHash": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "insertion": {
              "type": "object",
              "properties": {
                "from": {
                  "$ref": "#/$defs/__schema9"
                },
                "to": {
                  "$ref": "#/$defs/__schema10"
                },
                "replaceSelection": {
                  "$ref": "#/$defs/__schema11"
                }
              },
              "required": [
                "from",
                "to",
                "replaceSelection"
              ],
              "additionalProperties": false
            },
            "messageId": {
              "type": "string",
              "pattern": "^support_copilot_message_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            }
          },
          "required": [
            "operation",
            "conversationId",
            "commandId",
            "draftIdentity",
            "expectedDraftRevision",
            "reviewedInternal",
            "messageId"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "operation": {
              "type": "string",
              "const": "command_reject"
            },
            "conversationId": {
              "$ref": "#/$defs/__schema1"
            },
            "commandId": {
              "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)$"
            },
            "decision": {
              "type": "string",
              "enum": [
                "reject",
                "expire"
              ]
            }
          },
          "required": [
            "operation",
            "conversationId",
            "commandId",
            "decision"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "operation": {
              "type": "string",
              "const": "observation_feedback"
            },
            "conversationId": {
              "$ref": "#/$defs/__schema1"
            },
            "messageId": {
              "type": "string",
              "pattern": "^support_message_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
            },
            "surface": {
              "type": "string",
              "enum": [
                "support_copilot",
                "customer_agent"
              ]
            },
            "vote": {
              "type": "string",
              "enum": [
                "up",
                "down"
              ]
            },
            "reason": {
              "type": "string",
              "enum": [
                "facts",
                "sources",
                "tone",
                "length",
                "composition",
                "other"
              ]
            },
            "expectedRevision": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "operation",
            "conversationId",
            "messageId",
            "surface",
            "vote",
            "expectedRevision"
          ],
          "additionalProperties": false
        },
        {
          "type": "object",
          "properties": {
            "operation": {
              "type": "string",
              "const": "attachment_upload"
            },
            "conversationId": {
              "$ref": "#/$defs/__schema1"
            },
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "contentType": {
              "type": "string",
              "enum": [
                "image/png",
                "image/jpeg",
                "image/webp",
                "image/gif",
                "application/pdf",
                "text/plain",
                "text/markdown",
                "text/csv",
                "application/json",
                "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
              ]
            },
            "dataBase64": {
              "type": "string",
              "minLength": 4,
              "maxLength": 13333336
            }
          },
          "required": [
            "operation",
            "conversationId",
            "name",
            "contentType",
            "dataBase64"
          ],
          "additionalProperties": false
        }
      ]
    }
  },
  "required": [
    "productId",
    "request"
  ],
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "type": "string",
      "const": "chat_send"
    },
    "__schema1": {
      "type": "string",
      "pattern": "^support_conversation_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "__schema2": {
      "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)$"
    },
    "__schema3": {
      "type": "string",
      "maxLength": 4000
    },
    "__schema4": {
      "maxItems": 10,
      "type": "array",
      "items": {
        "$ref": "#/$defs/__schema5"
      }
    },
    "__schema5": {
      "type": "string",
      "pattern": "^attachment_[0-7][0123456789abcdefghjkmnpqrstvwxyz]{25}$"
    },
    "__schema6": {
      "type": "string",
      "maxLength": 8000
    },
    "__schema7": {
      "$ref": "#/$defs/__schema8"
    },
    "__schema8": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "null"
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/$defs/__schema8"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/$defs/__schema8"
          }
        }
      ]
    },
    "__schema9": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "__schema10": {
      "type": "integer",
      "minimum": 0,
      "maximum": 9007199254740991
    },
    "__schema11": {
      "type": "boolean"
    }
  }
}
JSON
Schéma complet de la réponse
JSON
{
  "$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"
          }
        }
      ]
    }
  }
}
JSON

Refus et reprise

Les statuts documentés pour cette opération sont 400, 401, 402, 403, 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
JSON
{
  "description": "Requires a dedicated API OAuth bearer for audience /api/v1 plus api:connect and the declared support scope, current product/organization consent, native permissions and source policies. No cookie or MCP-audience token fallback. Commercial admission is shared with the public API. Reuses native turn/command IDs, private attachments, draft revisions, model budgets and cancellation. Never sends a customer reply or approves a proposal. Approval, clearing and macro sharing remain verified human MCP operations."
}
JSON