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

# Customer Profile

> Get and update authenticated customer profile information, and log out.

## GET /customer/profile

Retrieve the authenticated customer's profile.

### Authentication

Requires Bearer token (`auth:customer_api`).

### Headers

| Header        | Value          | Required |
| ------------- | -------------- | -------- |
| Authorization | Bearer {token} | Yes      |

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://front.rmz.gg/api/customer/profile" \
    -H "Authorization: Bearer 1|abc123xyz..."
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://front.rmz.gg/api/customer/profile", {
    headers: { "Authorization": "Bearer 1|abc123xyz..." }
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  response = requests.get("https://front.rmz.gg/api/customer/profile", headers={
      "Authorization": "Bearer 1|abc123xyz..."
  })
  data = response.json()
  ```

  ```php PHP theme={null}
  $response = Http::withToken("1|abc123xyz...")->get("https://front.rmz.gg/api/customer/profile");
  $data = $response->json();
  ```
</CodeGroup>

### Response

#### Success (200)

```json theme={null}
{
  "success": true,
  "data": {
    "id": 123,
    "first_name": "Ahmed",
    "last_name": "Ali",
    "full_name": "Ahmed Ali",
    "email": "ahmed@example.com",
    "phone": "501234567",
    "country_code": "966",
    "full_phone": "+966501234567",
    "avatar": null,
    "is_banned": false,
    "created_at": "2024-06-01T00:00:00.000000Z",
    "updated_at": "2024-06-15T10:30:00.000000Z"
  }
}
```

#### Error Responses

| Status | Description                |
| ------ | -------------------------- |
| 401    | Customer not authenticated |

***

## PATCH /customer/profile

Update the authenticated customer's profile.

### Authentication

Requires Bearer token (`auth:customer_api`).

### Headers

| Header        | Value            | Required |
| ------------- | ---------------- | -------- |
| Authorization | Bearer {token}   | Yes      |
| Content-Type  | application/json | Yes      |

### Body Parameters

| Parameter | Type   | Required | Description                               |
| --------- | ------ | -------- | ----------------------------------------- |
| firstName | string | Yes      | Customer first name                       |
| lastName  | string | Yes      | Customer last name                        |
| email     | string | Yes      | Customer email (must be unique per store) |

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH "https://front.rmz.gg/api/customer/profile" \
    -H "Authorization: Bearer 1|abc123xyz..." \
    -H "Content-Type: application/json" \
    -d '{
      "firstName": "Ahmed",
      "lastName": "Ali",
      "email": "ahmed.updated@example.com"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://front.rmz.gg/api/customer/profile", {
    method: "PATCH",
    headers: {
      "Authorization": "Bearer 1|abc123xyz...",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      firstName: "Ahmed",
      lastName: "Ali",
      email: "ahmed.updated@example.com"
    })
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  response = requests.patch("https://front.rmz.gg/api/customer/profile",
      headers={"Authorization": "Bearer 1|abc123xyz..."},
      json={
          "firstName": "Ahmed",
          "lastName": "Ali",
          "email": "ahmed.updated@example.com"
      }
  )
  data = response.json()
  ```

  ```php PHP theme={null}
  $response = Http::withToken("1|abc123xyz...")->patch("https://front.rmz.gg/api/customer/profile", [
      "firstName" => "Ahmed",
      "lastName" => "Ali",
      "email" => "ahmed.updated@example.com"
  ]);
  $data = $response->json();
  ```
</CodeGroup>

### Response

#### Success (200)

```json theme={null}
{
  "success": true,
  "data": {
    "id": 123,
    "first_name": "Ahmed",
    "last_name": "Ali",
    "full_name": "Ahmed Ali",
    "email": "ahmed.updated@example.com",
    "phone": "501234567",
    "country_code": "966",
    "full_phone": "+966501234567",
    "avatar": null,
    "is_banned": false,
    "created_at": "2024-06-01T00:00:00.000000Z",
    "updated_at": "2024-06-15T12:00:00.000000Z"
  },
  "message": "Profile updated successfully"
}
```

#### Error Responses

| Status | Description                                                      |
| ------ | ---------------------------------------------------------------- |
| 401    | Customer not authenticated                                       |
| 422    | Validation error (email already in use, missing required fields) |

***

## POST /customer/logout

Revoke the current access token and log out.

### Authentication

Requires Bearer token (`auth:customer_api`).

### Headers

| Header        | Value          | Required |
| ------------- | -------------- | -------- |
| Authorization | Bearer {token} | Yes      |

### Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://front.rmz.gg/api/customer/logout" \
    -H "Authorization: Bearer 1|abc123xyz..."
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch("https://front.rmz.gg/api/customer/logout", {
    method: "POST",
    headers: { "Authorization": "Bearer 1|abc123xyz..." }
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  response = requests.post("https://front.rmz.gg/api/customer/logout", headers={
      "Authorization": "Bearer 1|abc123xyz..."
  })
  data = response.json()
  ```

  ```php PHP theme={null}
  $response = Http::withToken("1|abc123xyz...")->post("https://front.rmz.gg/api/customer/logout");
  $data = $response->json();
  ```
</CodeGroup>

### Response

#### Success (200)

```json theme={null}
{
  "success": true,
  "data": null,
  "message": "Logged out successfully"
}
```

<Tip>
  After logging out, discard the Bearer token on the client side. The token is permanently revoked and cannot be reused.
</Tip>
