{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-api/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"GetTicket","description":"Developer documentation for the WHMCS API — the","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"getticket","__idx":0},"children":["GetTicket"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Obtain a specific ticket"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"request-parameters","__idx":1},"children":["Request Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Required"},"children":["Required"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["action"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["\"GetTicket\""]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Required"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ticketnum"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A specific Client Ticket Number to find tickets for."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ticketid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A specific ticket ID to find tickets for (either $ticketnum or $ticketid is required)."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["repliessort"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ASC or DESC. The order to use to organise the ticket replies."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"response-parameters","__idx":2},"children":["Response Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["result"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The result of the operation: success or error"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["ticketid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The unique ID of the ticket."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["tid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The unique ticket number string displayed to end users."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["c"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The client unique access of the ticket."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["deptid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ID of the department the ticket belongs to."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["deptname"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The name of the department the ticket belongs to."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["userid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The user ID the ticket belongs to."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["contactid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The contact ID the ticket was opened by."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["name"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ticket submitter's name."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["email"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ticket submitter's email."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["requestor_name"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ticket submitter's name."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["requestor_type"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ticket submitter's type."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["requestor_email"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ticket submitter's email."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["cc"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The CC email addresses for the ticket."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["date"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The date the ticket was opened on. Format: Y-m-d H:i:s"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["subject"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The subject of the ticket."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["status"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The status of the ticket."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["priority"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The priority of the ticket."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["admin"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The name of the admin user who opened the ticket."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["lastreply"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The date the ticket was last replied to. Format: Y-m-d H:i:s"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["flag"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ID of the admin user a ticket is flagged to."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["service"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ID of the service associated with the ticket (Sx for services and Dx for domains)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["replies"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An array of replies on the ticket."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["notes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An array of notes on the ticket."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-request-curl","__idx":3},"children":["Example Request (CURL)"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$ch = curl_init();\ncurl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');\ncurl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS,\n    http_build_query(\n        array(\n            'action' => 'GetTicket',\n            // See https://developers.whmcs.com/api/authentication\n            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',\n            'password' => 'SECRET_OR_HASHED_PASSWORD',\n            'ticketid' => '1',\n            'responsetype' => 'json',\n        )\n    )\n);\ncurl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);\n$response = curl_exec($ch);\ncurl_close($ch);\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-request-local-api","__idx":4},"children":["Example Request (Local API)"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"$command = 'GetTicket';\n$postData = array(\n    'ticketid' => '1',\n);\n$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later\n\n$results = localAPI($command, $postData, $adminUsername);\nprint_r($results);\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-response-json","__idx":5},"children":["Example Response JSON"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"{\n    \"result\": \"success\",\n    \"ticketid\": \"1\",\n    \"tid\": \"516757\",\n    \"c\": \"KPqH7yG3\",\n    \"deptid\": \"1\",\n    \"deptname\": \"Sample Support Department\",\n    \"userid\": \"1\",\n    \"contactid\": \"0\",\n    \"name\": \"Cynthia Reilly\",\n    \"email\": \"testuser@whmcs.com\",\n    \"cc\": \"\",\n    \"date\": \"2016-01-01 06:26:29\",\n    \"subject\": \"This is a sample ticket\",\n    \"status\": \"Closed\",\n    \"priority\": \"Medium\",\n    \"admin\": \"\",\n    \"lastreply\": \"2016-01-01 06:30:16\",\n    \"flag\": \"0\",\n    \"service\": \"\",\n    \"replies\": {\n        \"reply\": [\n            {\n                \"replyid\": \"0\",\n                \"userid\": \"1\",\n                \"contactid\": \"0\",\n                \"name\": \"Cynthia Reilly\",\n                \"email\": \"testuser@whmcs.com\",\n                \"requestor_name\": \"Cynthia Reilly\",\n                \"requestor_email\": \"testuser@whmcs.com\",\n                \"requestor_type\": \"Owner\",\n                \"date\": \"2016-01-01 06:26:29\",\n                \"message\": \"Hey, \\r\\n\\r\\nThis is the first ticket message!\\r\\n\\r\\nThanks\\r\\n\\r\\nCynthia\",\n                \"attachment\": \"123456_attachment_name.png\",\n                \"attachments\": [\n                    {\n                        \"filename\": \"attachment_name.png\",\n                        \"index\": 0\n                    }\n                ],\n                \"attachments_removed\": true,\n                \"admin\": \"\"\n            },\n            {\n                \"replyid\": \"1\",\n                \"userid\": \"1\",\n                \"contactid\": \"0\",\n                \"name\": \"\",\n                \"email\": \"\",\n                \"requestor_name\": \"Demo Admin\",\n                \"requestor_email\": \"\",\n                \"requestor_type\": \"Operator\",\n                \"date\": \"2016-01-01 06:27:01\",\n                \"message\": \"Hello, \\r\\n\\r\\nThis is the first ticket reply by an admin user!\\r\\n\\r\\nThanks\\r\\n\\r\\nDemo Admin\",\n                \"attachment\": \"\",\n                \"attachments\": [\n                    []\n                ],\n                \"attachments_removed\": false,\n                \"admin\": \"Demo Admin\",\n                \"rating\": \"0\"\n            },\n            {\n                \"replyid\": \"2\",\n                \"userid\": \"1\",\n                \"contactid\": \"0\",\n                \"name\": \"\",\n                \"email\": \"\",\n                \"requestor_name\": \"Cynthia Reilly\",\n                \"requestor_email\": \"testuser@whmcs.com\",\n                \"requestor_type\": \"Owner\",\n                \"date\": \"2016-01-01 06:30:16\",\n                \"message\": \"Hey, \\r\\n\\r\\nThis is a second reply!\\r\\n\\r\\nThanks\\r\\n\\r\\nCynthia\",\n                \"attachment\": \"\",\n                \"attachments\": [\n                    []\n                ],\n                \"attachments_removed\": false,\n                \"admin\": \"\",\n                \"rating\": \"0\"\n            }\n        ]\n    },\n    \"notes\": {\n        \"note\": [\n            {\n                \"noteid\": \"1\",\n                \"date\": \"2016-01-01 06:26:42\",\n                \"message\": \"This is a ticket note\",\n                \"attachment\": \"\",\n                \"attachments\": [\n                    []\n                ],\n                \"attachments_removed\": false,\n                \"admin\": \"Demo Admin\"\n            }\n        ]\n    }\n}\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"version-history","__idx":6},"children":["Version History"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Version"},"children":["Version"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Changelog"},"children":["Changelog"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["1.0"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Initial Version"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["7.10"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Added new return parameter ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["attachments"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["8.0"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Added new return parameters ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["requestor_name"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["requestor_type"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["requestor_email"]},"."]}]}]}]}]}]},"headings":[{"value":"GetTicket","id":"getticket","depth":1},{"value":"Request Parameters","id":"request-parameters","depth":3},{"value":"Response Parameters","id":"response-parameters","depth":3},{"value":"Example Request (CURL)","id":"example-request-curl","depth":3},{"value":"Example Request (Local API)","id":"example-request-local-api","depth":3},{"value":"Example Response JSON","id":"example-response-json","depth":3},{"value":"Version History","id":"version-history","depth":3}],"frontmatter":{"title":"GetTicket","seo":{"title":"GetTicket"}},"lastModified":"2026-08-03T17:00:42.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/api-reference/getticket","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}