Bolt API

Overview

The Bolt API allows you to easily manage and control Bolt schedules and runs within your workspace.

List Bolt schedules

This endpoint will return the active Bolt schedules in your workspace.

Example Request

import requests
import os

# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"

graphql_query = """
query ListBoltSchedules {
    listBoltSchedules(offset: 0, limit: 10, showInactive: false) {
        schedules {
            name
            schedule
            owner
            lastRunAt
            lastRunState
            nextRunAt
            id
            uuid
            source
            turboCi {
                enabled
                deferredScheduleName
                successfulRunOnly
            }
            deferredSchedule {
                deferredScheduleName
                enabled
                successfulRunOnly
            }
            commands
            gitBranch
            slackOn
            slackNotify
            emailOn
            emailNotify
        }
        totalCount
    }
}
  """
  
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
      "Content-Type": "application/json",
      "X-API-KEY": api_key,
      "X-API-SECRET": api_secret,
  })

print(response.json())
Example response
{
  "data": {
    "listBoltSchedules": {
      "schedules": [
        {
          "name": "fabio-chld-yaml",
          "schedule": "OFF",
          "owner": "fabio@paradime.io",
          "lastRunAt": null,
          "lastRunState": null,
          "nextRunAt": null,
          "id": 973767,
          "uuid": "f5f98a76-c978-31c5-9296-aae9903653f4",
          "source": "yaml",
          "turboCi": null,
          "deferredSchedule": null,
          "commands": ["dbt run"],
          "gitBranch": "main",
          "slackOn": [""],
          "slackNotify": [""],
          "emailOn": [""],
          "emailNotify": [""]
        }
      ],
      "totalCount": 26
    }
  }
}

Get Bolt schedule details

This endpoint will enable you to check the status of a schedule by passing a Bolt scheduleName .

Example Request

import requests
import os

# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"

graphql_query = """
query BoltScheduleName {
    boltScheduleName(scheduleName: "daily run") {
        ok
        latestRunId
        commands
        owner
        schedule
        uuid
        source
    }
}
  """
  
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
      "Content-Type": "application/json",
      "X-API-KEY": api_key,
      "X-API-SECRET": api_secret,
  })

print(response.json())
  
Example response
{
  "data": {
    "boltScheduleName": {
      "ok": true,
      "latestRunId": 15475,
      "commands": ["dbt test"],
      "owner": "john@acme.io",
      "schedule": "OFF",
      "uuid": "a3d6ceea-abe3-333e-ac8b-c0b48cce5678",
      "source": "ui"
    }
  }
}

Trigger a Bolt run

This endpoint will enable you to trigger a Bolt schedule run by passing a schedule name.

Example Request

import requests
import os

# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"

graphql_query = """
mutation TriggerBoltRun {
    triggerBoltRun(scheduleName: "daily run") {
        runId
    }
}
  """
  
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
      "Content-Type": "application/json",
      "X-API-KEY": api_key,
      "X-API-SECRET": api_secret,
  })

print(response.json())
Example response
{
  "data": {
    "triggerBoltRun": {
      "runId": 15477
    }
  }
}

Trigger a Bolt run with custom commands

This endpoint will enable you to trigger a Bolt schedule with a custom command and overwrite the actual commands defined in the schedule for that particular run.

This only modifies the command at runtime for the triggered Bolt schedule and not the commands configuration defined in the schedule.

Example Request

import requests
import os

# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"

graphql_query = """
mutation TriggerBoltRun {
    triggerBoltRun(scheduleName: "daily run", commands: ["dbt compile", "dbt test"]) {
        runId
    }
}
  """
  
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
      "Content-Type": "application/json",
      "X-API-KEY": api_key,
      "X-API-SECRET": api_secret,
  })

print(response.json())
  
Example response
{
  "data": {
    "triggerBoltRun": {
      "runId": 15483
    }
  }
}

Trigger a Bolt run with a custom git branch

This endpoint will enable you to trigger a Bolt schedule with a custom git commit and overwrite the branch name defined in the schedule configuration.

This only modifies the commit at runtime for the triggered Bolt schedule and not the branch name defined in the schedule.

Example Request

import requests
import os

# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"

graphql_query = """
mutation TriggerBoltRun {
    triggerBoltRun(scheduleName: "daily run", branch: "feature-branch-123") {
        runId
    }
}
  """
  
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
      "Content-Type": "application/json",
      "X-API-KEY": api_key,
      "X-API-SECRET": api_secret,
  })

print(response.json())
Example response
{
  "data": {
    "triggerBoltRun": {
      "runId": 15483
    }
  }
}

Cancel a Bolt run

This endpoint will enable you to cancel a Bolt run by passing the runID of a Bolt schedule.

Example Request

import requests
import os

# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"

graphql_query = """
mutation CancelBoltRun {
    cancelBoltRun(scheduleRunId: 15507) {
        ok
    }
}
  """
  
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
      "Content-Type": "application/json",
      "X-API-KEY": api_key,
      "X-API-SECRET": api_secret,
  })

print(response.json())
  
Example response
{
  "data": {
    "cancelBoltRun": {
      "ok": true
    }
  }
}

Get Bolt run status

This endpoint will enable you to check the status of a Bolt run run by passing the runID.

Example Request

import requests
import os

# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"

graphql_query = """
query BoltRunStatus {
    boltRunStatus(runId: 15509) {
        ok
        state
        commands {
            id
            command
            startDttm
            endDttm
            stdout
            stderr
            returnCode
        }
    }
}
  """
  
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
      "Content-Type": "application/json",
      "X-API-KEY": api_key,
      "X-API-SECRET": api_secret,
  })

print(response.json())
Example response
{
  "data": {
    "boltRunStatus": {
      "ok": true,
      "state": "ERROR",
      "commands": [
        {
          "id": 59241,
          "command": "dbt test",
          "startDttm": "2024-08-27 22:59:01.476387",
          "endDttm": "2024-08-27 22:59:11.323692",
          "stdout": "the command logs",
          "stderr": "the command logs",
          "returnCode": 1
        },
        {
          "id": 59239,
          "command": "git clone ...",
          "startDttm": "2024-08-27 22:58:57.738046",
          "endDttm": "2024-08-27 22:58:59.135456",
          "stdout": "",
          "stderr": "the command logs",
          "returnCode": -10
        },
        {
          "id": 59240,
          "command": "dbt deps",
          "startDttm": "2024-08-27 22:58:59.234308",
          "endDttm": "2024-08-27 22:59:01.468001",
          "stdout": "the command logs",
          "stderr": "the command logs",
          "returnCode": -10
        }
      ]
    }
  }
}

Get Bolt command details

This endpoint will enable you to extract for a given command all the related details including raw error logs by passing a commandId. This is normally used in conjunction with the Paradime Webhooks.

Example Request

import requests
import os

# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"

graphql_query = """
query BoltCommand {
    boltCommand(commandId: 59241) {
        command
        startDttm
        endDttm
        stdout
        stderr
        returnCode
        scheduleRunId
        resources {
            id
            path
        }
        ok
    }
}
  """
  
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
      "Content-Type": "application/json",
      "X-API-KEY": api_key,
      "X-API-SECRET": api_secret,
  })

print(response.json())
  
Example response
{
  "data": {
    "boltCommand": {
      "command": "dbt test",
      "startDttm": "2024-08-27 22:59:01.476387",
      "endDttm": "2024-08-27 22:59:11.323692",
      "stdout": "your command log",
      "stderr": "your command log",
      "returnCode": 1,
      "scheduleRunId": 15509,
      "resources": [
        {"id": 306227, "path": "target/partial_parse.msgpack"},
        {"id": 306228, "path": "target/manifest.json"},
        {"id": 306229, "path": "target/semantic_manifest.json"},
        {"id": 306230, "path": "target/graph_summary.json"},
        {"id": 306231, "path": "target/graph.gpickle"},
        {"id": 306232, "path": "target/compiled/demo_sales_project/data/schema.yml/not_null_customer_conversions_revenue.sql"},
        {"id": 306233, "path": "target/compiled/demo_sales_project/data/schema.yml/not_null_customer_conversions_converted_at.sql"},
        {"id": 306234, "path": "target/compiled/demo_sales_project/data/schema.yml/not_null_customer_conversions_customer_id.sql"},
        {"id": 306235, "path": "target/compiled/demo_sales_project/data/schema.yml/not_null_sessions_customer_id.sql"},
        {"id": 306236, "path": "target/compiled/demo_sales_project/data/schema.yml/not_null_sessions_ended_at.sql"},
        {"id": 306237, "path": "target/compiled/demo_sales_project/data/schema.yml/not_null_sessions_started_at.sql"},
        {"id": 306238, "path": "target/compiled/demo_sales_project/data/schema.yml/unique_customer_conversions_customer_id.sql"},
        {"id": 306239, "path": "target/compiled/demo_sales_project/models/staging/schema.yml/accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef.sql"},
        {"id": 306240, "path": "target/compiled/demo_sales_project/models/staging/schema.yml/accepted_values_stg_orders_status__placed.sql"},
        {"id": 306241, "path": "target/compiled/demo_sales_project/models/staging/schema.yml/not_null_stg_payments_payment_id.sql"},
        {"id": 306242, "path": "target/compiled/demo_sales_project/models/staging/schema.yml/not_null_stg_customers_customer_id.sql"},
        {"id": 306243, "path": "target/compiled/demo_sales_project/models/staging/schema.yml/unique_stg_customers_customer_id.sql"},
        {"id": 306244, "path": "target/compiled/demo_sales_project/models/staging/schema.yml/unique_stg_payments_payment_id.sql"},
        {"id": 306245, "path": "target/compiled/demo_sales_project/models/marts/core/schema.yml/accepted_values_order_items_7244335ae3a9655e09872a7a5b8cb110.sql"},
        {"id": 306246, "path": "target/compiled/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_amount.sql"},
        {"id": 306247, "path": "target/compiled/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_coupon_amount.sql"},
        {"id": 306248, "path": "target/compiled/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_bank_transfer_amount.sql"},
        {"id": 306249, "path": "target/compiled/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_credit_card_amount.sql"},
        {"id": 306250, "path": "target/compiled/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_customer_id.sql"},
        {"id": 306251, "path": "target/compiled/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_order_id.sql"},
        {"id": 306252, "path": "target/compiled/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_gift_card_amount.sql"},
        {"id": 306253, "path": "target/compiled/demo_sales_project/models/marts/core/schema.yml/unique_order_items_order_id.sql"},
        {"id": 306254, "path": "target/compiled/demo_sales_project/models/marts/core/intermediate/schema.yml/accepted_values_order_payments_b6878290bdd2ef4d6ef0513a1d8fdbbc.sql"},
        {"id": 306255, "path": "target/compiled/demo_sales_project/models/marts/core/intermediate/schema.yml/not_null_order_payments_payment_id.sql"},
        {"id": 306256, "path": "target/compiled/demo_sales_project/models/marts/core/intermediate/schema.yml/relationships_order_payments_1c8c3f46d5739a85e060a829410bf06d.sql"},
        {"id": 306257, "path": "target/compiled/demo_sales_project/models/marts/core/intermediate/schema.yml/unique_order_payments_payment_id.sql"},
        {"id": 306258, "path": "target/compiled/demo_sales_project/tests/assert_total_payment_amount_is_positive.sql"},
        {"id": 306259, "path": "target/run/demo_sales_project/data/schema.yml/not_null_customer_conversions_converted_at.sql"},
        {"id": 306260, "path": "target/run/demo_sales_project/data/schema.yml/not_null_customer_conversions_revenue.sql"},
        {"id": 306261, "path": "target/run/demo_sales_project/data/schema.yml/not_null_customer_conversions_customer_id.sql"},
        {"id": 306262, "path": "target/run/demo_sales_project/data/schema.yml/not_null_sessions_customer_id.sql"},
        {"id": 306263, "path": "target/run/demo_sales_project/data/schema.yml/not_null_sessions_ended_at.sql"},
        {"id": 306264, "path": "target/run/demo_sales_project/data/schema.yml/not_null_sessions_started_at.sql"},
        {"id": 306265, "path": "target/run/demo_sales_project/data/schema.yml/unique_customer_conversions_customer_id.sql"},
        {"id": 306266, "path": "target/run/demo_sales_project/tests/assert_total_payment_amount_is_positive.sql"},
        {"id": 306267, "path": "target/run/demo_sales_project/models/staging/schema.yml/accepted_values_stg_payments_c7909fb19b1f0177c2bf99c7912f06ef.sql"},
        {"id": 306268, "path": "target/run/demo_sales_project/models/staging/schema.yml/accepted_values_stg_orders_status__placed.sql"},
        {"id": 306269, "path": "target/run/demo_sales_project/models/staging/schema.yml/not_null_stg_payments_payment_id.sql"},
        {"id": 306270, "path": "target/run/demo_sales_project/models/staging/schema.yml/not_null_stg_customers_customer_id.sql"},
        {"id": 306271, "path": "target/run/demo_sales_project/models/staging/schema.yml/unique_stg_customers_customer_id.sql"},
        {"id": 306272, "path": "target/run/demo_sales_project/models/staging/schema.yml/unique_stg_payments_payment_id.sql"},
        {"id": 306273, "path": "target/run/demo_sales_project/models/marts/core/schema.yml/accepted_values_order_items_7244335ae3a9655e09872a7a5b8cb110.sql"},
        {"id": 306274, "path": "target/run/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_amount.sql"},
        {"id": 306275, "path": "target/run/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_coupon_amount.sql"},
        {"id": 306276, "path": "target/run/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_bank_transfer_amount.sql"},
        {"id": 306277, "path": "target/run/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_credit_card_amount.sql"},
        {"id": 306278, "path": "target/run/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_customer_id.sql"},
        {"id": 306279, "path": "target/run/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_gift_card_amount.sql"},
        {"id": 306280, "path": "target/run/demo_sales_project/models/marts/core/schema.yml/not_null_order_items_order_id.sql"},
        {"id": 306281, "path": "target/run/demo_sales_project/models/marts/core/schema.yml/unique_order_items_order_id.sql"},
        {"id": 306282, "path": "target/run/demo_sales_project/models/marts/core/intermediate/schema.yml/accepted_values_order_payments_b6878290bdd2ef4d6ef0513a1d8fdbbc.sql"},
        {"id": 306283, "path": "target/run/demo_sales_project/models/marts/core/intermediate/schema.yml/not_null_order_payments_payment_id.sql"},
        {"id": 306284, "path": "target/run/demo_sales_project/models/marts/core/intermediate/schema.yml/relationships_order_payments_1c8c3f46d5739a85e060a829410bf06d.sql"},
        {"id": 306285, "path": "target/run/demo_sales_project/models/marts/core/intermediate/schema.yml/unique_order_payments_payment_id.sql"},
        {"id": 306286, "path": "target/run_results.json"},
        {"id": 306287, "path": "logs/dbt.log"}
      ],
      "ok": true
    }
  }
}

Get Bolt command resource URL

This endpoint will enable you to extract for a given command the related resource generated by the execution of the command, for example the run_results.json or the manifest.json by passing a resourceId. This is normally used in conjunction with the Paradime Webhooks.

Example Request

import requests
import os

# API credentials
api_endpoint = "<YOUR_API_ENDPOINT>"
api_key = "<YOUR_API_KEY>"
api_secret = "<YOUR_API_SECRET>"

graphql_query = """
query BoltResourceUrl {
    boltResourceUrl(resourceId: 306228) {
        ok
        url
    }
}
  """
  
response = requests.post(api_endpoint, json={"query": graphql_query}, headers={
      "Content-Type": "application/json",
      "X-API-KEY": api_key,
      "X-API-SECRET": api_secret,
  })

print(response.json())
Example response
{
  "data": {
    "boltResourceUrl": {
      "ok": true,
      "url": "the url to the resource e.g. manifest.json"
    }
  }
}

Last updated

#350: Bolt - Template fixes pt 1

Change request updated