curl --request POST \
--url https://api.migma.ai/v1/projects/{projectId}/knowledge-base \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"content": "<string>",
"sourceFileName": "<string>",
"previewHtml": "<string>",
"thumbnailUrl": "<string>",
"screenshotUrl": "<string>"
}
'import requests
url = "https://api.migma.ai/v1/projects/{projectId}/knowledge-base"
payload = {
"title": "<string>",
"content": "<string>",
"sourceFileName": "<string>",
"previewHtml": "<string>",
"thumbnailUrl": "<string>",
"screenshotUrl": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
content: '<string>',
sourceFileName: '<string>',
previewHtml: '<string>',
thumbnailUrl: '<string>',
screenshotUrl: '<string>'
})
};
fetch('https://api.migma.ai/v1/projects/{projectId}/knowledge-base', 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.migma.ai/v1/projects/{projectId}/knowledge-base",
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([
'title' => '<string>',
'content' => '<string>',
'sourceFileName' => '<string>',
'previewHtml' => '<string>',
'thumbnailUrl' => '<string>',
'screenshotUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.migma.ai/v1/projects/{projectId}/knowledge-base"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"sourceFileName\": \"<string>\",\n \"previewHtml\": \"<string>\",\n \"thumbnailUrl\": \"<string>\",\n \"screenshotUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.migma.ai/v1/projects/{projectId}/knowledge-base")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"sourceFileName\": \"<string>\",\n \"previewHtml\": \"<string>\",\n \"thumbnailUrl\": \"<string>\",\n \"screenshotUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/projects/{projectId}/knowledge-base")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"sourceFileName\": \"<string>\",\n \"previewHtml\": \"<string>\",\n \"thumbnailUrl\": \"<string>\",\n \"screenshotUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"title": "<string>",
"content": "<string>",
"sourceFileName": "<string>",
"date": "2023-11-07T05:31:56Z",
"previewHtml": "<string>",
"thumbnailUrl": "<string>",
"screenshotUrl": "<string>",
"conversion": {
"status": "pending",
"revision": "<string>",
"error": "<string>"
},
"referenceKind": "email",
"referenceOrigin": "favorite"
},
"error": "<string>"
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}Add Knowledge Base Entry
Add a new knowledge base entry to a project. Requires project:write permission.
curl --request POST \
--url https://api.migma.ai/v1/projects/{projectId}/knowledge-base \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "<string>",
"content": "<string>",
"sourceFileName": "<string>",
"previewHtml": "<string>",
"thumbnailUrl": "<string>",
"screenshotUrl": "<string>"
}
'import requests
url = "https://api.migma.ai/v1/projects/{projectId}/knowledge-base"
payload = {
"title": "<string>",
"content": "<string>",
"sourceFileName": "<string>",
"previewHtml": "<string>",
"thumbnailUrl": "<string>",
"screenshotUrl": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
title: '<string>',
content: '<string>',
sourceFileName: '<string>',
previewHtml: '<string>',
thumbnailUrl: '<string>',
screenshotUrl: '<string>'
})
};
fetch('https://api.migma.ai/v1/projects/{projectId}/knowledge-base', 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.migma.ai/v1/projects/{projectId}/knowledge-base",
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([
'title' => '<string>',
'content' => '<string>',
'sourceFileName' => '<string>',
'previewHtml' => '<string>',
'thumbnailUrl' => '<string>',
'screenshotUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.migma.ai/v1/projects/{projectId}/knowledge-base"
payload := strings.NewReader("{\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"sourceFileName\": \"<string>\",\n \"previewHtml\": \"<string>\",\n \"thumbnailUrl\": \"<string>\",\n \"screenshotUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.migma.ai/v1/projects/{projectId}/knowledge-base")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"sourceFileName\": \"<string>\",\n \"previewHtml\": \"<string>\",\n \"thumbnailUrl\": \"<string>\",\n \"screenshotUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/projects/{projectId}/knowledge-base")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"title\": \"<string>\",\n \"content\": \"<string>\",\n \"sourceFileName\": \"<string>\",\n \"previewHtml\": \"<string>\",\n \"thumbnailUrl\": \"<string>\",\n \"screenshotUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"title": "<string>",
"content": "<string>",
"sourceFileName": "<string>",
"date": "2023-11-07T05:31:56Z",
"previewHtml": "<string>",
"thumbnailUrl": "<string>",
"screenshotUrl": "<string>",
"conversion": {
"status": "pending",
"revision": "<string>",
"error": "<string>"
},
"referenceKind": "email",
"referenceOrigin": "favorite"
},
"error": "<string>"
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}Authorizations
API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → Developers → API Keys.
Path Parameters
Project ID (MongoDB ObjectId)
^[0-9a-fA-F]{24}$Body
Title of the knowledge base entry
1 - 100Entry content, up to 512000 UTF-8 bytes. Declared email references keep the full original and prepare editable source in the background. HTML, EML, and MJML must fit 250000 UTF-8 bytes after email-source cleanup. Ordinary notes are truncated at 15,000 characters; explicit instructions over 15,000 characters are rejected.
1 - 512000Original upload filename, including .html, .eml, or .mjml. An empty string clears a previous filename on update.
255Rendered HTML preview. For email references prepared in the background, the server creates this from the completed email source.
URL of a thumbnail image for the entry.
URL of a full screenshot of the entry.
Use instructions for explicitly approved design guidance such as footer rules. Instructions are limited to 15,000 characters and rejected rather than truncated. Omit to keep existing email-example behavior.
email, instructions Marks the entry as a design reference the email writer should learn from, and records where it came from. Omit for an ordinary note — omit referenceKind too for an ordinary knowledge entry.
favorite, upload, manual Was this page helpful?