Skip to main content
POST
/
v1
/
templates
/
buckets
/
from-bucket
/
{bucket_id}
Create Bucket Template
curl --request POST \
  --url https://api.mixpeek.com/v1/templates/buckets/from-bucket/{bucket_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "template_name": "<string>",
  "description": "<string>",
  "scope": "organization",
  "category": "<string>",
  "tags": [
    "<string>"
  ],
  "is_public": false
}
'
import requests

url = "https://api.mixpeek.com/v1/templates/buckets/from-bucket/{bucket_id}"

payload = {
"template_name": "<string>",
"description": "<string>",
"scope": "organization",
"category": "<string>",
"tags": ["<string>"],
"is_public": False
}
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({
template_name: '<string>',
description: '<string>',
scope: 'organization',
category: '<string>',
tags: ['<string>'],
is_public: false
})
};

fetch('https://api.mixpeek.com/v1/templates/buckets/from-bucket/{bucket_id}', 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.mixpeek.com/v1/templates/buckets/from-bucket/{bucket_id}",
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([
'template_name' => '<string>',
'description' => '<string>',
'scope' => 'organization',
'category' => '<string>',
'tags' => [
'<string>'
],
'is_public' => false
]),
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.mixpeek.com/v1/templates/buckets/from-bucket/{bucket_id}"

payload := strings.NewReader("{\n \"template_name\": \"<string>\",\n \"description\": \"<string>\",\n \"scope\": \"organization\",\n \"category\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"is_public\": false\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.mixpeek.com/v1/templates/buckets/from-bucket/{bucket_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"template_name\": \"<string>\",\n \"description\": \"<string>\",\n \"scope\": \"organization\",\n \"category\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"is_public\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.mixpeek.com/v1/templates/buckets/from-bucket/{bucket_id}")

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 \"template_name\": \"<string>\",\n \"description\": \"<string>\",\n \"scope\": \"organization\",\n \"category\": \"<string>\",\n \"tags\": [\n \"<string>\"\n ],\n \"is_public\": false\n}"

response = http.request(request)
puts response.read_body
{
  "template_id": "<string>",
  "template_name": "<string>",
  "source_resource_id": "<string>",
  "created_at": "2023-11-07T05:31:56Z"
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}
{
"status": 123,
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"details": {}
},
"success": false
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

bucket_id
string
required

Bucket ID

Body

application/json

Request to create a template from an existing resource.

template_name
string
required

Name for the new template

Required string length: 1 - 100
description
string | null

Description of the template's purpose (OPTIONAL)

Maximum string length: 1000
scope
enum<string>
default:organization

Template scope: 'organization' (all users in org), 'user' (only you), or 'system' (all organizations - requires Mixpeek admin email)

Available options:
system,
organization,
user,
public
category
string | null

Optional category for organizing templates

Maximum string length: 50
tags
string[]

Optional tags for the template

is_public
boolean
default:false

Whether this template should be publicly discoverable

Response

Successful Response

Response after creating a template from a resource.

template_id
string
required

ID of the created template

template_name
string
required

Name of the created template

template_type
enum<string>
required

Type of template created

Available options:
namespace,
retriever,
cluster,
collection,
bucket,
taxonomy,
scaffold
scope
enum<string>
required

Template scope

Available options:
system,
organization,
user,
public
source_resource_id
string
required

ID of the resource used to create this template

created_at
string<date-time>

Timestamp when template was created