Skip to main content
PATCH
Change a saved query

Authorizations

Authorization
string
header
required

An API key, sent as Authorization: Bearer stfy_live_…. See Authentication for how to get one and which scopes it needs.

Path Parameters

key
string
required

The integration key, such as snowflake or salesforce

query_id
string
required

Body

application/json

Only what you send changes; null clears a field.

account_resolver
AccountResolverConfig · object | null

How to map record rows to internal Statisfy account IDs.

Used by warehouse integrations (postgres/redshift/bigquery/snowflake) and JIRA. The schema is integration-agnostic; resolver types are dispatched by the integration's hydrator.

custom_field_mappings
CustomFieldMappingConfig · object[] | null
custom_object_config
CustomObjectConfig · object | null

Configuration for custom object ingestion from a query.

entity_type
enum<string> | null
Available options:
account,
people
expected_version
integer | null

The config version you read. Sent: a change against a version that is no longer live is a 409 and writes nothing (0 = the config was never saved). Left out, the change always lands

Required range: x >= 0
group_by_columns
string[] | null
is_active
boolean | null
limit
integer | null
Required range: x >= 1
name
string | null
Required string length: 1 - 200
order_by_columns
string[] | null
period
enum<string> | null
Available options:
HOURLY,
TWO_HOURS,
FOUR_HOURS,
SIX_HOURS,
TWELVE_HOURS,
DAILY,
WEEKLY,
MONTHLY
person_resolver
PersonResolverConfig · object | null

How to map query result rows to internal Statisfy person/contact IDs.

Used only for queries with entity_type='people'. Maps a row's email column to a person; new people are upserted via process_person when not found. The account_resolver on the same query attaches the new person to an account (cust_id).

product_usage_mappings
ProductUsageMappingConfig · object[] | null
query_type
enum<string> | null
Available options:
custom_field,
product_usage,
custom_object
sql
string | null

One SELECT, in the warehouse's own dialect. It may use {START_DATE}, {END_DATE}, {START_DATE_SQL} and {END_DATE_SQL}, which each run fills with its period's dates

Required string length: 1 - 100000
transformers
ColumnTransformerConfig · object[] | null

Response

200 - application/json

Successful Response

A saved query as stored. Its resolver, mapping and transformer objects have the same shapes a create or a change takes.

account_resolver
Account Resolver · object | null
required
custom_field_mappings
Custom Field Mappings · object[] | null
required
custom_object_config
Custom Object Config · object | null
required
entity_type
enum<string>
required
Available options:
account,
people
group_by_columns
string[] | null
required
id
string | null
required

Stable id. Null only on a query saved before ids existed: any save of the config gives it one

is_active
boolean
required
limit
integer | null
required
name
string
required
order_by_columns
string[] | null
required
period
enum<string> | null
required
Available options:
HOURLY,
TWO_HOURS,
FOUR_HOURS,
SIX_HOURS,
TWELVE_HOURS,
DAILY,
WEEKLY,
MONTHLY
person_resolver
Person Resolver · object | null
required
product_usage_mappings
Product Usage Mappings · object[] | null
required
query_type
enum<string>
required
Available options:
custom_field,
product_usage,
custom_object
sql
string
required
transformers
Transformers · object[] | null
required
version
integer
required

The config's version: send it as expected_version with a change