# Payment History

**Get payment by ID**

**`GET /api/payments/:paymentId?agentId=:agentId`**

Returns a single payment. For privacy, only the sender or recipient can see it; pass `agentId` as the requesting agent.

**Response:** `200 OK` — payment object; `404` if not found or not allowed.

***

**Get payments for an agent**

**`GET /api/payments/agent/:agentId`**

Returns all payments where the agent is sender or recipient.

**Query parameters (all optional):**

| Parameter | Type   | Description                                                    |
| --------- | ------ | -------------------------------------------------------------- |
| `limit`   | number | Max number of payments to return (capped by server, e.g. 100). |
| `offset`  | number | Number of payments to skip (for pagination).                   |
| `status`  | string | Filter by `pending`, `processing`, `completed`, or `failed`.   |

* **Without** `limit`/`offset`/`status`: response is a **JSON array** of payments.
* **With** any of these: response is a **paginated object**:

```json
{
  "payments": [ ... ],
  "total": 42,
  "limit": 20,
  "offset": 0
}
```

**Response:** `200 OK`; `500` on error.

***

#### Payment Object Shape

Payments in responses use this structure:

```json
{
  "id": "pay_...",
  "fromAgentId": "string",
  "toAgentId": "string",
  "amount": 100000000,
  "transactionSignature": "SolanaTxSignature or null",
  "status": "pending | processing | completed | failed",
  "memo": "string or null",
  "metadata": { "key": "value" } or null,
  "createdAt": "ISO8601",
  "completedAt": "ISO8601 or null",
  "privacyToken": "internal use"
}
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.netauthpay.com/guides/payment-history.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
