GoliathDevelopersGet an API key
Reference/Propertiesgenerated from the gateway manifest

saveFilter

Create a saved filter. type CONTACT runs with filterContacts, PROPERTY with filterProperties, DEAL.

POST/api/v1/callWRITEidempotent · 24 hruns as the key's owner
View as Markdown

Create a saved filter. type CONTACT runs with filterContacts, PROPERTY with filterProperties, DEAL (status, title, pipeline stage, assignees, deal custom fields) with filterDeals: find deal filters with listDealFilters; the Deals board shows no saved-filter list, so tell the user it lives in the API. Other FilterType values are rejected. root is the filter-tree DSL, a recursive group: { id, operator: "AND"|"OR", negated?: boolean, conditions: [{ id, fieldId, value }], groups: [<group>] }. negated: true inverts a whole GROUP (group-level only): the way to say "not already on any of my lists". EVERY group and condition needs its own caller-minted non-empty id (mint a UUID each); missing ids are the most common rejection. Every fieldId must be a real field of the domain: an unknown one, or a bad value, rejects the whole save naming the field and saves nothing, so NEVER probe by saving: read listFilterFields FIRST. Geo conditions take ids: countyFilters a fips from searchCounties, cityFilters a city id from searchCities (a county name or unknown FIPS is rejected on any type, a bare city name on PROPERTY). To see what a tree DOES first (its count, whether it keeps records with no value) run it inline as filterTree on filterProperties/filterContacts/countContacts, which saves nothing. Save only the final filter the user asked for: a measuring filter is visible to them and their team. File it into a folder with folderId (listFilterFolders). Owner + org come from the API key; no userId/organizationId input, so a key cannot plant a filter in another tenant. The response may carry warnings: non-fatal notes on the saved criteria (e.g. same-named counties from DIFFERENT states, like Cook, IL + Cook, MN: saved, and it matches all of them). RELAY each one with the result, not as a failure; if the selection is not what the user meant, fix it with updateFilter.

curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "saveFilter",
    "variables": {
      "type": "PROPERTY",
      "name": "<String>",
      "root": "<JSON>"
    }
  }'
import { GoliathClient } from '@goliath-data/sdk'

const goliath = new GoliathClient({
  apiKey: process.env.GOLIATH_API_KEY!,
  baseUrl: 'https://server.goliathdata.com',
})

// Enum values as strings: the SDK's enum types aren't exported yet, so assert to the method's variables type.
const variables = {
  type: 'PROPERTY',
  name: '<String>',
  root: '<JSON>'
} as Parameters<typeof goliath.properties.saveFilter>[0]

const result = await goliath.properties.saveFilter(variables, { idempotencyKey: crypto.randomUUID() })
const res = await fetch('https://server.goliathdata.com/api/v1/call', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.GOLIATH_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({
    operationId: 'saveFilter',
    variables: {
      type: 'PROPERTY',
      name: '<String>',
      root: '<JSON>'
    }
  }),
})
const { data, errors } = await res.json()

Variables

The example sends only what the schema requires. Some operations also need one of several optional variables (one filter or another, say); the description above says which.

typeFilterType!required
PROPERTYCONTACTPIPELINE_ITEMDEALOWNERPOSTENTITYPERSONUSERORGANIZATION
nameString!required
rootJSON!required
descriptionString
folderIdID
isPrivateBoolean
isDefaultBoolean
inSavedAreasBoolean

Response

What comes back under data: a list shows as one entry, and a value as its type.

response shape
{
  "data": {
    "filterMutation": {
      "saveFilter": {
        "id": "<ID>",
        "name": "…",
        "type": "PROPERTY",
        "isPrivate": true,
        "isDefault": true,
        "createdAt": "2026-01-01T00:00:00.000Z",
        "warnings": [
          "…"
        ]
      }
    }
  }
}

Errors

Idempotency

Send an Idempotency-Key of 1 to 255 characters. A finished request retried with the same key replays its stored response, marked Idempotency-Replayed: true; one still in flight returns 409 idempotency_conflict. Keys expire after 24 hours. Write without fear →