{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/v1/users","auth":"required","settings":"","examples":{"codes":[{"language":"curl","code":"curl https://api.userkit.io/v1/users \\\n -u api:{YOUR_APP_SECRET_KEY} \\\n -H \"Content-Type: application/json\" \\\n -d '{\"email\": \"jane.smith:::at:::example.com\", \"password\": \"secretpass\"}'"},{"language":"python","code":"uk = userkit.UserKit(\"{YOUR_APP_SECRET_KEY}\")\n\nuser = uk.users.create_user(\n\temail=\"[email protected]\",\n\tpassword=\"secretpass\"\n)"},{"language":"ruby","code":"def create_user(data)\n    resource = RestClient::Resource.new(\n      \t'https://api.userkit.io/v1/users',\n      'api', \"{YOUR_APP_SECRET_KEY}\")\n    response = resource.post(data.to_json,\n        :content_type => 'application/json')\n    return JSON.parse(response.body)\nend\n\nuser = create_user({\n\t\"email\"=>\"[email protected]\",\n\t\"password\"=>\"secretpass\"\n})"},{"code":"package main\n\nimport (\n\t\"fmt\"\n\tuserkit \"github.com/workpail/userkit-go\"\n)\n\nfunc main() {\n  uk := userkit.NewUserKit(\n    \"{YOUR_APP_SECRET_KEY}\")\n  \n\tdata := map[string]string{\n    \"email\": \"[email protected]\",\n\t\t\"password\": \"secretpass\"}\n  \n\tuser, err := uk.Users.Create(data)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\tfmt.Printf(\"%+v\", user)\n}","language":"go"},{"name":"PHP","language":"php","code":"<?php\n\n$uk = new UserKit('<YOUR_APP_SECRET_KEY>');\n\n$user = $uk->users->createUser(['email' => '[email protected]',\n\t'password' => 'secretpass']);\n"}]},"method":"post","params":[{"name":"name","type":"string","default":"","desc":"The user's full name, e.g. \"Jane Smith\"","required":false,"in":"body","ref":"","_id":"57d4aca7642d570e00ebd5b8"},{"name":"username","type":"string","default":"","desc":"A username","required":false,"in":"body","ref":"","_id":"57d4aca7642d570e00ebd5b7"},{"name":"email","type":"string","default":"","desc":"An email address","required":false,"in":"body","ref":"","_id":"57d4aca7642d570e00ebd5b6"},{"name":"password","type":"string","default":"","desc":"The user's password","required":false,"in":"body","ref":"","_id":"57d4aca7642d570e00ebd5b5"},{"name":"auth_type","type":"string","default":"","desc":"Can be one of \"password\", \"two_factor\", or \"one_time_password\"","required":false,"in":"body","ref":"","_id":"57d4aca7642d570e00ebd5b4"},{"name":"phone","type":"string","default":"","desc":"A phone number","required":false,"in":"body","ref":"","_id":"57d4aca7642d570e00ebd5b3"},{"name":"verified_phone_token","type":"string","default":"","desc":"A token proving that the user owns the phone number","required":false,"in":"body","ref":"","_id":"57d4aca7642d570e00ebd5b2"}],"results":{"codes":[{"language":"json","status":200,"name":"","code":"{\n  \"id\": \"usr_TgTbetyiSvuiIw\",\n  \"name\": \"Jane Smith\",\n  \"username\": \"janes5\",\n  \"email\": \"[email protected]\",\n  \"verified_email\": null,\n  \"verified_phone\": \"+15552323353\",\n  \"auth_type\": \"two_factor\",\n  \"disabled\": false,\n  \"created\": 1473544359.3973701,\n  \"last_failed_login\": null,\n  \"last_login\": null\n}"},{"status":400,"name":"","code":"{\n\t// Every error response contains an error property\n\t\"error\": {\n    \"type\": \"invalid_request_error\",\n    \"code\": \"invalid_username\",\n    \"param\": \"username\",\n    \"message\": \"Invalid username\"\n  },\n  \n  // But some error responses can contain multiple errors.\n  // In this case the \"errors\" property contains all of the errors.\n  \"errors\": [\n    {\n      \"type\": \"invalid_request_error\",\n      \"code\": \"invalid_username\",\n      \"param\": \"username\",\n      \"message\": \"Invalid username\"\n    },\n    {\n      \"type\": \"invalid_request_error\",\n      \"code\": \"invalid_email\",\n      \"param\": \"email\",\n      \"message\": \"Invalid email\"\n    }\n  ]\n}","language":"json"}]}},"next":{"description":"","pages":[]},"title":"Create a user","type":"endpoint","slug":"create-a-user","excerpt":"Most of the time your users will signup using the widget, but you can also create users directly with the API","body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"For the API explorer authentication: *username* should be \\\"api\\\", *password* should be the secret API key for a test UserKit app.\"\n}\n[/block]","updates":[],"order":0,"isReference":true,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"57d9f30c2bb38f0e00ef413b","project":"5589ceae9883a40d00c433f3","createdAt":"2016-09-15T01:02:04.532Z","user":"5542d87d795b590d001dc7ff","__v":1,"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Server API","slug":"tutorials","order":2,"from_sync":false,"reference":true,"_id":"57d4a754899ab90e00105e5d","project":"5589ceae9883a40d00c433f3","__v":0,"createdAt":"2016-09-11T00:37:40.706Z","version":"5589ceae9883a40d00c433f6"},"parentDoc":null,"githubsync":"","version":{"version":"1.0","version_clean":"1.0.0","codename":"","is_stable":true,"is_beta":true,"is_hidden":false,"is_deprecated":false,"categories":["5589ceaf9883a40d00c433f7","559ab19d2100d117005f1269","57d4a754899ab90e00105e5d","5807813b6d24211900953b99","5819154bf62fee0f00949855","5841d27cae05ac2500ba2680","5846c4ee5d064323007b1774","589e29c72793e937001c15c5","5cf0460e272f2c0014a80d17","5cf047bde14258005d7a374e","5db6fa2c7f86fa004ff2c35b","5e349a6a02520b006458b0ae","5e4c89eafd907100654072f2","5e4d7a1feca7f90018b15b9b","5e4eff0ec3399b005118d83a"],"_id":"5589ceae9883a40d00c433f6","releaseDate":"2015-06-23T21:25:02.865Z","__v":15,"createdAt":"2015-06-23T21:25:02.865Z","project":"5589ceae9883a40d00c433f3"}}

postCreate a user

Most of the time your users will signup using the widget, but you can also create users directly with the API

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Body Params

name:
string
The user's full name, e.g. "Jane Smith"
username:
string
A username
email:
string
An email address
password:
string
The user's password
auth_type:
string
Can be one of "password", "two_factor", or "one_time_password"
phone:
string
A phone number
verified_phone_token:
string
A token proving that the user owns the phone number

Examples


Result Format


Documentation

[block:callout] { "type": "info", "body": "For the API explorer authentication: *username* should be \"api\", *password* should be the secret API key for a test UserKit app." } [/block]

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}