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

# Authentication

> Authentication endpoints for user management and session handling

## Get User Profile

<api-endpoint method="GET" url="https://api.apitraffic.io/v1/authentication/me" />

Returns the authenticated user's profile information including account details.

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for authentication
</ParamField>

### Response

<ResponseField name="sid" type="string">
  User's unique identifier
</ResponseField>

<ResponseField name="firstName" type="string">
  User's first name
</ResponseField>

<ResponseField name="lastName" type="string">
  User's last name
</ResponseField>

<ResponseField name="email" type="string">
  User's email address
</ResponseField>

<ResponseField name="timezone" type="string">
  User's timezone setting
</ResponseField>

<ResponseField name="defaultAccountSid" type="string">
  Default account identifier
</ResponseField>

<ResponseField name="createdAt" type="string">
  ISO 8601 timestamp of user creation
</ResponseField>

<ResponseField name="accounts" type="array">
  Array of account objects the user has access to
</ResponseField>

<ResponseField name="chat" type="object">
  <Expandable title="Chat Configuration">
    <ResponseField name="userHash" type="string">
      Hash for secure chat integration
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.apitraffic.io/v1/authentication/me" \
    -H "Authorization: Bearer your-jwt-token"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/authentication/me', {
    headers: {
      'Authorization': 'Bearer your-jwt-token'
    }
  });

  const user = await response.json();
  console.log(user);
  ```

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

  response = requests.get(
      'https://api.apitraffic.io/v1/authentication/me',
      headers={'Authorization': 'Bearer your-jwt-token'}
  )

  user = response.json()
  print(user)
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "sid": "usr_abc123def456ghi789",
    "firstName": "John",
    "lastName": "Doe", 
    "email": "john.doe@example.com",
    "timezone": "America/New_York",
    "defaultAccountSid": "acc_xyz789uvw012rst345",
    "createdAt": "2023-12-01T10:30:00.000Z",
    "accounts": [
      {
        "sid": "acc_xyz789uvw012rst345",
        "name": "My Company",
        "role": "owner"
      }
    ],
    "chat": {
      "userHash": "a1b2c3d4e5f6g7h8i9j0"
    }
  }
  ```
</ResponseExample>

***

## Verify Token

<api-endpoint method="GET" url="https://api.apitraffic.io/v1/authentication/verify" />

Verifies the validity of an authentication token.

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token to verify
</ParamField>

### Response

<ResponseField name="accountSid" type="string">
  Account identifier associated with the token
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.apitraffic.io/v1/authentication/verify" \
    -H "Authorization: Bearer your-jwt-token"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/authentication/verify', {
    headers: {
      'Authorization': 'Bearer your-jwt-token'
    }
  });

  const verification = await response.json();
  console.log(verification);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "accountSid": "acc_xyz789uvw012rst345"
  }
  ```
</ResponseExample>

***

## Sign Out

<api-endpoint method="GET" url="https://api.apitraffic.io/v1/authentication/signout" />

Signs the user out of their current session.

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token for the session to terminate
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Indicates if the sign out was successful
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.apitraffic.io/v1/authentication/signout" \
    -H "Authorization: Bearer your-jwt-token"
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.apitraffic.io/v1/authentication/signout', {
    headers: {
      'Authorization': 'Bearer your-jwt-token'
    }
  });

  const result = await response.json();
  console.log(result);
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true
  }
  ```
</ResponseExample>
