curl --request POST \
--url https://api.blaxel.ai/v0/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"resourceType": "<string>",
"dockerConfig": "<string>",
"generation": "<string>",
"image": "<string>",
"memoryMb": 16384,
"volumeMb": 32768
}
'import requests
url = "https://api.blaxel.ai/v0/images"
payload = {
"name": "<string>",
"resourceType": "<string>",
"dockerConfig": "<string>",
"generation": "<string>",
"image": "<string>",
"memoryMb": 16384,
"volumeMb": 32768
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
resourceType: '<string>',
dockerConfig: '<string>',
generation: '<string>',
image: '<string>',
memoryMb: 16384,
volumeMb: 32768
})
};
fetch('https://api.blaxel.ai/v0/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.blaxel.ai/v0/images",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'resourceType' => '<string>',
'dockerConfig' => '<string>',
'generation' => '<string>',
'image' => '<string>',
'memoryMb' => 16384,
'volumeMb' => 32768
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.blaxel.ai/v0/images"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"resourceType\": \"<string>\",\n \"dockerConfig\": \"<string>\",\n \"generation\": \"<string>\",\n \"image\": \"<string>\",\n \"memoryMb\": 16384,\n \"volumeMb\": 32768\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.blaxel.ai/v0/images")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"resourceType\": \"<string>\",\n \"dockerConfig\": \"<string>\",\n \"generation\": \"<string>\",\n \"image\": \"<string>\",\n \"memoryMb\": 16384,\n \"volumeMb\": 32768\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blaxel.ai/v0/images")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"resourceType\": \"<string>\",\n \"dockerConfig\": \"<string>\",\n \"generation\": \"<string>\",\n \"image\": \"<string>\",\n \"memoryMb\": 16384,\n \"volumeMb\": 32768\n}"
response = http.request(request)
puts response.read_body{
"image": "<string>",
"message": "<string>",
"name": "<string>",
"resourceType": "<string>"
}Build a container image
Builds or imports a container image without creating a deployment. Provide a registry image reference to download and convert an existing image, or omit image to receive a presigned URL for uploading source code. Registry imports can specify memoryMb and volumeMb for the import worker. These settings do not change the resources of workloads using the image.
curl --request POST \
--url https://api.blaxel.ai/v0/images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"resourceType": "<string>",
"dockerConfig": "<string>",
"generation": "<string>",
"image": "<string>",
"memoryMb": 16384,
"volumeMb": 32768
}
'import requests
url = "https://api.blaxel.ai/v0/images"
payload = {
"name": "<string>",
"resourceType": "<string>",
"dockerConfig": "<string>",
"generation": "<string>",
"image": "<string>",
"memoryMb": 16384,
"volumeMb": 32768
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
resourceType: '<string>',
dockerConfig: '<string>',
generation: '<string>',
image: '<string>',
memoryMb: 16384,
volumeMb: 32768
})
};
fetch('https://api.blaxel.ai/v0/images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.blaxel.ai/v0/images",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'resourceType' => '<string>',
'dockerConfig' => '<string>',
'generation' => '<string>',
'image' => '<string>',
'memoryMb' => 16384,
'volumeMb' => 32768
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.blaxel.ai/v0/images"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"resourceType\": \"<string>\",\n \"dockerConfig\": \"<string>\",\n \"generation\": \"<string>\",\n \"image\": \"<string>\",\n \"memoryMb\": 16384,\n \"volumeMb\": 32768\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.blaxel.ai/v0/images")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"resourceType\": \"<string>\",\n \"dockerConfig\": \"<string>\",\n \"generation\": \"<string>\",\n \"image\": \"<string>\",\n \"memoryMb\": 16384,\n \"volumeMb\": 32768\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.blaxel.ai/v0/images")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"resourceType\": \"<string>\",\n \"dockerConfig\": \"<string>\",\n \"generation\": \"<string>\",\n \"image\": \"<string>\",\n \"memoryMb\": 16384,\n \"volumeMb\": 32768\n}"
response = http.request(request)
puts response.read_body{
"image": "<string>",
"message": "<string>",
"name": "<string>",
"resourceType": "<string>"
}Authorizations
OAuth2 authentication with JWT tokens
Body
Name of the image to build
Resource type (agent, function, sandbox, job)
Docker configuration JSON containing credentials for the source registry.
Runtime generation (e.g., mk3). Defaults to mk3 if not specified.
A pre-built Docker image reference (e.g., docker.io/myorg/myimage:latest). References with a registry hostname start an asynchronous import that downloads and converts the image for the resource runtime.
Memory for the registry import worker in MiB. Only supported when image is a registry reference. When omitted, the platform default is used.
1 <= x <= 3276816384
Temporary scratch disk for the registry import worker in MiB. Only supported when image is a registry reference. When omitted, the platform default is used. Set to 0 to use memory-backed scratch. Positive values are not supported for HIPAA workspaces.
0 <= x <= 13107232768
Was this page helpful?