Skip to main content

POST /api/auth/users

Validates and retrieves a user by their 6-character verification token. This endpoint is typically used during account confirmation or password reset flows.

Authentication

No authentication required.

Rate Limiting

This endpoint is subject to rate limiting.

Request

token
string
required
6-character verification tokenValidation rules:
  • Must not be empty
  • Must be exactly 6 characters in length
  • Both minimum and maximum length is 6

Request Body Example

{
  "token": "ABC123"
}

Response

message
string
Confirmation message
token
string
The validated token code

Response Example

{
  "message": "Token confirmed",
  "token": "ABC123"
}

Status Codes

200
Success
Token validated successfully
{
  "message": "Token confirmed",
  "token": "ABC123"
}
400
Validation Error
Invalid token format
[
  {
    "msg": "Token not valid",
    "param": "token",
    "location": "body"
  }
]
401
Unauthorized
Token not found in database
{
  "error": "Token not valid"
}

cURL Example

curl -X POST https://api.cognit.com/api/auth/users \
  -H "Content-Type: application/json" \
  -d '{
    "token": "ABC123"
  }'

Error Responses

Validation Errors (400)

The request body fails validation:
  • Token is empty
  • Token length is not exactly 6 characters

Unauthorized (401)

The token does not match any user in the database:
{
  "error": "Token not valid"
}

Notes

  • Tokens are case-sensitive
  • Tokens are typically 6 alphanumeric characters
  • This endpoint is used in conjunction with email verification and password reset flows
  • The token is returned in the response for confirmation purposes

Build docs developers (and LLMs) love