Calculated Fields

CalculatedField

id
string (ID) ^[0-9a-fA-F]{24}$

24 character alpha-numeric BSON identifier

account_id
string (ID) ^[0-9a-fA-F]{24}$

24 character alpha-numeric BSON identifier

name
required
string non-empty
type
required
string
Enum: "number" "string"
description
string or null
required
Array of objects (CalculatedFieldRule) <= 50 items
fallback
required
string or null non-empty
created_at
string <date-time> (Timestamp)
updated_at
string <date-time> (Timestamp)
{
  • "id": "5fd4371e940df5a34a3888b2",
  • "account_id": "5fd4371e940df5a34a3888b2",
  • "name": "string",
  • "type": "number",
  • "description": "string",
  • "rules": [
    • {
      • "id": "1aacd0",
      • "value": "string",
      • "rule_set": {
        • "id": "1aacd0",
        • "op": "and",
        • "rules": [
          • {
            • "id": "1aacd0",
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "fallback": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

List calculated fields

Returns all calculated fields defined for the account. Returns 404 when the calculated fields feature is disabled for the account.

SecurityAPIKey
Responses
200

OK

401

Authorization information is missing or invalid.

404

The calculated fields feature is disabled for this account.

get/calculated_fields
Request samples
Response samples
application/json
[
  • {
    • "id": "5fd4371e940df5a34a3888b2",
    • "account_id": "5fd4371e940df5a34a3888b2",
    • "name": "string",
    • "type": "number",
    • "description": "string",
    • "rules": [
      • {
        • "id": "1aacd0",
        • "value": "string",
        • "rule_set": {
          • "id": "1aacd0",
          • "op": "and",
          • "rules": [
            • {
              • "id": "1aacd0",
              • "lhv": "string",
              • "op": "is equal to",
              • "rhv": "TX",
              • "rule_set": { }
              }
            ]
          }
        }
      ],
    • "fallback": "string",
    • "created_at": "2019-08-24T14:15:22Z",
    • "updated_at": "2019-08-24T14:15:22Z"
    }
]

Create a calculated field

Create a new account-level calculated field. Returns 404 when the calculated fields feature is disabled for the account.

SecurityAPIKey
Request
Request Body schema: application/json
required
name
required
string non-empty
type
required
string
Enum: "number" "string"
description
string or null
required
Array of objects (CalculatedFieldRule) <= 50 items
fallback
required
string or null non-empty
Responses
201

Created

401

Authorization information is missing or invalid.

404

The calculated fields feature is disabled for this account.

422

Validation failed

post/calculated_fields
Request samples
application/json
{
  • "name": "string",
  • "type": "number",
  • "description": "string",
  • "rules": [
    • {
      • "value": "string",
      • "rule_set": {
        • "op": "and",
        • "rules": [
          • {
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "fallback": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}
Response samples
application/json
{
  • "id": "5fd4371e940df5a34a3888b2",
  • "account_id": "5fd4371e940df5a34a3888b2",
  • "name": "string",
  • "type": "number",
  • "description": "string",
  • "rules": [
    • {
      • "id": "1aacd0",
      • "value": "string",
      • "rule_set": {
        • "id": "1aacd0",
        • "op": "and",
        • "rules": [
          • {
            • "id": "1aacd0",
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "fallback": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Get a calculated field

Fetch a single calculated field. Returns 404 when the calculated fields feature is disabled for the account.

SecurityAPIKey
Request
path Parameters
id
required
string (ID) ^[0-9a-fA-F]{24}$

24 character alpha-numeric BSON identifier

Example: 5fd4371e940df5a34a3888b2
Responses
200

OK

401

Authorization information is missing or invalid.

404

The calculated field was not found, or the feature is disabled.

get/calculated_fields/{id}
Request samples
Response samples
application/json
{
  • "id": "5fd4371e940df5a34a3888b2",
  • "account_id": "5fd4371e940df5a34a3888b2",
  • "name": "string",
  • "type": "number",
  • "description": "string",
  • "rules": [
    • {
      • "id": "1aacd0",
      • "value": "string",
      • "rule_set": {
        • "id": "1aacd0",
        • "op": "and",
        • "rules": [
          • {
            • "id": "1aacd0",
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "fallback": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Update a calculated field

Update an existing calculated field. name and type cannot be changed. Returns 404 when the calculated fields feature is disabled for the account.

SecurityAPIKey
Request
path Parameters
id
required
string (ID) ^[0-9a-fA-F]{24}$

24 character alpha-numeric BSON identifier

Example: 5fd4371e940df5a34a3888b2
Request Body schema: application/json
required
name
required
string non-empty
type
required
string
Enum: "number" "string"
description
string or null
required
Array of objects (CalculatedFieldRule) <= 50 items
fallback
required
string or null non-empty
Responses
200

OK

401

Authorization information is missing or invalid.

404

The calculated field was not found, or the feature is disabled.

422

Validation failed

put/calculated_fields/{id}
Request samples
application/json
{
  • "name": "string",
  • "type": "number",
  • "description": "string",
  • "rules": [
    • {
      • "value": "string",
      • "rule_set": {
        • "op": "and",
        • "rules": [
          • {
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "fallback": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}
Response samples
application/json
{
  • "id": "5fd4371e940df5a34a3888b2",
  • "account_id": "5fd4371e940df5a34a3888b2",
  • "name": "string",
  • "type": "number",
  • "description": "string",
  • "rules": [
    • {
      • "id": "1aacd0",
      • "value": "string",
      • "rule_set": {
        • "id": "1aacd0",
        • "op": "and",
        • "rules": [
          • {
            • "id": "1aacd0",
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "fallback": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}

Delete a calculated field

Delete a calculated field that is not referenced by any flow. Returns 404 when the calculated fields feature is disabled for the account. Returns 403 when a flow still references the field.

SecurityAPIKey
Request
path Parameters
id
required
string (ID) ^[0-9a-fA-F]{24}$

24 character alpha-numeric BSON identifier

Example: 5fd4371e940df5a34a3888b2
Responses
200

OK

401

Authorization information is missing or invalid.

403

The calculated field is referenced by one or more flows.

404

The calculated field was not found, or the feature is disabled.

delete/calculated_fields/{id}
Request samples
Response samples
application/json
{
  • "id": "5fd4371e940df5a34a3888b2",
  • "account_id": "5fd4371e940df5a34a3888b2",
  • "name": "string",
  • "type": "number",
  • "description": "string",
  • "rules": [
    • {
      • "id": "1aacd0",
      • "value": "string",
      • "rule_set": {
        • "id": "1aacd0",
        • "op": "and",
        • "rules": [
          • {
            • "id": "1aacd0",
            • "lhv": "string",
            • "op": "is equal to",
            • "rhv": "TX",
            • "rule_set": { }
            }
          ]
        }
      }
    ],
  • "fallback": "string",
  • "created_at": "2019-08-24T14:15:22Z",
  • "updated_at": "2019-08-24T14:15:22Z"
}