---
updatedAt: 2026-12-02T11:18:40.000Z
agentTools:
  projectIndex: https://developers.edesk.com/llms.txt
---

# Generate Ticket Summary

Have eDesk AI write a new summary of a ticket and return it. By default the summary is also added to the ticket, as when an agent generates one in the ticket view in eDesk: it shows in the ticket's messages as an `AiSummary` message and becomes the ticket's `summary`. Send `add_to_ticket` false to only get the summary back, leaving the ticket unchanged. The body is optional; one that is not JSON (a form, for example) is refused with a 400.

The summary covers the conversation since the last summary added to the ticket, that summary included, or the whole conversation when the ticket has none. It is written in the eDesk language of the account's admin user, the user API tokens act as. Each call writes a new summary, which takes several seconds, and longer for a long conversation.

`summary` is null when eDesk AI could not write one: the ticket has nothing to summarise, or the AI service did not answer (try again later). Nothing is added to the ticket then.

Needs full access to Tickets, and an account whose plan includes eDesk AI: otherwise a 403. A ticket that does not exist returns a 404, and one the token cannot access a 403.


# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "eDesk Open API",
    "version": "2.0",
    "description": "The eDesk OpenAPI allows you to interact with eDesk programmatically.\n\nA token acts as the account's admin user. A token from an AI assistant connection acts as the user who\nconnected it, with that user's access in eDesk: lists show what the user sees there, and a request the user\ncould not make in eDesk is refused with a 403 that says why or, for `sender_user_id` and `custom_fields`, with\nthe error code those fields document.\n\nThe below table defines the validation error codes that this API may return.\n\n| Error Code      | Description                                        |\n| --------------- | -------------------------------------------------- |\n| 4001            | Missing required field                             |\n| 4002            | Not able to find an object                         |\n| 4003            | Must be unique value                               |\n| 4004            | User can not access an object                      |\n| 4005            | Must be a numeric value                            |\n| 4006            | Must be an array                                   |\n| 4007            | Must be one of the allowed values                  |\n| 4008            | Must be a string                                   |\n| 4009            | Must be a boolean                                  |\n| 4010            | Must be a valid date                               |\n| 4011            | Must be a valid file url                           |\n| 4012            | Must be a valid image url                          |\n| 4013            | Related channel type is not supported              |\n| 4014            | Mismatch between sales order and channel           |\n| 4015            | Mismatch between client and channels               |\n| 4016            | Templates limit exceeded                           |\n| 4017            | Mismatch between sales order and sales order item  |\n| 4018            | Custom field value must match the type             |\n| 4019            | Each attachment must match format AttachmentRequest|\n| 4020            | Must be less or equal characters                   |\n| 4021            | Must be an email                                   |\n| 4022            | Shouldn't reach the message items limit            |\n| 4023            | Required for the channel type of this ticket        |\n| 4024            | Channel is not set up to send messages              |\n| 4025            | Must contain an allowed number of items             |\n| 4026            | Must be a cursor returned for the same filters and order |\n| 4027            | Cannot be combined with cursor                     |\n| 4028            | Must name one custom field: its id (GET /custom-fields), or a name no other field has |\n| 4029            | Must be a date within the allowed range            |\n| 4030            | Not available for the report type                  |\n| 4031            | Changes users' ticket access: send confirm_access_change=true to go ahead |\n| 4032            | WhatsApp's 24-hour window has closed: reply with a template from the eDesk app |\n"
  },
  "servers": [
    {
      "url": "https://api.edesk.com/v1",
      "description": "Main (production) endpoint"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/tickets/{ticketId}/summary": {
      "post": {
        "tags": [
          "Tickets"
        ],
        "summary": "Generate Ticket Summary",
        "description": "Have eDesk AI write a new summary of a ticket and return it. By default the summary is also added to the ticket, as when an agent generates one in the ticket view in eDesk: it shows in the ticket's messages as an `AiSummary` message and becomes the ticket's `summary`. Send `add_to_ticket` false to only get the summary back, leaving the ticket unchanged. The body is optional; one that is not JSON (a form, for example) is refused with a 400.\n\nThe summary covers the conversation since the last summary added to the ticket, that summary included, or the whole conversation when the ticket has none. It is written in the eDesk language of the account's admin user, the user API tokens act as. Each call writes a new summary, which takes several seconds, and longer for a long conversation.\n\n`summary` is null when eDesk AI could not write one: the ticket has nothing to summarise, or the AI service did not answer (try again later). Nothing is added to the ticket then.\n\nNeeds full access to Tickets, and an account whose plan includes eDesk AI: otherwise a 403. A ticket that does not exist returns a 404, and one the token cannot access a 403.\n",
        "operationId": "createTicketSummary",
        "parameters": [
          {
            "in": "path",
            "name": "ticketId",
            "description": "Ticket ID to summarise",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TicketSummaryCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/TicketSummary_Get"
          },
          "400": {
            "$ref": "#/components/responses/ValidationErrorResponse"
          },
          "default": {
            "$ref": "#/components/responses/DefaultErrorResponse"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "responses": {
      "DefaultErrorResponse": {
        "description": "Default error response",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/BaseErrorResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "details": {
                          "type": "string",
                          "description": "Error details."
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "ValidationErrorResponse": {
        "description": "Validation error response",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/BaseErrorResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "details": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "errorCode": {
                                "$ref": "#/components/schemas/ErrorCodes"
                              },
                              "user_ids": {
                                "type": "array",
                                "items": {
                                  "type": "integer"
                                },
                                "description": "With 4031 (confirm_access_change): the users whose ticket access lists the tag.\n"
                              },
                              "unrestricted_user_ids": {
                                "type": "array",
                                "items": {
                                  "type": "integer"
                                },
                                "description": "With 4031 (confirm_access_change): the users the tag alone limits, who would then see every ticket.\n"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "TicketSummary_Get": {
        "description": "The summary eDesk AI wrote for the ticket",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/BaseResponse"
                },
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/TicketSummary"
                    }
                  }
                }
              ]
            }
          }
        }
      }
    },
    "schemas": {
      "TicketSummaryCreateRequest": {
        "type": "object",
        "properties": {
          "add_to_ticket": {
            "type": "boolean",
            "default": true,
            "description": "Whether to add the summary to the ticket as an AiSummary message. False only returns it, leaving the ticket unchanged.",
            "example": false
          }
        }
      },
      "TicketSummary": {
        "type": "object",
        "properties": {
          "ticket_id": {
            "type": "integer",
            "format": "int64",
            "description": "ID of the ticket summarised.",
            "example": 589114581
          },
          "summary": {
            "type": "string",
            "nullable": true,
            "description": "The summary, as plain text. Null when eDesk AI could not write one: nothing to summarise, or the AI service did not answer.",
            "example": "The customer asks for a refund of a damaged kettle. The agent asked for photos, which the customer sent."
          },
          "message_id": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "ID of the AiSummary message added to the ticket, as GET /messages/ID returns it. Null when the summary was not added: add_to_ticket false, or no summary.",
            "example": 1203384471
          }
        }
      },
      "BaseResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object"
          }
        }
      },
      "BaseErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "httpCode": {
                "type": "integer",
                "description": "Error code",
                "example": 500
              },
              "message": {
                "type": "string",
                "description": "Error short message"
              }
            }
          }
        }
      },
      "ErrorCodes": {
        "type": "string",
        "description": "Error code of each validation type, sent as a string of digits (e.g. \"4007\").",
        "enum": [
          "4001",
          "4002",
          "4003",
          "4004",
          "4005",
          "4006",
          "4007",
          "4008",
          "4009",
          "4010",
          "4011",
          "4012",
          "4013",
          "4014",
          "4015",
          "4016",
          "4017",
          "4018",
          "4019",
          "4020",
          "4021",
          "4022",
          "4023",
          "4024",
          "4025",
          "4026",
          "4027",
          "4028",
          "4029",
          "4030",
          "4031",
          "4032"
        ]
      }
    }
  }
}
```