# Query Revenue Records

`GET https://api.suger.cloud/ai/org/{orgId}/revenue/record-query`

Returns this organization's revenue records as a page, with the total count alongside them, so page_size=1 answers "how many" without fetching the set. `q` filters with a parenthesised expression such as (= partner "AWS"); `s` sorts, defaulting to newest invoice date first. For a total or a breakdown, AggregateRevenueRecords groups in the database and returns the amounts directly.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `orgId` | path | string | yes | Organization ID |
| `q` | query | string | no |  |
| `s` | query | string | no |  |
| `page_size` | query | string | no |  |
| `page_number` | query | string | no |  |

## Responses

### 200 — Paginated legacy Revenue records

Content-Type: `application/json`

### 400 — Invalid legacy Revenue request

Content-Type: `application/json`

**`Response`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | string | yes |  |
| `detail` | string | no |  |

### 403 — Missing Revenue permission

Content-Type: `application/json`

**`Response`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | string | yes |  |
| `detail` | string | no |  |

### 413 — Request body too large

Content-Type: `application/json` · Schema: `RevenuePayloadTooLargeResponse`

**`RevenuePayloadTooLargeResponse`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | object | yes |  |

### 500 — Failed to query Revenue records

Content-Type: `application/json`

**`Response`** fields:

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `error` | string | yes |  |
| `detail` | string | no |  |

## Example

_Generated from this operation's schema. Values are placeholders — substitute your own ids, and set `SUGER_TOKEN` to a bearer token from the [OAuth client-credentials exchange](https://doc.fours.com/settings/oauth-app/)._

### Request

```bash
curl -X GET 'https://api.suger.cloud/ai/org/{orgId}/revenue/record-query' \
  -H "Authorization: Bearer $SUGER_TOKEN"
```

### Response — 200

```json
{}
```

### Error — 400

```json
{
  "error": "string",
  "detail": "string"
}
```

---

API reference: https://doc.fours.com/api/
