Skip to main content
POST
/
v1
/
prompts
/
create
cURL
curl --request POST \
  --url https://api.fluents.ai/v1/prompts/create \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "label": "My Prompt",
  "description": "This is a description",
  "content": "You are a helpful assistant...",
  "context_endpoint": "https://api.example.com/context",
  "collect_fields": [
    "<string>"
  ],
  "type": "prompt",
  "tags": [
    "tag1",
    "tag2"
  ]
}
'
import requests

url = "https://api.fluents.ai/v1/prompts/create"

payload = {
"label": "My Prompt",
"description": "This is a description",
"content": "You are a helpful assistant...",
"context_endpoint": "https://api.example.com/context",
"collect_fields": ["<string>"],
"type": "prompt",
"tags": ["tag1", "tag2"]
}
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({
label: 'My Prompt',
description: 'This is a description',
content: 'You are a helpful assistant...',
context_endpoint: 'https://api.example.com/context',
collect_fields: ['<string>'],
type: 'prompt',
tags: ['tag1', 'tag2']
})
};

fetch('https://api.fluents.ai/v1/prompts/create', 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.fluents.ai/v1/prompts/create",
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([
'label' => 'My Prompt',
'description' => 'This is a description',
'content' => 'You are a helpful assistant...',
'context_endpoint' => 'https://api.example.com/context',
'collect_fields' => [
'<string>'
],
'type' => 'prompt',
'tags' => [
'tag1',
'tag2'
]
]),
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.fluents.ai/v1/prompts/create"

payload := strings.NewReader("{\n \"label\": \"My Prompt\",\n \"description\": \"This is a description\",\n \"content\": \"You are a helpful assistant...\",\n \"context_endpoint\": \"https://api.example.com/context\",\n \"collect_fields\": [\n \"<string>\"\n ],\n \"type\": \"prompt\",\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ]\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.fluents.ai/v1/prompts/create")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"label\": \"My Prompt\",\n \"description\": \"This is a description\",\n \"content\": \"You are a helpful assistant...\",\n \"context_endpoint\": \"https://api.example.com/context\",\n \"collect_fields\": [\n \"<string>\"\n ],\n \"type\": \"prompt\",\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.fluents.ai/v1/prompts/create")

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 \"label\": \"My Prompt\",\n \"description\": \"This is a description\",\n \"content\": \"You are a helpful assistant...\",\n \"context_endpoint\": \"https://api.example.com/context\",\n \"collect_fields\": [\n \"<string>\"\n ],\n \"type\": \"prompt\",\n \"tags\": [\n \"tag1\",\n \"tag2\"\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "user_id": "550e8400-e29b-41d4-a716-446655440000",
  "label": "My Prompt",
  "description": "This is a description",
  "content": "You are a helpful assistant...",
  "context_endpoint": "https://api.example.com/context",
  "collect_fields": [
    "<string>"
  ],
  "type": "prompt",
  "tags": [
    "tag1",
    "tag2"
  ],
  "prompt_template": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "user_id": "550e8400-e29b-41d4-a716-446655440000",
    "required_context_keys": [
      "tag1",
      "tag2"
    ],
    "label": "My Prompt"
  }
}
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"user_id": "550e8400-e29b-41d4-a716-446655440000",
"label": "My Prompt",
"description": "This is a description",
"content": "You are a helpful assistant...",
"context_endpoint": "https://api.example.com/context",
"collect_fields": [
"<string>"
],
"type": "prompt",
"tags": [
"tag1",
"tag2"
],
"prompt_template": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"user_id": "550e8400-e29b-41d4-a716-446655440000",
"required_context_keys": [
"tag1",
"tag2"
],
"label": "My Prompt"
}
}

Authorizations

Authorization
string
header
required

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

Body

application/json
label
string
Example:

"My Prompt"

description
string
Example:

"This is a description"

content
string
Example:

"You are a helpful assistant..."

context_endpoint
string
Example:

"https://api.example.com/context"

collect_fields
string[]
deprecated
type
enum<string>
Available options:
prompt,
block
Example:

"prompt"

tags
string[]
Example:
["tag1", "tag2"]
prompt_template
object
deprecated

Response

id
string
required
Example:

"550e8400-e29b-41d4-a716-446655440000"

user_id
string
required
Example:

"550e8400-e29b-41d4-a716-446655440000"

label
string
Example:

"My Prompt"

description
string
Example:

"This is a description"

content
string
Example:

"You are a helpful assistant..."

context_endpoint
string
Example:

"https://api.example.com/context"

collect_fields
string[]
deprecated
type
enum<string>
Available options:
prompt,
block
Example:

"prompt"

tags
string[]
Example:
["tag1", "tag2"]
prompt_template
object
deprecated