{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-api/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"GetProducts","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":"getproducts","__idx":0},"children":["GetProducts"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieve configured products matching provided criteria"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["NOTE: This API method is designed to be used in the building of custom order"," ","forms. As a result, only custom fields that have the 'Show on Order Form'"," ","setting enabled will be returned for a given product."]},{"$$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":["\"GetProducts\""]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Required"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["pid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int|string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Obtain a specific product id configuration. Can be a list of ids comma separated"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["gid"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Retrieve products in a specific group id"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["module"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Retrieve products utilising a specific module"]},{"$$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":["totalresults"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The total number of results available"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["startnumber"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The starting number for the returned results"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["numreturned"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["int"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The number of results returned"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["products"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["array"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["An array of products matching the criteria passed"]}]}]}]}]},{"$$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' => 'GetProducts',\n            // See https://developers.whmcs.com/api/authentication\n            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',\n            'password' => 'SECRET_OR_HASHED_PASSWORD',\n            'pid' => '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 = 'GetProducts';\n$postData = array(\n    'pid' => '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    \"totalresults\": 1,\n    \"products\": {\n        \"product\": [\n            {\n                \"pid\": 1,\n                \"gid\": 1,\n                \"type\": \"hostingaccount\",\n                \"name\": \"Best Hosting Plan\",\n                \"slug\": \"best-hosting-plan\",\n                \"product-url\": \"https:\\/\\/www.example.com\\/whmcs\\/product-group\\/best-hosting-plan\",\n                \"description\": \"This is our best hosting plan, with all the bells and whistles.\",\n                \"module\": \"cpanel\",\n                \"paytype\": \"recurring\",\n                \"allowqty\": 2,\n                \"quantity_available\": 0,\n                \"pricing\": {\n                    \"USD\": {\n                        \"prefix\": \"$\",\n                        \"suffix\": \" USD\",\n                        \"msetupfee\": \"0.00\",\n                        \"qsetupfee\": \"0.00\",\n                        \"ssetupfee\": \"0.00\",\n                        \"asetupfee\": \"0.00\",\n                        \"bsetupfee\": \"0.00\",\n                        \"tsetupfee\": \"0.00\",\n                        \"monthly\": \"25.99\",\n                        \"quarterly\": \"-1.00\",\n                        \"semiannually\": \"-1.00\",\n                        \"annually\": \"-1.00\",\n                        \"biennially\": \"-1.00\",\n                        \"triennially\": \"-1.00\"\n                    }\n                },\n                \"customfields\": {\n                    \"customfield\": [\n                        {\n                            \"id\": 2,\n                            \"name\": \"Secondary Contact\",\n                            \"description\": \"Would you like to provide a secondary point of contact?\",\n                            \"required\": \"\"\n                        }\n                    ]\n                },\n                \"configoptions\": {\n                    \"configoption\": [\n                        {\n                            \"id\": 4,\n                            \"name\": \"MultiPHP Services\",\n                            \"type\": \"3\",\n                            \"minqty\": 1,\n                            \"maxqty\": 10,\n                            \"options\": {\n                                \"option\": [\n                                    {\n                                        \"id\": 4,\n                                        \"name\": \"Include MultiPHP Options\",\n                                        \"rawName\": null,\n                                        \"recurring\": 0,\n                                        \"required\": null,\n                                        \"pricing\": {\n                                            \"USD\": {\n                                                \"msetupfee\": \"0.00\",\n                                                \"qsetupfee\": \"0.00\",\n                                                \"ssetupfee\": \"0.00\",\n                                                \"asetupfee\": \"0.00\",\n                                                \"bsetupfee\": \"0.00\",\n                                                \"tsetupfee\": \"0.00\",\n                                                \"monthly\": \"2.99\",\n                                                \"quarterly\": \"0.00\",\n                                                \"semiannually\": \"0.00\",\n                                                \"annually\": \"0.00\",\n                                                \"biennially\": \"0.00\",\n                                                \"triennially\": \"0.00\"\n                                            }\n                                        }\n                                    }\n                                ]\n                            }\n                        }\n                    ]\n                }\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":["8.3"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Added ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["slug"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["product_url"]}," in response"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["8.12"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Added ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["allowqty"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["quantity_available"]}," in response"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["8.12"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Added ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["minqty"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["maxqty"]}," to configurable options"]}]}]}]}]}]},"headings":[{"value":"GetProducts","id":"getproducts","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":"GetProducts","seo":{"title":"GetProducts"}},"lastModified":"2026-08-04T14:47:26.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/api-reference/getproducts","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}