Skip to main content

Overview

Retrieve a paginated list of orders placed by the authenticated user within the specified tenant. This endpoint is useful for customer-facing applications where users need to view their order history.

Authorization

  • User must be authenticated with a valid Bearer token
  • User must be a member of the tenant
  • Requires X-Tenant-ID header

Tenant Scoping

Only orders that match both conditions are returned:
  • Orders belonging to the authenticated user
  • Orders belonging to the specified tenant
This ensures users can only see their own orders within the current tenant context.

Response

Returns a paginated list of the user’s orders with:
  • Order items
  • Product details for each item
  • Order status and timestamps

Example Usage

curl -X GET \
  https://faisalshop.mvp-apps.ae/api/v2/admin/orders/my-orders \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'X-Tenant-ID: 123'
const response = await axios.get('/api/v2/admin/orders/my-orders', {
  headers: {
    Authorization: `Bearer ${token}`,
    'X-Tenant-ID': tenantId
  }
});

console.log(response.data);

Response Example

{
  "success": true,
  "data": {
    "current_page": 1,
    "data": [
      {
        "id": 42,
        "user_id": 5,
        "tenant_id": "123",
        "address_id": 2,
        "payment_type": 1,
        "total_amount": "99.99",
        "created_at": "2025-11-16T10:30:00.000000Z",
        "updated_at": "2025-11-16T10:30:00.000000Z",
        "items": [
          {
            "id": 85,
            "order_id": 42,
            "product_id": 10,
            "size": "Large",
            "qty": 2,
            "amount": "49.99",
            "notes": "Extra packaging please",
            "product": {
              "id": 10,
              "name_en": "Premium Coffee Beans",
              "cover_id": 5,
              "published": true
            }
          }
        ]
      },
      {
        "id": 38,
        "user_id": 5,
        "tenant_id": "123",
        "address_id": 2,
        "payment_type": 2,
        "total_amount": "149.50",
        "created_at": "2025-11-15T14:20:00.000000Z",
        "updated_at": "2025-11-15T14:20:00.000000Z",
        "items": [
          {
            "id": 78,
            "order_id": 38,
            "product_id": 15,
            "size": "Medium",
            "qty": 3,
            "amount": "149.50",
            "notes": null,
            "product": {
              "id": 15,
              "name_en": "Organic Tea",
              "cover_id": 8,
              "published": true
            }
          }
        ]
      }
    ],
    "per_page": 20,
    "total": 12,
    "last_page": 1
  }
}

Use Cases

  • Customer order history page
  • Order tracking interface
  • User dashboard showing recent orders
  • Mobile app order list

Notes

  • Orders are sorted by creation date (newest first)
  • Results are paginated with 20 orders per page
  • Only orders from the current tenant are shown
  • Users cannot see orders from other tenants, even if they belong to multiple tenants