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())
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())
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())
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())
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())
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())
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())
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())
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())
Last updated
Was this helpful?