curl --request POST \
--url https://api.example.com/auth/register \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"email": "<string>",
"password": "<string>"
}
'{
"access_token": "<string>",
"token_type": "<string>",
"user": {
"id": 123,
"name": "<string>",
"email": "<string>"
}
}Register a new user account
curl --request POST \
--url https://api.example.com/auth/register \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"email": "<string>",
"password": "<string>"
}
'{
"access_token": "<string>",
"token_type": "<string>",
"user": {
"id": 123,
"name": "<string>",
"email": "<string>"
}
}POST /auth/register
"John Doe""[email protected]""SecurePass123"Authorization header for subsequent requests.Example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqb2huLmRvZUBleGFtcGxlLmNvbSIsImV4cCI6MTcwOTU1MTIwMH0.abc123""bearer".Show user properties
1"John Doe""[email protected]"curl -X POST "https://api.smarteat.ai/auth/register" \
-H "Content-Type: application/json" \
-d '{
"name": "John Doe",
"email": "[email protected]",
"password": "SecurePass123"
}'
const response = await fetch('https://api.smarteat.ai/auth/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: 'John Doe',
email: '[email protected]',
password: 'SecurePass123'
})
});
const data = await response.json();
console.log(data.access_token);
import requests
response = requests.post(
'https://api.smarteat.ai/auth/register',
json={
'name': 'John Doe',
'email': '[email protected]',
'password': 'SecurePass123'
}
)
data = response.json()
print(data['access_token'])
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqb2huLmRvZUBleGFtcGxlLmNvbSIsImV4cCI6MTcwOTU1MTIwMH0.abc123def456",
"token_type": "bearer",
"user": {
"id": 1,
"name": "John Doe",
"email": "[email protected]"
}
}
{
"detail": "Email already registered"
}
{
"detail": [
{
"type": "value_error",
"loc": ["body", "password"],
"msg": "Value error, Password must be at least 8 characters long",
"input": "short"
}
]
}
{
"detail": [
{
"type": "value_error",
"loc": ["body", "password"],
"msg": "Value error, Password must contain at least one uppercase letter",
"input": "lowercase123"
}
]
}
{
"detail": [
{
"type": "value_error",
"loc": ["body", "password"],
"msg": "Value error, Password must contain at least one number",
"input": "PasswordOnly"
}
]
}
{
"detail": [
{
"type": "value_error",
"loc": ["body", "email"],
"msg": "value is not a valid email address",
"input": "not-an-email"
}
]
}
{
"detail": "Error creating user"
}