Generate a Badge Image
curl --request POST \
--url https://schoolmaker.co/api/v1/badges/{id}/generate_image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A blue star",
"style": "emoji"
}
'import requests
url = "https://schoolmaker.co/api/v1/badges/{id}/generate_image"
payload = {
"prompt": "A blue star",
"style": "emoji"
}
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({prompt: 'A blue star', style: 'emoji'})
};
fetch('https://schoolmaker.co/api/v1/badges/{id}/generate_image', 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://schoolmaker.co/api/v1/badges/{id}/generate_image",
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([
'prompt' => 'A blue star',
'style' => 'emoji'
]),
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://schoolmaker.co/api/v1/badges/{id}/generate_image"
payload := strings.NewReader("{\n \"prompt\": \"A blue star\",\n \"style\": \"emoji\"\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://schoolmaker.co/api/v1/badges/{id}/generate_image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A blue star\",\n \"style\": \"emoji\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://schoolmaker.co/api/v1/badges/{id}/generate_image")
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 \"prompt\": \"A blue star\",\n \"style\": \"emoji\"\n}"
response = http.request(request)
puts response.read_body{
"id": "BADGE_ID",
"status": "queued"
}{
"error": "Access denied"
}{
"error": "Record not found"
}{
"error": "Invalid arguments: /attributes/name minLength"
}{
"error": "Daily badge image generation limit reached"
}{
"error": "Internal server error"
}Badges
Generate a Badge Image
Generates a badge image using AI, replacing the current image. Requires school AI access and counts toward the daily badge generation limit. Check the badge details for the new image after processing.
POST
/
badges
/
{id}
/
generate_image
Generate a Badge Image
curl --request POST \
--url https://schoolmaker.co/api/v1/badges/{id}/generate_image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "A blue star",
"style": "emoji"
}
'import requests
url = "https://schoolmaker.co/api/v1/badges/{id}/generate_image"
payload = {
"prompt": "A blue star",
"style": "emoji"
}
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({prompt: 'A blue star', style: 'emoji'})
};
fetch('https://schoolmaker.co/api/v1/badges/{id}/generate_image', 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://schoolmaker.co/api/v1/badges/{id}/generate_image",
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([
'prompt' => 'A blue star',
'style' => 'emoji'
]),
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://schoolmaker.co/api/v1/badges/{id}/generate_image"
payload := strings.NewReader("{\n \"prompt\": \"A blue star\",\n \"style\": \"emoji\"\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://schoolmaker.co/api/v1/badges/{id}/generate_image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"A blue star\",\n \"style\": \"emoji\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://schoolmaker.co/api/v1/badges/{id}/generate_image")
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 \"prompt\": \"A blue star\",\n \"style\": \"emoji\"\n}"
response = http.request(request)
puts response.read_body{
"id": "BADGE_ID",
"status": "queued"
}{
"error": "Access denied"
}{
"error": "Record not found"
}{
"error": "Invalid arguments: /attributes/name minLength"
}{
"error": "Daily badge image generation limit reached"
}{
"error": "Internal server error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Badge ID in this school.
Required string length:
1 - 255Body
application/jsonapplication/x-www-form-urlencoded
Was this page helpful?