Create a new user with password authentication

POST /auth/register

Returns the user access token

application/json

Body Required

Responses

  • 422 application/json

    Error when validating the request body

    Hide response attributes Show response attributes object
    • message string

      Human readable error message

    • rule string

      The name of the validation rule

    • field string

      The form field

  • 201 application/json

    Login succeeded

    Hide response attributes Show response attributes object
POST /auth/register
curl \
 -X POST https://api.wan-host.com/auth/register \
 -H "Content-Type: application/json" \
 -d '{"email":"hello@victor.kiwi","password":"secret","passwordConfirmation":"secret"}'
Request example
{
  "email": "hello@victor.kiwi",
  "password": "secret",
  "passwordConfirmation": "secret"
}
Response examples (422)
[
  {
    "message": "The email has already been taken",
    "rule": "database.unique",
    "field": "email"
  },
  {
    "message": "The passwordConfirmation field and password field must be the same",
    "rule": "confirmed",
    "field": "passwordConfirmation",
    "meta": {
      "otherField": "password"
    }
  }
]
Response examples (201)
{
  "accessToken": {
    "type": "bearer",
    "name": "null",
    "token": "whu_NDk.SlU2YXBCWkVfU0hmLThVWXR1WXZGeG0xd25SbkNCUm5VZ3hDWWZGUjQxNjc3NDczNjU",
    "abilities": [
      "*"
    ],
    "lastUsedAt": "2024-03-06T09:34:59.403Z",
    "expiresAt": "2024-03-06T09:34:59.403Z"
  },
  "refreshToken": {
    "type": "bearer",
    "name": "null",
    "token": "whr_NTA.UmVhOHNmRXVFS1JuNklHYVhiU2cwUVMtank3UWQ2cmpGUHcyRWloVDE4MDUxODg5NjI",
    "abilities": [
      "*"
    ],
    "lastUsedAt": "2024-03-06T09:34:59.403Z",
    "expiresAt": "2024-03-06T09:34:59.403Z"
  }
}