API Reference
Create a job template
Create a job template
POST /api/job-templates
Create a job template
Operation ID: createJobTemplate
Authentication
Option 1
- BearerAuth (
http bearer) API key token. Create via POST /api/api-keys. Format:envoy_<hex>
Option 2
- CookieAuth (
apiKey) Session cookie set after login + TOTP verification
Request body
The request body is required.
application/json
- Type:
object - Properties:
name(string,required)description(string)yaml_content(string,required) — Job template definition in YAML format (DAG of tasks + connectors)
Success responses
201
Template created with DAG
Content type: application/json
- Type:
JobTemplate & object - All of:
- Variant 1:
- Reference:
JobTemplate- Type:
object - Properties:
id(integer)name(string)description(string | null)- Nullable: yes
yaml_content(string)status(string)- Allowed values:
active,archived
- Allowed values:
created_at(string)- Format:
date-time
- Format:
updated_at(string)- Format:
date-time
- Format:
- Type:
- Reference:
- Variant 2:
- Type:
object - Properties:
dag(object | null)- Nullable: yes
- Properties:
tasks(object)- Additional properties: allowed
levels(array<array<string>>)- Items:
- Type:
array<string> - Items:
- Type:
string
- Type:
- Type:
- Items:
connectors(object | null)- Nullable: yes
- Additional properties:
- Type:
object - Properties:
type(string)
- Type:
- Type:
- Variant 1:
Error responses
400
Validation error
Content type: application/json
- Reference:
Error- Type:
object - Properties:
error(string)- Example:
NOT_FOUND
- Example:
message(string)- Example:
Resource not found
- Example:
- Type:
Example:
{
"error": "VALIDATION_ERROR",
"message": "Invalid input"
}Examples
cURL
curl --request POST \
--url 'https://your-envoy.example.com/api/job-templates' \
--header 'Authorization: Bearer $API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"name": "string",
"yaml_content": "string"
}'JavaScript (fetch)
const response = await fetch('https://your-envoy.example.com/api/job-templates', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"name": "string",
"yaml_content": "string"
}),
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);