Reference
Publish Prompt Template
- Prompt CMS
- Advanced Search
Evaluations
- Fine-Tuning
- Analytics
- Scoring & Ranking Prompts
- Playground
- Shared Workspaces
- How PromptLayer Works
- REST API Reference
- POSTTrack Request
- POSTGet Prompt Template
- GETGet Prompt Template (Deprecated)
- POSTPublish Prompt Template
- POSTPublish Prompt Template (Deprecated)
- GETGet Prompt Template Labels
- POSTTrack Score
- POSTTrack Prompt
- POSTTrack Group
- POSTTrack Metadata
- GETGet All Prompt Templates
- GETGet All Prompt Templates (Deprecated)
- POSTCreate Dataset from History
- DELDelete Datasets by Name
- POSTCreate Evaluation Pipeline
- DELDelete Reports by Name
Why PromptLayer?
Reference
Reference
Publish Prompt Template
POST
/
rest
/
prompt-templates
X-API-KEY
X-Api-Key · string
*
X-API-KEY
Required
string
CreatePromptTemplate · object
*
prompt_template
BasePromptTemplate · object
*
prompt_template
Required
object
prompt_name
Prompt Name · string
*
prompt_name
Required
string
tags
Tags · array
tags
array
prompt_version
PromptVersion · object
*
prompt_version
Required
object
prompt_template
Option 1 · object
*
prompt_template
Required
object
Completion Prompt Template
content
Content · array
*
content
Required
array
input_variables
Input Variables · array
input_variables
array
template_format
Template Format · enum<string>
template_format
enum<string>
type
string
type
string
commit_message
string
commit_message
string
metadata
object
metadata
object
model
Model · object
model
object
provider
Provider · string
*
provider
Required
string
name
Name · string
*
name
Required
string
parameters
Parameters · object
parameters
object
customField
string
customField
string
release_labels
array
release_labels
array
curl --request POST \
--url https://api.promptlayer.com/rest/prompt-templates \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <x-api-key>' \
--data '{
"prompt_template": {
"prompt_name": "<string>",
"tags": [
"<string>"
]
},
"prompt_version": {
"prompt_template": {
"content": [
{
"type": "<any>",
"text": "<string>"
}
],
"input_variables": [
"<string>"
],
"template_format": "f-string",
"type": "<any>"
},
"commit_message": "<string>",
"metadata": {
"model": {
"provider": "<string>",
"name": "<string>",
"parameters": {}
},
"customField": "<string>"
}
},
"release_labels": [
"<string>"
]
}'
{
"id": 123,
"prompt_name": "<string>",
"tags": [
"<string>"
],
"release_labels": [
"<string>"
],
"prompt_template": {
"content": [
{
"type": "<any>",
"text": "<string>"
}
],
"input_variables": [
"<string>"
],
"template_format": "f-string",
"type": "<any>"
},
"metadata": {
"model": {
"provider": "<string>",
"name": "<string>",
"parameters": {}
},
"customField": "<string>"
},
"commit_message": "<string>"
}
Publish Prompt Template allows you to programmatically create a new version of a prompt template and make it available for use in the application.
Headers
X-API-KEY
string
requiredBody
application/json
prompt_template
object
requiredprompt_template.prompt_name
string
requiredprompt_template.tags
string[]
prompt_version
object
requiredprompt_version.prompt_template
object
requiredCompletion Prompt Template
prompt_version.prompt_template.content
object[]
requiredprompt_version.prompt_template.content.type
any
prompt_version.prompt_template.content.text
string
requiredprompt_version.prompt_template.input_variables
string[]
prompt_version.prompt_template.template_format
enum<string>
default: f-stringAvailable options:
f-string
, jinja2
prompt_version.prompt_template.type
any
prompt_version.commit_message
string | null
prompt_version.metadata
object | null
prompt_version.metadata.model
object
prompt_version.metadata.model.provider
string
requiredprompt_version.metadata.model.name
string
requiredprompt_version.metadata.model.parameters
object
prompt_version.metadata.customField
string
release_labels
string[] | null
Response
200 - application/json
id
integer
requiredprompt_name
string
requiredtags
string[]
requiredrelease_labels
string[] | null
prompt_template
object
requiredCompletion Prompt Template
prompt_template.content
object[]
requiredprompt_template.content.type
any
prompt_template.content.text
string
requiredprompt_template.input_variables
string[]
prompt_template.template_format
enum<string>
default: f-stringAvailable options:
f-string
, jinja2
prompt_template.type
any
metadata
object | null
metadata.model
object
metadata.model.provider
string
requiredmetadata.model.name
string
requiredmetadata.model.parameters
object
metadata.customField
string
commit_message
string | null
Was this page helpful?
curl --request POST \
--url https://api.promptlayer.com/rest/prompt-templates \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <x-api-key>' \
--data '{
"prompt_template": {
"prompt_name": "<string>",
"tags": [
"<string>"
]
},
"prompt_version": {
"prompt_template": {
"content": [
{
"type": "<any>",
"text": "<string>"
}
],
"input_variables": [
"<string>"
],
"template_format": "f-string",
"type": "<any>"
},
"commit_message": "<string>",
"metadata": {
"model": {
"provider": "<string>",
"name": "<string>",
"parameters": {}
},
"customField": "<string>"
}
},
"release_labels": [
"<string>"
]
}'
{
"id": 123,
"prompt_name": "<string>",
"tags": [
"<string>"
],
"release_labels": [
"<string>"
],
"prompt_template": {
"content": [
{
"type": "<any>",
"text": "<string>"
}
],
"input_variables": [
"<string>"
],
"template_format": "f-string",
"type": "<any>"
},
"metadata": {
"model": {
"provider": "<string>",
"name": "<string>",
"parameters": {}
},
"customField": "<string>"
},
"commit_message": "<string>"
}