API EndpointsauthSign Up

Sign Up

Endpoint

URL: /:projectId/auth/sign-up

Method: POST

Authentication Required: No


Description

Register a new user by providing required credentials and optional profile data. Returns access and refresh tokens along with user data.


Request

Body Parameters

FieldTypeRequiredDescription
emailstringYesUser’s email address.
passwordstringYesUser’s password.
namestringNoFull name of the user.
usernamestringNoUnique username. Will be lowercased.
avatarstring (URL)NoURL to the user’s avatar image.
biostringNoShort biography.
locationobjectNoGeolocation object with longitude and latitude.
birthdatestring (ISO date)NoUser’s birthdate.
metadataobjectNoCustom public metadata.
secureMetadataobjectNoCustom secure metadata (not returned to client).

Example Request

{
  "email": "[email protected]",
  "password": "securePassword123",
  "username": "janedoe",
  "name": "Jane Doe",
  "avatar": "https://example.com/avatar.jpg",
  "bio": "Tech enthusiast",
  "location": { "longitude": -73.935242, "latitude": 40.73061 },
  "metadata": { "office": "boston" },
  "secureMetadata": { "internalId": "abc123" }
}

Response

Success Response (201 Created)

{
  "success": true,
  "accessToken": "<ACCESS_TOKEN>",
  "refreshToken": "<REFRESH_TOKEN>",
  "user": {
    "id": "user_123",
    "email": "[email protected]",
    "username": "janedoe",
    "name": "Jane Doe",
    "avatar": "https://example.com/avatar.jpg",
    "bio": "Tech enthusiast",
    "location": {
      "type": "Point",
      "coordinates": [-73.935242, 40.73061]
    },
    "birthdate": "1995-01-01T00:00:00.000Z",
    "metadata": { "office": "boston" },
    "suspensions": [],
    "reputation": 0,
    "createdAt": "2024-01-01T00:00:00.000Z",
    "updatedAt": "2024-01-01T00:00:00.000Z"
  }
}

Error Responses

Missing Required Fields (400 Bad Request)

{
  "error": "Missing required fields",
  "code": "auth/missing-fields"
}

Server Error (500 Internal Server Error)

{
  "error": "Internal server error",
  "code": "auth/server-error",
  "details": "<Error message>"
}

Notes

  • Sets an HttpOnly cookie named replyke-refresh-jwt with the refresh token.
  • Access token is returned in the response body.
  • Sensitive user data is excluded in the response.
  • A webhook is called before user creation to allow project-specific validation.