# surveyDeals

Survey deals: findDeals' search (same visibility), without stageName/outcome/windows/totals, with a deliberately LEAN row: deal id, title, isArchived, stage NAME, pipeline NAME, assigned users by NAME, open-task counts, and custom-field values. Use this whenever the question is about MANY deals rather than about a few in full: "who holds which card", "which cards have no Difficulty set", "what is on this board", any board-wide count or grouping. Use findDeals instead when you need money (commission / team split), linked contacts, close date, price, createdAt/updatedAt, or the ids inside a row; use getDeal for one deal in full. A capped result DROPS WHOLE DEALS silently: when `truncated` is true, lower `limit` and page (`__omittedItems` counts the dropped rows). `totalCount` is the UNPAGED total to quote for "how many". IDS: the row carries names, not ids, for everything except the deal itself: stage ids from listStagesOfPipelines, user ids from listTeammates, custom-field ids and types from listDealCustomFields. The deal `id` IS here: pass it to getDeal or updateDeal to act on a row. ARCHIVED deals are included when isArchived is omitted, as in findDeals; check each row's isArchived. ASSIGNEES: an EMPTY `users` means UNASSIGNED; filter with hasAssignedUsers / userIds as in findDeals. No linked contacts here. CUSTOM FIELDS: each entry carries the value plus the field NAME (no id, no type). Read the value from the ONE slot matching the field type: TEXT/LINK -> textValue, NUMBER/DOLLAR -> numberValue (a plain number, NOT cents), DATE -> dateValue (ISO 8601), DROPDOWN -> dropdownSelectedValues (the option LABEL strings). A field the deal has never been given a value for is ABSENT from the list rather than present-and-null, so an empty list means nothing is filled in on that deal: never that the pipeline has no fields (get the definitions from listDealCustomFields(pipelineId)). TASKS: `taskSummary` counts open tasks and appointments on the DEAL (not its contacts); 0 means none, so "which deals have no task" is this page. In Ask Goliath omitting isArchived reads live deals only; null reads both.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "surveyDeals", "variables": {...} }`
- Scope: `READ`
- Type: query
- Idempotency: a read; rejects `Idempotency-Key`
- Rate-limited: no
- Result cap: `limit` is clamped to 45, without an error

## Variables

- `titleContains`: `String`
- `contactId`: `ID`
- `contactIds`: `[ID!]`
- `pipelineId`: `ID`
- `stageId`: `ID`
- `isArchived`: `Boolean`
- `hasAssignedUsers`: `Boolean`
- `userIds`: `[ID!]`
- `limit`: `Int` (default `16`)
- `offset`: `Int` (default `0`)

## Response (data, an example)

```json
{
  "dealQuery": {
    "findDeals": {
      "deals": [
        {
          "id": "<ID>",
          "title": "…",
          "isArchived": true,
          "stage": {
            "name": "…"
          },
          "pipeline": {
            "name": "…"
          },
          "users": [
            {
              "firstName": "…",
              "lastName": "…"
            }
          ],
          "taskSummary": {
            "openTaskCount": 0,
            "openAppointmentCount": 0
          },
          "customFieldValues": [
            {
              "textValue": "…",
              "numberValue": 0,
              "dateValue": "2026-01-01T00:00:00.000Z",
              "dropdownSelectedValues": [
                "…"
              ],
              "dealCustomField": {
                "name": "…"
              }
            }
          ]
        }
      ],
      "totalCount": 0,
      "hasMore": true
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operationId": "surveyDeals",
    "variables": {}
  }'
```
