---
id: ListBuyers
name: List buyers
version: 1.0.0
badges:
  - content: Customer Management
    backgroundColor: orange
    textColor: orange
summary: Returns Buyer profiles with pagination.
owners:
  - commerce-fulfillment-team
schemaPath: schema.json
operation:
  method: GET
  path: /api/v1/buyers
  statusCodes: ["200"]
sidebar:
  badge: "GET"
---

`ListBuyers` queries [[service|order-api]] (`GET /ordering/api/v1/buyers`) to return a paginated slice of registered buyer profiles for store administrators. The endpoint requires the Microsoft Entra ID `admin` policy and emits total item counts and navigation URIs in HTTP response headers.

## Overview

| Property                           | Value                                                                                                                             |
| :--------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------- |
| **Bounded Context**                | Ordering                                                                                                                          |
| **Owner Service**                  | [[service\|order-api]]                                                                                                            |
| **Protocol / Format**              | HTTP `GET`, `application/json` response                                                                                           |
| **Gateway Endpoint**               | `GET /ordering/api/v1/buyers` (service path `/api/v1/buyers`)                                                                     |
| **Authentication & Authorization** | Microsoft Entra ID JWT — `admin` policy (role `admin` plus scopes `ordering_read`, `ordering_write`)                              |
| **Idempotency / Concurrency**      | Read-only and naturally idempotent                                                                                                |
| **Rate Limit / Caching**           | Global concurrency (`100`), per-IP fixed-window (`30 req/min`), and per-user token bucket (`30` limit, `20` per `10s`, queue `5`) |
| **Contract Version**               | `1.0.0` (`ApiVersions.V1`)                                                                                                        |

## Request & Response Contract

### Query Parameters

| Name        | Type      | Required | Constraints                 | Description                               |
| :---------- | :-------- | :------- | :-------------------------- | :---------------------------------------- |
| `PageIndex` | `integer` | No       | Default `1`; must be `> 0`  | 1-based page number to retrieve           |
| `PageSize`  | `integer` | No       | Default `20`; must be `> 0` | Maximum number of buyer profiles per page |

### Response Headers (`200 OK`)

| Name               | Type     | Required | Constraints                               | Description                                                                                 |
| :----------------- | :------- | :------- | :---------------------------------------- | :------------------------------------------------------------------------------------------ |
| `Pagination-Count` | `string` | Yes      | Integer string (e.g., `128`)              | Total number of buyer profiles across all pages                                             |
| `Link`             | `string` | Yes      | Comma-separated `<uri>;rel=<rel>` entries | Navigation URIs with `first`, `self`, `last`, and conditional `previous` / `next` relations |

### Success Response (`200 OK`)

Returns a JSON array of buyer summary objects.

| Name         | Type              | Required | Constraints | Description                                    |
| :----------- | :---------------- | :------- | :---------- | :--------------------------------------------- |
| `[].id`      | `string` (`uuid`) | Yes      | Valid UUID  | Unique identifier of the buyer profile         |
| `[].name`    | `string \| null`  | Yes      | Nullable    | Buyer display name (`null` when unset)         |
| `[].address` | `string \| null`  | Yes      | Nullable    | Formatted shipping address (`null` when unset) |

## Behavior & Side Effects

- **Admin-scoped listing:** Returns paginated buyer profiles from PostgreSQL with `Pagination-Count` and `Link` headers.
- **No state mutation:** Pure read query with no database writes or integration events.

## Error Responses

| Status / Code           | Condition                                                      | Client Recovery Action                                             |
| :---------------------- | :------------------------------------------------------------- | :----------------------------------------------------------------- |
| `400 Bad Request`       | `PageIndex <= 0`, `PageSize <= 0`, or non-integer paging value | Fix paging parameters to positive integers; do not retry unchanged |
| `401 Unauthorized`      | Missing, expired, or invalid Entra ID bearer token             | Re-authenticate and retry                                          |
| `403 Forbidden`         | Caller does not satisfy the `admin` authorization policy       | Authenticate with an administrator account                         |
| `429 Too Many Requests` | Rate limit quota exceeded (`Retry-After` header included)      | Wait for the `Retry-After` duration before retrying                |

## Related Documentation

- [[service|order-api]] — Service overview, persistence, and endpoints.
- [[entity|buyer]] — Buyer entity model.
- [[query|GetBuyer]] — Retrieve a single buyer profile.

<NodeGraph />

<SchemaViewer file="schema.json" title="List buyers schema" maxHeight="500" search="true" />


 ## Raw Schema:schema.json

{
	"$schema": "https://json-schema.org/draft/2020-12/schema",
	"title": "BuyerDtoArray",
	"description": "Buyer list response documented by the Ordering API OpenAPI contract.",
	"type": "array",
	"items": {
		"type": "object",
		"required": ["id", "name", "address"],
		"properties": {
			"id": {
				"type": "string",
				"format": "uuid"
			},
			"name": {
				"type": ["string", "null"]
			},
			"address": {
				"type": ["string", "null"]
			}
		}
	}
}
