> ## 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 - Get Orders

> Retrieve customer order history with pagination

<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/orders
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/orders:
    get:
      tags:
        - My Orders
      summary: Get customer orders
      description: Retrieve customer order history with pagination
      operationId: getMyOrders
      parameters:
        - name: page
          in: query
          description: The pagination of orders to return
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 1
        - name: per_page
          in: query
          description: Limit amount of orders to return per page
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 50
            default: 10
        - name: order
          in: query
          description: Order sort attribute ascending or descending
          required: false
          schema:
            type: string
            enum:
              - ASC
              - DESC
            default: DESC
      responses:
        '200':
          description: Orders retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerOrders'
              examples:
                customerOrders:
                  $ref: '#/components/examples/CustomerOrdersExample'
        '403':
          description: Forbidden - user must be logged in
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - basicAuth: []
        - bearerAuth: []
components:
  schemas:
    CustomerOrders:
      type: object
      properties:
        orders:
          type: array
          items:
            $ref: '#/components/schemas/OrderSummary'
          description: List of customer orders
        pagination:
          $ref: '#/components/schemas/Pagination'
          description: Pagination information
    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
    OrderSummary:
      type: object
      properties:
        order_id:
          type: integer
          description: Order ID
        order_status:
          type: string
          description: Order status
        order_date:
          type: string
          description: Order date
        item_count:
          type: integer
          description: Number of items in order
        order_total:
          type: string
          description: Order total
        order_actions:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/OrderAction'
    Pagination:
      type: object
      properties:
        previous:
          type: string
          format: uri
          description: Previous page URL
        next:
          type: string
          format: uri
          description: Next page URL
    OrderAction:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: Action URL
        name:
          type: string
          description: Action name
  examples:
    CustomerOrdersExample:
      value:
        orders:
          - order_id: 789
            order_status: Completed
            order_date: December 15, 2024, 2:20 pm
            item_count: 3
            order_total: $89.97
            order_actions:
              view:
                url: >-
                  https://example.com/wp-json/cocart/preview/my-account/orders/789
                label: View
          - order_id: 788
            order_status: Processing
            order_date: December 10, 2024, 10:15 am
            item_count: 1
            order_total: $29.99
            order_actions:
              view:
                url: >-
                  https://example.com/wp-json/cocart/preview/my-account/orders/788
                label: View
        pagination:
          previous: null
          next: https://example.com/wp-json/cocart/preview/my-account/orders?page=2
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: WordPress username and password
    bearerAuth:
      type: http
      scheme: bearer
      description: Bearer authentication with JWT token
      bearerFormat: JWT

````