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

# Login

> Authenticate a user with email and password

## Request Body

<ParamField body="email" type="string" required>
  The user's email address
</ParamField>

<ParamField body="password" type="string" required>
  The user's password
</ParamField>

## Response

<ResponseField name="user" type="object">
  The authenticated user object
</ResponseField>

<ResponseField name="session" type="object">
  Session information with access token
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://api.usegately.com/api/v1/auth/login" \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "email": "user@example.com",
      "password": "securepassword123"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.usegately.com/api/v1/auth/login', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer YOUR_API_KEY'
    },
    body: JSON.stringify({
      email: 'user@example.com',
      password: 'securepassword123'
    })
  })

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

<ResponseExample>
  ```json Success Response theme={null}
  {
    "user": {
      "id": "usr_abc123",
      "email": "user@example.com",
      "user_metadata": {
        "role": "member",
        "project_id": "your-project-id"
      }
    },
    "session": {
      "access_token": "eyJhbGciOiJIUzI1NiIs...",
      "user": {
        "id": "usr_abc123",
        "email": "user@example.com"
      }
    }
  }
  ```

  ```json Error Response theme={null}
  {
    "error": "Invalid email or password"
  }
  ```
</ResponseExample>
