Find a guide, feature, or API endpoint. Try “FTP”, “alerts”, or “instruments”.

Browse documentation

Docs/API reference / Calculated variables

Create calculated variables

Requires `developer_api.calculated_variables.create` on the project-scoped Developer API connection. Use the API origin supplied for your deployment. Unknown query parameters and unexpected request bodies are rejected.

POST/dev-api/v1/p/{project_id}/instruments/{instrument_id}/calculated-variablesAll endpoints ↗

The request panel saves credentials and API settings in this browser. Privacy details

POST
/dev-api/v1/p/{project_id}/instruments/{instrument_id}/calculated-variables

Authorization

developerApiKey
AuthorizationBearer <token>

Project-scoped Developer API connection key. Grant only the required operation permissions.

In: header

Path Parameters

project_id*string
Match.*\S.*
Length1 <= length <= 128
instrument_id*string
Match.*\S.*
Length1 <= length <= 128

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

bash
curl -X POST "https://example.com/dev-api/v1/p/string/instruments/string/calculated-variables" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string",
    "calculations": [
      {
        "inputs": [
          {
            "id": "stringstringstringstr",
            "kind": "self_variable",
            "variable_id": "string"
          }
        ]
      }
    ],
    "is_time_variable": true
  }'
json
{
  "request_id": "string",
  "data": {
    "resource": {
      "lifecycle_state": "active",
      "archived_at": "2019-08-24T14:15:22Z",
      "archived_by": {
        "type": "user",
        "id": "string"
      },
      "id": "string",
      "instrument_id": "string",
      "name": "string",
      "alias": "string",
      "variable_type": "ingested",
      "unit": "cm",
      "expected_cadence_s": 1,
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "is_time_variable": true,
      "configuration_generation": 0,
      "calculations": [
        {
          "id": "stringstringstringstr",
          "start_time": "2019-08-24T14:15:22Z",
          "expression": "string",
          "editor_tokens": [
            {
              "kind": "text",
              "text": "string"
            }
          ],
          "inputs": [
            {
              "id": "stringstringstringstr",
              "kind": "self_variable",
              "variable_id": "string",
              "constant_id": null,
              "source_instrument_id": null,
              "past_buffer_seconds": null
            }
          ]
        }
      ],
      "value_type": "string",
      "view_options": {
        "hide": true,
        "graph": {
          "scale": {
            "min": 0,
            "max": 0,
            "interval": 1,
            "custom": false
          }
        }
      }
    },
    "recalculation_batch_run_id": "string"
  }
}