> ## Documentation Index
> Fetch the complete documentation index at: https://docs.llmgenerator.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Registrar conta

> Este endpoint permite que novos usuários criem uma conta.

## POST /auth/register

Este endpoint cria uma nova conta de usuário. É público e não exige autenticação. Após o registro bem-sucedido, um e-mail de verificação é enviado.

### Corpo da requisição

<ParamField body="email" type="string" required>
  E-mail do usuário. Deve ser válido e único.
</ParamField>

<ParamField body="password" type="string" required>
  Senha do usuário. Mínimo de 8 caracteres e critérios de força exigidos.
</ParamField>

<ParamField body="firstName" type="string" required>
  Nome do usuário. Máximo 50 caracteres.
</ParamField>

<ParamField body="lastName" type="string">
  Sobrenome do usuário. Máximo 50 caracteres.
</ParamField>

<ParamField body="company" type="string">
  Nome da empresa. Máximo 100 caracteres.
</ParamField>

### Resposta

<ResponseField name="success" type="boolean">
  Indica se o registro foi bem-sucedido.
</ResponseField>

<ResponseField name="message" type="string">
  Mensagem de status legível.
</ResponseField>

<ResponseField name="user" type="object">
  Informações do usuário recém-criado.

  <Expandable title="Propriedades de user">
    <ResponseField name="id" type="string">
      Identificador único do usuário.
    </ResponseField>

    <ResponseField name="email" type="string">
      E-mail do usuário.
    </ResponseField>

    <ResponseField name="name" type="string">
      Nome completo do usuário.
    </ResponseField>

    <ResponseField name="emailVerified" type="boolean">
      Se o e-mail foi verificado (inicialmente false).
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      Data de criação da conta em ISO 8601.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="tokens" type="object">
  Tokens de autenticação.

  <Expandable title="Propriedades de tokens">
    <ResponseField name="accessToken" type="string">
      Token de acesso para requisições seguintes. Expira em 15 minutos.
    </ResponseField>

    <ResponseField name="refreshToken" type="string">
      Token de atualização para novos access tokens. Expira em 7 dias.
    </ResponseField>

    <ResponseField name="expiresIn" type="number">
      Tempo de expiração em segundos (900 = 15 minutos).
    </ResponseField>

    <ResponseField name="tokenType" type="string">
      Tipo do token (sempre "Bearer").
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.llmgenerator.com/api/v1/auth/register \
    -H "Content-Type: application/json" \
    -d '{
          "email": "user@example.com",
          "password": "securePassword123!",
          "firstName": "John",
          "lastName": "Doe",
          "company": "Acme Inc"
        }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.llmgenerator.com/api/v1/auth/register', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      email: 'user@example.com',
      password: 'securePassword123!',
      firstName: 'John',
      lastName: 'Doe'
    })
  });

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      'https://api.llmgenerator.com/api/v1/auth/register',
      json={
          'email': 'user@example.com',
          'password': 'securePassword123!',
          'firstName': 'John',
          'lastName': 'Doe'
      }
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Sucesso (201) theme={null}
  {
    "success": true,
    "message": "Account created successfully",
    "user": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "email": "user@example.com",
      "name": "John Doe",
      "emailVerified": false,
      "createdAt": "2026-01-29T12:00:00.000Z"
    },
    "tokens": {
      "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "expiresIn": 900,
      "tokenType": "Bearer"
    }
  }
  ```

  ```json E-mail já cadastrado (409) theme={null}
  {
    "message": "Email already registered"
  }
  ```

  ```json Senha fraca (400) theme={null}
  {
    "message": "Weak password: Password must contain at least one uppercase letter, one number"
  }
  ```
</ResponseExample>
