{"id":10043,"date":"2024-06-10T11:33:43","date_gmt":"2024-06-10T11:33:43","guid":{"rendered":"https:\/\/www.purewl.com\/developer\/docs\/api-reference\/api-reference\/vpn-account-management-vam\/generate\/"},"modified":"2025-07-09T08:47:09","modified_gmt":"2025-07-09T08:47:09","slug":"generate","status":"publish","type":"docs","link":"https:\/\/www.purewl.com\/developer\/guides\/api\/api-reference\/vpn-account-management-vam\/generate\/","title":{"rendered":"Generate VPN Account"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Generate<\/h2>\n\n\n\n<p>Use this API to create a VPN account by supplying a UUID as a mandatory parameter. If the UUID is found in the system, the details of the existing VPN account will be returned; otherwise, a new VPN account will be created and returned.<\/p>\n\n\n\n<p>It returns a JSON object with the VPN username, password, and expiry date.<\/p>\n\n\n\n<ul>\n<li><strong>URL:&nbsp;<\/strong>&lt;base url&gt;\/vam\/v2\/generate<\/li>\n\n\n\n<li><strong>Request Method:&nbsp;<\/strong>POST<\/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>uuid<\/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\">A universally unique identifier can be any string, email, or unique word.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>period<\/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 period. The maximum is 3700.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>preferences<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">JSON<\/td><td class=\"has-text-align-left\" data-align=\"left\">Body<\/td><td class=\"has-text-align-left\" data-align=\"left\">A structured JSON to specify allowed options such as multi-login limit and locations for the VPN account.<br>Sample JSON:&nbsp; {\u201cmulti_login\u201d:5,\u201dsession_limit\u201d:50,\u201dcountry\u201d:[1,2,3],\u201dcity\u201d:[1,2,3],\u201dprotocol\u201d:[1,2,3]}<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>preferences_format<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">JSON<\/td><td class=\"has-text-align-left\" data-align=\"left\">Body<\/td><td class=\"has-text-align-left\" data-align=\"left\">Format of the preferences&nbsp;and its value should always be&nbsp;<strong>keys<\/strong><\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>isDedicated<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">Boolean<\/td><td class=\"has-text-align-left\" data-align=\"left\">Body<\/td><td class=\"has-text-align-left\" data-align=\"left\">A boolean (True or False) that VPN account will be dedicated or shared<br>Default: false<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>dedicatedCountry<\/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\">If\u00a0<code>isDedicated<\/code>\u00a0is true, this parameter is mandatory and should contain the country ISO code, indicating that this VPN account will have a dedicated IP in that country. Supported countries include: US, GB, CA, DE,\u00a0AU,\u00a0HK, NL, SG , NZ\u00a0and\u00a0MT.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>oneLoginScheme<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">Boolean<\/td><td class=\"has-text-align-left\" data-align=\"left\">Body<\/td><td class=\"has-text-align-left\" data-align=\"left\">This boolean (True or False) indicate that either you\u2019ll provide username and password or it should be auto generate. Default is \u2018False\u2019<\/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\">If&nbsp;<code>oneLoginScheme<\/code>&nbsp;is true, then the VPN username is mandatory and must not exceed 20 characters.<\/td><\/tr><tr><td class=\"has-text-align-left\" data-align=\"left\"><code>vpnPassword<\/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\">If&nbsp;<code>oneLoginScheme<\/code>&nbsp;is true then VPN password is mandatory to provide. <br><strong>Length:<\/strong> Minimum 12, maximum 32 characters.<br><strong>Complexity:<\/strong> Must contain at least one uppercase letter, one lowercase letter, one number, and one special character (!@#$%^&amp;,.:{}).<br><strong>Character Restriction:<\/strong> Avoid using non-ASCII characters like (\u00a3, \u4f60\u597d).<\/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 (<strong>trial<\/strong>, <strong>paid<\/strong> and <strong>freemium<\/strong>) 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 username and password. Dedicated IP and dedicated host will also return if account would be dedicated<\/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>11001<\/code><\/td><td>The vpnUsername field is required when one login scheme is 1<\/td><td>The vpnUsername field must be provided when the login scheme is set to 1.<\/td><\/tr><tr><td><code>11001<\/code><\/td><td>Period must be a number between 1 and 10950<\/td><td>The provided period is invalid and must be between 1 and 10,950.<\/td><\/tr><tr><td><code>11001<\/code><\/td><td>The provided uuid already exists.<\/td><td>The UUID provided already exists in the system.<\/td><\/tr><tr><td><code>60001<\/code><\/td><td>Account containing this uuid is expired<\/td><td>The account associated with this UUID has expired.<\/td><\/tr><tr><td><code>60002<\/code><\/td><td>Account containing this uuid is disabled<\/td><td>The account associated with this UUID is disabled.<\/td><\/tr><tr><td><code>60003<\/code><\/td><td>Accounts can not be exceed subscribed no of accounts<\/td><td>The number of accounts has exceeded the reseller&#8217;s subscription limit.<\/td><\/tr><tr><td><code>100028<\/code><\/td><td>This username is not available. Please try again with different username<\/td><td>The username is already in use. Please choose a different one.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\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;response_code&quot;: 1,\n    &quot;message&quot;: &quot;VPN account has been created successfully&quot;\n  },\n  &quot;body&quot;: {\n    &quot;vpnUsername&quot;: &quot;xxxxxxxx&quot;,\n    &quot;vpnPassword&quot;: &quot;xxxxxxxx&quot;,\n    &quot;expiryDate&quot;: &quot;xxxxxxxx&quot;,\n  }\n<\/code><\/pre><\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Generate Use this API to create a VPN account by supplying a UUID as a mandatory parameter. If the UUID is found in the system, the details of the existing VPN account will be returned; otherwise, a new VPN account will be created and returned. It returns a JSON object with the VPN username, password, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":10017,"menu_order":6,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs\/10043"}],"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=10043"}],"version-history":[{"count":27,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs\/10043\/revisions"}],"predecessor-version":[{"id":11140,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs\/10043\/revisions\/11140"}],"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=10043"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/doc_tag?post=10043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}