How to Create
How to Create an Image (item)
If you need to create an Image (item), you can do so by using the Snack Prompt API through the appropriate endpoint for creating elementals. To perform this action, you must be authenticated with your API Key.
How to Generate an API Key
To generate an API Key, follow these steps:
- Log in to your Snack Prompt account.
- Navigate to the API Keys page: https://snackprompt.com/api-keys.
- Click the Create New API Key button.
- Provide a name for your Key to easily identify it later.
- Once created, you can:
- Copy the Key for immediate use.
- Delete the Key when it's no longer needed.
Note: API Keys do not have an expiration date and will remain valid until deleted.

Creating a Image (item)
To create an Image (item), make a POST request to the /v1/user/elemental endpoint. For this example, I will create an Image (item) type of Image (item).
Endpoint
POST /v1/user/elemental
Headers
x-api-key: Your API Key.
Make the POST API Request to create the Image (item)
Here's how to create the Image (item).
Parameters and body content
- Body
- Response
Properties
| Name | Type | Required | Description |
|---|---|---|---|
| title | string | ❌ | Title of the elemental |
| template | string | ❌ | Template of the elemental |
| template_overwrite_content | boolean | ❌ | An option to overwrite the content |
| description | string | ❌ | Description of the elemental |
| command | string | ❌ | Command of the elemental |
| visibility | number | ❌ | Visibility of the elemental |
| category_id | number | ❌ | Category of the elemental |
| topic_ids | number[] | ❌ | Topics related to the elemental |
| lists_to_save | Object[] | ❌ | Lists to save |
| lists_to_save.list_id | number | ✅ | ID of the list |
| is_premium | boolean | ❌ | Indicates if the elemental is premium |
| is_fixed_price | boolean | ❌ | Indicates if the elemental has a fixed price |
| price | number | ❌ | Price of the elemental |
| price_original | number | ❌ | Original price of the elemental |
| avatar | Object | ❌ | Avatar of the elemental |
| avatar.file_name | string | ❌ | Name of the avatar |
| avatar.file_buffer | number[] | ✅ | Buffer of the avatar |
| cover_images | Object[] | ❌ | Cover images of the elemental |
| cover_images.file_name | string | ❌ | Name of the cover image |
| cover_images.file_buffer | number[] | ✅ | Buffer of the cover image |
| images | Object[] | ❌ | Images of the elemental |
| images.file_name | string | ❌ | Name of the image |
| images.file_buffer | number[] | ✅ | Buffer of the image |
| files | Object[] | ❌ | Files of the elemental |
| files.file_name | string | ❌ | Name of the file |
| files.file_buffer | number[] | ✅ | Buffer of the file |
| video_url | string | ❌ | Video URL of the elemental |
| tagIds | number[] | ❌ | Tag IDs of the elemental |
| tutorial_steps | Object[] | ❌ | Tutorial steps of the elemental |
| tutorial_steps.title | string | ✅ | Title of the tutorial step |
| tutorial_steps.description | string | ❌ | Description of the tutorial step |
| tutorial_steps.video_url | string | ❌ | Video URL of the tutorial step |
Example
{
"title": "My First Image (item)",
"description": "<p>Snack Prompt is awesome!</p>",
"type_id": 11,
"files": [
{
"file_name": "file-4nt.pdf",
"file_buffer": {
"type": "Buffer",
"data": [
123,
10,
32,
32,
32,
32,
34,
110
]
}
}
],
"images": [
{
"file_name": "file-4nt.png",
"file_buffer": {
"type": "Buffer",
"data": [
123,
10,
32,
32,
32,
32,
34,
110
]
}
}
]
}
Properties
| Name | Type | Description |
|---|---|---|
| id | string | ID of the elemental |
| is_list | boolean | Indicates if the elemental is a list |
| type | Object | Type of the elemental |
| category | Object | Category of the elemental |
| category.id | number | ID of the category |
| category.name | string | Name of the category |
| topics | array | Topics related to the elemental |
| topics.id | number | ID of the topic |
| topics.name | string | Name of the topic |
| title | string | Title of the elemental |
| body_content | string | Body content of the elemental |
| body_content_plaintext | string | Body content of the elemental in plain text |
| body_content_json | string | Body content of the elemental in JSON format |
| body_content_placeholders | Object | Placeholders for the body content |
| body_content_placeholders.list | string[] | Placeholders for the body content in list |
| body_content_placeholders.plaintext | string | Placeholders for the body content in plain text |
| description | string | Description of the elemental |
| description_plaintext | string | Description of the elemental in plain text |
| visibility | Object | Visibility of the elemental |
| visibility.id | number | ID of the visibility |
| visibility.name | string | Name of the visibility |
| images | array | Images related to the elemental |
| images.id | number | ID of the image |
| images.url | string | URL of the image |
| cover_images | array | Cover images related to the elemental |
| cover_images.id | number | ID of the cover image |
| cover_images.url | string | URL of the cover image |
| avatar_image | string | Avatar image of the elemental |
| files | array | Files related to the elemental. (Up to 3 files) |
| files.id | number | ID of the file |
| files.name | string | Name of the file |
| files.size | number | Size of the file |
| files.created_at | string | Timestamp of when the file was created |
| files.url | string | URL of the file |
| tags | array | Tags related to the elemental |
| tutorial_steps | array | Tutorial steps related to the elemental |
| tutorial_steps.id | number | ID of the tutorial step |
| tutorial_steps.title | string | Title of the tutorial step |
| tutorial_steps.description | string | Description of the tutorial step |
| tutorial_steps.video_url | string | Video URL of the tutorial step |
| url | string | URL of the elemental |
| is_premium | boolean | Indicates if the elemental is premium |
| price | number | Price of the elemental |
| average_rate | number | Average rate of the elemental |
| video_url | string | Video URL of the elemental |
| created_at | string | Timestamp of when the elemental was created |
| updated_at | string | Timestamp of when the elemental was updated |
| user | Object | User owner of the elemental |
| user.id | string | ID of the user |
| user.name | string | Name of the user |
| user.username | string | Username of the user |
| user.avatar | string | Avatar of the user |
| total_upvotes | number | Total number of upvotes |
| total_uses | number | Total number of uses |
| total_saves | number | Total number of saves |
| command | string | Command of the elemental |
| compiled_fields | string | Compiled fields of the elemental |
Example
{
"response": {
"id": "82f9dc27-5e0c-4bbc-a9bb-3c2f1be8a2ac",
"is_list": false,
"type": {
"id": 1,
"name": "Prompt"
},
"category": {
"id": 1,
"name": "Text"
},
"topics": [
{
"id": 27,
"name": "AI"
}
],
"title": "My First Prompt",
"body_content": "I Love Snack Prompt ❤️ #[aweasome]",
"body_content_plaintext": "I Love Snack Prompt ❤️ #[aweasome]",
"body_content_json": null,
"body_content_placeholders": {
"list": [
"#[aweasome]"
],
"plaintext": "#[aweasome]"
},
"description": "<p>Snack Prompt is awesome!</p>",
"description_plaintext": "Snack Prompt is awesome!",
"visibility": {
"id": 2,
"name": "Unlisted"
},
"images": [
{
"id": 4156,
"url": "http://..."
}
],
"cover_images": [
{
"id": 4155,
"url": "http://..."
}
],
"avatar_image": "http://...",
"files": [
{
"id": 1014,
"name": "cat-code-lhY.png",
"size": 1131291,
"created_at": "2025-01-14T16:47:07.091668Z",
"url": "https://..."
}
],
"tags": [
{
"id": 1,
"title": "Tag 1",
"color": "#000000",
"description": "Tag 1 description"
}
],
"tutorial_steps": [
{
"id": 11645,
"title": "First",
"description": "<p>Follow us</p>",
"video_url": ""
},
{
"id": 11646,
"title": "End",
"description": "",
"video_url": ""
}
],
"url": "https://snackprompt.com/prompt/my-first-prompt",
"is_premium": false,
"price": null,
"average_rate": 0,
"video_url": "https://www.youtube.com/watch?v=9yhGMj8Ygvc&t=1s",
"created_at": "2025-01-14T16:47:01.565479Z",
"updated_at": "2025-01-14T16:47:03.203537Z",
"user": {
"id": "Ak2o2WP6xrU8EqSLpmtwO4fEwlC3",
"name": "Leonardo Sola",
"username": "sola",
"avatar": "http://..."
},
"total_upvotes": 0,
"total_uses": 0,
"total_saves": 1,
"command": "",
"knowledge_base": "Title: My First Prompt\nDescription: Snack Prompt is awesome!\n\nBody: I Love Snack Prompt ❤️ #[aweasome]\n\n"
}
}
CURL Example
curl -X POST "https://api-integrations.snackprompt.com/v1/user/elemental" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"title":"My First Image (item)","description":"<p>Snack Prompt is awesome!</p>","type_id":11,"files":[{"file_name":"file-4nt.pdf","file_buffer":{"type":"Buffer","data":[123,10,32,32,32,32,34,110]}}],"images":[{"file_name":"file-4nt.png","file_buffer":{"type":"Buffer","data":[123,10,32,32,32,32,34,110]}}]}'
Code Examples
You can also use the Snack Prompt API in different programming languages:
- JavaScript
- Python
- Go
const response = await fetch(
"https://api-integrations.snackprompt.com/v1/elemental",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
title: "My First Image (item)",
description: "<p>Snack Prompt is awesome!</p>",
type_id: 11,
files: [
{
"file_name": "file-4nt.pdf",
"file_buffer": {
"type": "Buffer",
"data": [
123,
10,
32,
32,
32,
32,
34,
110
]
}
}
],
images: [
{
"file_name": "file-4nt.png",
"file_buffer": {
"type": "Buffer",
"data": [
123,
10,
32,
32,
32,
32,
34,
110
]
}
}
]
}),
}
);
if (response.ok) {
console.log("Image (item) created successfully");
} else {
console.error("Failed to create Image (item)");
}
import requests
url = 'https://api-integrations.snackprompt.com/v1/elemental'
headers = {
'Content-Type': 'application/json',
'x-api-key': 'YOUR_API_KEY'
}
data = {
'title': 'My First Image (item)',
'description': '<p>Snack Prompt is awesome!</p>',
'type_id': 11,
'files': [
{
"file_name": "file-4nt.pdf",
"file_buffer": {
"type": "Buffer",
"data": [
123,
10,
32,
32,
32,
32,
34,
110
]
}
}
],
images: [
{
"file_name": "file-4nt.png",
"file_buffer": {
"type": "Buffer",
"data": [
123,
10,
32,
32,
32,
32,
34,
110
]
}
}
]
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
print('Image (item) created successfully')
else:
print('Failed to create Image (item):', response.text)
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
)
func main() {
url := "https://api-integrations.snackprompt.com/v1/elemental"
data := map[string]interface{}{
"title": "My First Image (item)",
"description": "<p>Snack Prompt is awesome!</p>",
"type_id": 11,
"files": [
{
"file_name": "file-4nt.pdf",
"file_buffer": {
"type": "Buffer",
"data": [
123,
10,
32,
32,
32,
32,
34,
110
]
}
}
],
}
payload, _ := json.Marshal(data)
req, err := http.NewRequest("POST", url, bytes.NewBuffer(payload))
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("x-api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error sending request:", err)
return
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
fmt.Println("Image (item) created successfully")
} else {
fmt.Printf("Failed to create Image (item): %s\n", resp.Status)
}
}
Practical Example
To better understand how the system works in practice, let's walk through a hands-on example where we'll create an Image (item).
Suppose you want to register a new elemental that represents an Image (item). In this case, we'll simulate the creation of an Image (item) named "My First Image (item)" with a short description to identify its purpose.
Here are the key details you'll need:
-
Title:
"My First Image (item)" -
Description:
"Snack Prompt is awesome!" -
Type ID:
11(This value identifies the elemental as an Image in the system) -
Files:
[{"file_name": "file-4nt.pdf", "file_buffer": {"type": "Buffer", "data": [123, 10, 32, 32, 32, 32, 34, 110]}}] -
Images:
[{"file_name": "file-4nt.png", "file_buffer": {"type": "Buffer", "data": [123, 10, 32, 32, 32, 32, 34, 110]}}]
To proceed with the creation, you'll typically send a request (such as via an API or system interface) including the data above. The type_id = 11 is crucial, as it informs the backend logic that this elemental should be treated and structured as an Image (item) within the platform.
This approach allows users to structure and store information flexibly while maintaining consistency and clarity in how different types of Image (item)s are handled.
{
"title": "My First Image (item)",
"description": "<p>Snack Prompt is awesome!</p>",
"type_id": 11,
"files": [{"file_name": "file-4nt.pdf", "file_buffer": {"type": "Buffer", "data": [123, 10, 32, 32, 32, 32, 34, 110]}}],
"images": [{"file_name": "file-4nt.png", "file_buffer": {"type": "Buffer", "data": [123, 10, 32, 32, 32, 32, 34, 110]}}]
}
- CURL example:
curl -X POST "https://api-integrations.snackprompt.com/v1/user/elemental"\
-H "Content-Type: application/json"
-H "x-api-key: YOUR_API_KEY"
-d '{"title":"My First Image (item)","description":"Snack Prompt is awesome!", "type_id": 11, "files": [{"file_name": "file-4nt.pdf", "file_buffer": {"type": "Buffer", "data": [123, 10, 32, 32, 32, 32, 34, 110]}}, {"file_name": "file-4nt.png", "file_buffer": {"type": "Buffer", "data": [123, 10, 32, 32, 32, 32, 34, 110]}}]'
Now if i need to create an Image (item), I can use the Snack Prompt API to create the Image (item). Click here to learn how to create an Image (item) and Body and Params to create an Image (item).