Jobs
A general guide for submitting jobs via API
Once your Apps, Partitioning Engines, and Assembling Engines are ready, and you've linked them together using Job Templates, you're prepared to launch test and production jobs.
ByteNite utilizes an API to handle job requests — the Customer API— simplifying and standardizing the interaction with our server.
To begin using the API and familiarizing yourself with its endpoint, we recommend setting up a Postman collection. You can find more details at Create a Postman collection from ByteNite's OAS.
Below are the steps to configure and send a new job request, broken down and explained. You may refer to the official Jobs reference for a complete parameter list, response codes, and default code examples.
Get an Access Token
Begin by obtaining a temporary access token to authenticate your requests.
apiKey
string
Your ByteNite API Key
token
string
Your ByteNite access token
expiresIn
string
An expiration timeout in seconds
Example:
import requests
response = requests.post(
"https://api.bytenite.com/v1/auth/access_token",
json = {
"apiKey": "ey2WmEsSMK7wdxpK5MaEHXeWCD5KEJZ79Koe68yrHL4kdnnTXT01hu2iss43BdaCCMgJ3dBh2IOVCycTt1mwkT3QR1dLxRFpK7TW7ExvcuCXio6nKsGjk9dYY8nbsFffrUVvYSQYsuQoF3NIb8sS4MDyZfOgGKZL9z8x22cwrwEck7vIokVhQ9fyWRVU2vwRiX3X4bQFuqTkkWCi5Vfy8IkGkga7ZPMPb21FxqK6cHRJ3zmI1JZZoZZxERnQcWJTpZRyCP4SNTuRm3ueVDNntFqYWYYrseNLcCIS42MpR00Z9rI9I5xxuQD6VQvHVrpOaPucg1E4Vw54xXr2LKEy9uHcM5WUQHkdfhiXo6zyVbZMrbjLpepgeS4nEja="
}
)
token = response.json()["token"]Create a New Job
Submit a new job request using an existing job template, and give it a name.
Authorization
string
An active ByteNite access token
templateId
string
ID of the job template used for this job
name
string
A descriptive name for your job
description
string
An optional description with more information
job
object
A job object, containing job metadata
↳ id
string
The job identifier (automatically generated)
Example:
response = requests.post(
"https://api.bytenite.com/v1/customer/jobs",
headers = {
"Authorization": token
},
json = {
"name": "My job with img-gen-diffusers template",
"templateId": "img-gen-diffusers"
}
)
jobId = response.json()["job"]["id"]Submit a Data Source and Destination
Link a data source and destination to your job, specifying input and output options as documented in the Data Sources guide.
Connecting data sources is optional: if your app doesn't require any input data to work, or doesn't output data, you can specify a bypass data source descriptor.
jobId
string
The jobIdof your new job
Authorization
string
An active ByteNite access token
dataSource
object
A data source object, containing a dataSourceDescriptor and optional params
dataDestination
object
A data source object, containing a dataSourceDescriptor and optional params
Example:
response = requests.patch(
f"https://api.bytenite.com/v1/customer/jobs/{jobId}/datasource",
headers = {
"Authorization": token
},
json = {
"dataSource": {
"dataSourceDescriptor": "url",
"params": {
"@type": "type.googleapis.com/bytenite.data_source.HttpDataSource",
"url": "https://storage.googleapis.com/my-public-bucket/my-input-file.txt"
}
},
"dataDestination": {
"dataSourceDescriptor": "bucket"
}
}
)Submit Job Parameters
If your app, partitioner, or assembler expect parameters, provide them at this step. Parameters are organized under three keys: app, partitioner, and assembler for clarity.
If your template includes parameter schemas, the parameters you submit here will be validated immediately, and any errors will be returned.
jobId
string
The jobIdof your new job
Authorization
string
An active ByteNite access token
app
object
A JSON object containing parameters as expected by your app
partitioner
object
A JSON object containing parameters as expected by your partitioning engine
assembler
object
A JSON object containing parameters as expected by your assembling engine
Example:
response = requests.patch(
f"https://api.bytenite.com/v1/customer/jobs/{jobId}/params",
headers = {
"Authorization": token
},
json = {
"partitioner": {
"numImages": 20
},
"app": {
"prompt": "A beautiful sunset over the jungle"
},
"assembler": {
"outExtension": "jpeg"
}
}
)Launch the Job
Run the job, including execution configurations if needed.
Please note that you need this call to initiate the processing of your job. Without this step, your job will remain in a draft state.
jobId
string
The jobIdof your new job
Authorization
string
An active ByteNite access token
taskTimeout
integer
An optional timeout for tasks, in seconds. After this time, a task will be stopped.
jobTimeout
integer
An optional timeout for jobs, in seconds. After this time, the job and any running tasks will be stopped.
isTestJob
boolean
A flag for test jobs.
Example:
response = requests.post(
f"https://api.bytenite.com/v1/customer/jobs/{jobId}/run",
headers = {
"Authorization": token
},
json = {
"taskTimeout": 3600,
"jobTimeout": 86400,
"isTestJob": True
}
)Last updated
Was this helpful?

