{"id":10035,"date":"2024-06-10T11:28:00","date_gmt":"2024-06-10T11:28:00","guid":{"rendered":"https:\/\/www.purewl.com\/developer\/docs\/api-reference\/api-reference\/vpn-account-management-vam\/create-vpn-account\/"},"modified":"2025-07-09T08:48:46","modified_gmt":"2025-07-09T08:48:46","slug":"create-vpn-account","status":"publish","type":"docs","link":"https:\/\/www.purewl.com\/developer\/guides\/api\/api-reference\/vpn-account-management-vam\/create-vpn-account\/","title":{"rendered":"Create VPN Account"},"content":{"rendered":"\n<p>Creating VPN accounts programmatically through APIs allows for automated and scalable user management. This process is crucial for integrating VPN services into applications, providing users with secure and efficient access to VPN networks. This article provides a technical overview of how to implement VPN account creation via API.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"get-countries-v3\">Create<\/h2>\n\n\n\n<p>Use this API to create a VPN account by supplying a UUID as a mandatory parameter. 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\/v3\/create<\/li>\n\n\n\n<li><strong>Request Method:&nbsp;<\/strong>POST<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"payload\">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\">&nbsp;JSON<\/td><td class=\"has-text-align-left\" data-align=\"left\">Body&nbsp;<\/td><td class=\"has-text-align-left\" data-align=\"left\">Format of the preferences&nbsp;and its value should always be&nbsp;<strong>key<\/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>&nbsp;Minimum 12, maximum 32 characters.<br><strong>Complexity:<\/strong>&nbsp;Must contain at least one uppercase letter, one lowercase letter, one number, and one special character (!@#$%^&amp;*,.:{}).<br><strong>Character Restriction:<\/strong>&nbsp;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><\/figure>\n\n\n\n<p>(*) Required Parameter<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"response\">Response<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th><strong>Key<\/strong><\/th><th class=\"has-text-align-left\" data-align=\"left\"><strong>Description<\/strong><\/th><\/tr><\/thead><tbody><tr><td><code>header<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">A JSON object that details the return code and message.<\/td><\/tr><tr><td><code>body<\/code><\/td><td class=\"has-text-align-left\" data-align=\"left\">A JSON object containing the VPN username, password, and expiry date. If the account is dedicated, it will also include the dedicated IP and dedicated host.<\/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 provided uuid already exists.<\/td><td>The UUID provided already exists in the system.<\/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>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>60004<\/code><\/td><td>Couldn&#8217;t Verify UUID<\/td><td>The UUID could not be verified.<\/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<h3 class=\"wp-block-heading\" id=\"sample-response\">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","protected":false},"excerpt":{"rendered":"<p>Creating VPN accounts programmatically through APIs allows for automated and scalable user management. This process is crucial for integrating VPN services into applications, providing users with secure and efficient access to VPN networks. This article provides a technical overview of how to implement VPN account creation via API. Create Use this API to create a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":10017,"menu_order":5,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs\/10035"}],"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=10035"}],"version-history":[{"count":55,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs\/10035\/revisions"}],"predecessor-version":[{"id":11135,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/docs\/10035\/revisions\/11135"}],"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=10035"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.purewl.com\/developer\/wp-json\/wp\/v2\/doc_tag?post=10035"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}