Create a User
Create a new user.
POST /v1/users
Parameters
Parameter | Description | Type | Required |
---|---|---|---|
userId | User defined string identifier for this user. If not provided, Warrant will create an id for the user and return it. In this case, you should store the id in your system as you will need to provide it for any authorization requests for that user. Note that userIds in Warrant must be composed of alphanumeric chars and/or '-', '_', and '@'. | JSON body | no |
email | Email address for this user (optional). Designed to be used as a UI-friendly identifier. | JSON body | no |
Create a User with Provided Id
Request
- Curl
- Node.js
- Go
- Java
- Python
- Ruby
curl "https://api.warrant.dev/v1/users" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'{"userId":"d6ed6474-784e-407e-a1ea-42a91d4c52b9"}'
warrantClient
.createUser("d6ed6474-784e-407e-a1ea-42a91d4c52b9")
.then((newUser) => console.log(newUser))
.catch((error) => console.log(error));
user, err = client.CreateUser(warrant.User{
UserId: "d6ed6474-784e-407e-a1ea-42a91d4c52b9",
})
if err != nil {
// handle error
}
try {
user = client.createUser("d6ed6474-784e-407e-a1ea-42a91d4c52b9")
} catch (WarrantException e) {
// Handle error
}
user = client.create_user("d6ed6474-784e-407e-a1ea-42a91d4c52b9")
user = Warrant::WarrantClient.create_user("d6ed6474-784e-407e-a1ea-42a91d4c52b9")
Response
{
"userId": "d6ed6474-784e-407e-a1ea-42a91d4c52b9",
"email": null
}
Create a User with Generated Id
Request
- Curl
- Node.js
- Go
- Java
- Python
- Ruby
curl "https://api.warrant.dev/v1/users" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
warrantClient
.createUser()
.then((newUser) => console.log(newUser))
.catch((error) => console.log(error));
newUser, err := client.CreateUserWithGeneratedId()
if err != nil {
// handle error
}
try {
user = client.createUser();
} catch (WarrantException e) {
// Handle error
}
user = client.create_user()
user = Warrant::WarrantClient.create_user()
Response
{
"userId": "dkfi7a0s-784e-407e-a1ea-42a91d4c52b9",
"email": null
}