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

# My Account

> Retrieve customer account information including profile data and order statistics

<Warning>
  This endpoint is currently shown as a preview of what's currently in development and is subject to change.
</Warning>


## OpenAPI

````yaml api-reference/pre-release/openapi-spec-preview.yaml get /my-account
openapi: 3.0.3
info:
  title: CoCart Preview API
  description: >
    CoCart Preview provides enhanced REST API endpoints for WooCommerce headless
    e-commerce solutions.

    This API extends CoCart with additional functionality for checkout, customer
    account management, and order handling.


    ## Authentication


    The API supports multiple authentication methods:

    - **Cart Key**: For guest customers, pass the cart key via `Cart-Key` header
    or `cart_key` parameter

    - **Basic Auth**: For registered customers using username/password

    - **JWT**: For registered customers using JWT tokens (requires JWT plugin)

    - **Session**: For logged-in WordPress users


    ## Base URL


    All API endpoints are prefixed with `/wp-json/cocart/preview/`


    ## Response Format


    All responses follow the CoCart standard format with consistent error
    handling and data structure.
  termsOfService: http://cocartapi.com/terms-of-conditions-polar/
  contact:
    email: support@cocartapi.com
  license:
    name: GNU General Public License v3.0
    url: http://www.gnu.org/licenses/gpl-3.0.html
  version: 0.0.1
servers:
  - url: '{protocol}://{host}/wp-json/cocart/preview'
    description: API Preview
    variables:
      protocol:
        enum:
          - http
          - https
        default: https
      host:
        default: example-store.com
        description: Your store domain
security: []
tags:
  - name: Checkout
    description: Complete checkout process including payment and order creation
  - name: My Account
    description: Customer account information and profile management
  - name: My Orders
    description: Customer order history and details
  - name: My Downloads
    description: Customer digital downloads
  - name: My Subscriptions
    description: Customer subscription management
externalDocs:
  description: Find out more about CoCart API
  url: https://docs.cocartapi.com
paths:
  /my-account:
    get:
      tags:
        - My Account
      summary: Get customer account details
      description: >-
        Retrieve customer account information including profile data and order
        statistics
      operationId: getMyAccount
      responses:
        '200':
          description: Account details retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerAccount'
              examples:
                customerAccount:
                  $ref: '#/components/examples/CustomerAccountExample'
        '403':
          description: Forbidden - user must be logged in
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - basicAuth: []
        - bearerAuth: []
components:
  schemas:
    CustomerAccount:
      type: object
      properties:
        user:
          type: object
          description: User account information
          properties:
            id:
              type: integer
              description: Unique identifier for the user
              readOnly: true
            date_registered:
              type: string
              format: date-time
              description: User registration date
              readOnly: true
            email:
              type: string
              format: email
              description: Email address
              readOnly: true
            first_name:
              type: string
              description: First name
              readOnly: true
            last_name:
              type: string
              description: Last name
              readOnly: true
            display_name:
              type: string
              description: Display name
              readOnly: true
            addresses:
              type: object
              description: Customer addresses
              readOnly: true
              properties:
                billing:
                  $ref: '#/components/schemas/BillingAddress'
                shipping:
                  $ref: '#/components/schemas/ShippingAddress'
            orders_count:
              type: integer
              description: Total number of orders
              readOnly: true
            total_spent:
              type: string
              description: Total amount spent
              readOnly: true
            is_paying_customer:
              type: boolean
              description: Whether the customer has made any purchase
              readOnly: true
            avatar_url:
              type: string
              format: uri
              description: Avatar URL
              readOnly: true
        recent_order:
          type: object
          description: Most recent order information
          readOnly: true
          properties:
            order_id:
              type: integer
              nullable: true
              description: Most recent order ID
            order_date:
              type: string
              nullable: true
              format: date-time
              description: Most recent order date
            order_data:
              type: string
              format: uri
              description: Link to order details
        meta:
          type: object
          description: Additional customer metadata
          readOnly: true
          properties:
            is_customer_outside_base:
              type: boolean
              description: Whether the customer is outside the base location
            is_vat_exempt:
              type: boolean
              description: Whether the customer is VAT exempt
        extensions:
          type: object
          description: Extension data
          readOnly: true
          additionalProperties: true
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: Error code identifier
        message:
          type: string
          description: Human-readable error message
        data:
          type: object
          description: Additional error data
          properties:
            status:
              type: integer
              description: HTTP status code
    BillingAddress:
      type: object
      properties:
        first_name:
          type: string
          description: First name
        last_name:
          type: string
          description: Last name
        company:
          type: string
          description: Company name
        address_1:
          type: string
          description: Address line 1
        address_2:
          type: string
          description: Address line 2
        city:
          type: string
          description: City name
        state:
          type: string
          description: State/County
        postcode:
          type: string
          description: Postal code
        country:
          type: string
          description: Country code
        phone:
          type: string
          description: Phone number
        email:
          type: string
          format: email
          description: Email address
    ShippingAddress:
      type: object
      properties:
        first_name:
          type: string
          description: First name
        last_name:
          type: string
          description: Last name
        company:
          type: string
          description: Company name
        address_1:
          type: string
          description: Address line 1
        address_2:
          type: string
          description: Address line 2
        city:
          type: string
          description: City name
        state:
          type: string
          description: State/County
        postcode:
          type: string
          description: Postal code
        country:
          type: string
          description: Country code
  examples:
    CustomerAccountExample:
      value:
        user:
          id: 123
          date_registered: '2024-01-15T10:30:00'
          email: john@example.com
          first_name: John
          last_name: Doe
          display_name: John Doe
          addresses:
            billing:
              first_name: John
              last_name: Doe
              company: ''
              address_1: 123 Main St
              address_2: Apt 4B
              city: Anytown
              state: CA
              postcode: '12345'
              country: US
              phone: '+1234567890'
              email: john@example.com
            shipping:
              first_name: John
              last_name: Doe
              company: ''
              address_1: 123 Main St
              address_2: Apt 4B
              city: Anytown
              state: CA
              postcode: '12345'
              country: US
          orders_count: 15
          total_spent: $1,234.56
          is_paying_customer: true
          avatar_url: https://secure.gravatar.com/avatar/abc123?s=96&d=mm&r=g
        recent_order:
          order_id: 789
          order_date: '2024-12-15T14:20:00'
          order_data: https://example.com/wp-json/cocart/preview/my-account/orders/789
        meta:
          is_customer_outside_base: false
          is_vat_exempt: false
        extensions: {}
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: WordPress username and password
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer authentication with JWT token
      bearerFormat: JWT

````