Nest Authbeta

POST /auth/admin/signup

Create an admin (secret-key gated)

Create an admin (secret-key gated)

POST/auth/admin/signup

Request body

AdminSignupDto

FieldTypeRequiredDescription
emailstringrequiredAdmin email address
Example: admin@example.com
passwordstringrequiredAdmin password (minimum 8 characters, must contain uppercase, lowercase, number, and special character)
Example: SecurePassword123!
secretKeystringrequiredSecret key for authorization (provided in module configuration)
Example: your-secret-key
namestringoptionalAdmin name (optional)
Example: Admin User
metadataobjectoptionalAdditional metadata for the admin user (optional)
Example: {"department":"IT","role":"super-admin"}

Examples

Example
{
  "email": "admin@example.com",
  "password": "SecurePassword123!",
  "secretKey": "your-secret-key",
  "name": "Admin User",
  "metadata": {
    "department": "IT",
    "role": "super-admin"
  }
}

Responses

201
400Validation failed (bad input).

ApiErrorResponseDto

FieldTypeRequiredDescription
statusCodenumberrequiredHTTP status code
Example: 401
errorstringrequiredHTTP status text / exception name
Example: Unauthorized
messagestringrequiredHuman-readable message
Example: Invalid credentials
codestringrequiredStable, machine-readable error code — branch on this, not the message
Example: INVALID_CREDENTIALS

Example response

{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Invalid credentials",
  "code": "INVALID_CREDENTIALS"
}
401Missing, invalid, or expired authentication.

ApiErrorResponseDto

FieldTypeRequiredDescription
statusCodenumberrequiredHTTP status code
Example: 401
errorstringrequiredHTTP status text / exception name
Example: Unauthorized
messagestringrequiredHuman-readable message
Example: Invalid credentials
codestringrequiredStable, machine-readable error code — branch on this, not the message
Example: INVALID_CREDENTIALS

Example response

{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Invalid credentials",
  "code": "INVALID_CREDENTIALS"
}

Try it

curl -X POST 'https://api.example.com/auth/admin/signup' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -d '{"email":"admin@example.com","password":"SecurePassword123!","secretKey":"your-secret-key","name":"Admin User","metadata":{"department":"IT","role":"super-admin"}}'

On this page