{"id":10128,"date":"2024-06-10T12:42:54","date_gmt":"2024-06-10T12:42:54","guid":{"rendered":"https:\/\/www.purewl.com\/developer\/docs\/api-reference\/api-reference\/vpn-account-management-vam\/update-vpn-account\/"},"modified":"2025-02-19T10:25:10","modified_gmt":"2025-02-19T10:25:10","slug":"update-vpn-account","status":"publish","type":"docs","link":"https:\/\/www.purewl.com\/developer\/guides\/api\/api-reference\/vpn-account-management-vam\/update-vpn-account\/","title":{"rendered":"Update Subscription Type"},"content":{"rendered":"\n<p>Changing the subscription type of a VPN account is an essential feature for managing user plans and providing flexibility in VPN services. This functionality allows administrators or users to update the subscription type\u2014such as free, trial, or paid\u2014through API calls, enabling dynamic management of VPN accounts based on user needs or changes in service plans. This article provides a technical overview of how to implement subscription type changes through API.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Update Subscription Type<\/h2>\n\n\n\n<p>Use this API to update user subscription.<\/p>\n\n\n\n<p>Returns a JSON object that contains the VPN username.<\/p>\n\n\n\n<ul>\n<li><strong>URL:&nbsp;<\/strong>&lt;base url&gt;\/vam\/v1\/user\/subscription<\/li>\n\n\n\n<li><strong>Request Method:&nbsp;<\/strong>PUT<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Payload<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th class=\"has-text-align-left\" data-align=\"left\"><strong>Key<\/strong><\/th><th class=\"has-text-align-left\" data-align=\"left\"><strong>Type<\/strong><\/th><th class=\"has-text-align-left\" data-align=\"left\"><strong>Pass in<\/strong><\/th><th class=\"has-text-align-left\" data-align=\"left\"><strong>Description<\/strong><\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>X-AccessToken<\/code>*<\/td><td class=\"has-text-align-left\" data-align=\"left\">String<\/td><td class=\"has-text-align-left\" data-align=\"left\">Header<\/td><td class=\"has-text-align-left\" data-align=\"left\"><kbd>accessToken<\/kbd> retrieved from <a href=\"https:\/\/www.purewl.com\/developer\/guides\/api\/api-reference\/api-access-authentication\/#get-access-token\" data-type=\"link\" data-id=\"https:\/\/www.purewl.com\/developer\/guides\/api\/api-reference\/inventory-management\/countries\/\" target=\"_blank\" rel=\"noreferrer noopener\">Get Access Token<\/a> endpoint<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>vpnUsername<\/code>*<\/td><td class=\"has-text-align-left\" data-align=\"left\">String<\/td><td class=\"has-text-align-left\" data-align=\"left\">Body<\/td><td class=\"has-text-align-left\" data-align=\"left\">VPN Username<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>subscriptionType<\/code>*<\/td><td class=\"has-text-align-left\" data-align=\"left\">String<\/td><td class=\"has-text-align-left\" data-align=\"left\">Body<\/td><td class=\"has-text-align-left\" data-align=\"left\">Account subscription type (trial, paid and freemium) by default is paid<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\">(*) Required Parameter<\/figcaption><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Response<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th class=\"has-text-align-left\" data-align=\"left\"><strong>Key<\/strong><\/th><th class=\"has-text-align-left\" data-align=\"left\"><strong>Type<\/strong><\/th><th class=\"has-text-align-left\" data-align=\"left\"><strong>Description<\/strong><\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>header<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">JSON<\/td><td class=\"has-text-align-left\" data-align=\"left\">JSON object that describes return code and message<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>body<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">JSON<\/td><td class=\"has-text-align-left\" data-align=\"left\">JSON object that return VPN username<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Possible API error codes<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Code<\/strong><\/td><td><strong>Message<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td><code>2081<\/code><\/td><td>There is some problem in updating vpn account Subscription Type<\/td><td>An error occurred while attempting to update the VPN account subscription type.<\/td><\/tr><tr><td><code>2083<\/code><\/td><td>The user subscription type is same as provided.<\/td><td>The provided subscription type is identical to the current one. No changes were made.<\/td><\/tr><tr><td><code>11001<\/code><\/td><td>The provided username is not valid for this reseller.<\/td><td>The provided username is not recognized as valid for the associated reseller.<\/td><\/tr><tr><td><code>60005<\/code><\/td><td>Account is expired<\/td><td>The account has expired and is no longer active.<\/td><\/tr><tr><td><code>60006<\/code><\/td><td>Account is disable<\/td><td>The account has been disabled and is no longer active.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Sample Response<\/h3>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism off-numbers lang-json\" data-lang=\"JSON\" data-show-lang=\"1\"><code>{\n  &quot;header&quot;: {\n    &quot;message&quot;: &quot;VPN account Subscription Type has been updated successfully&quot;\n    &quot;response_code&quot;: 1,\n  },\n  &quot;body&quot;: {\n    &quot;vpnUsername&quot;: &quot;xxxxxx&quot;,\n   }\n}<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Changing the subscription type of a VPN account is an essential feature for managing user plans and providing flexibility in VPN services. This functionality allows administrators or users to update the subscription type\u2014such as free, trial, or paid\u2014through API calls, enabling dynamic management of VPN accounts based on user needs or changes in service plans. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":10017,"menu_order":14,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs\/10128"}],"collection":[{"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/comments?post=10128"}],"version-history":[{"count":9,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs\/10128\/revisions"}],"predecessor-version":[{"id":10884,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs\/10128\/revisions\/10884"}],"up":[{"embeddable":true,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs\/10017"}],"wp:attachment":[{"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/media?parent=10128"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/doc_tag?post=10128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}