Templates

Create a new template

Creates a new template with the provided details. The template includes a slug, mode, content, and additional configuration options.

POST
/v1/templates
curl --request POST \
  --url https://api.lunary.ai/v1/templates \
  --header 'Authorization: Bearer <api_key>' \
  --header 'Content-Type: application/json' \
  --data '{"slug":"greeting-template","mode":"openai","content":[{"role":"system","content":"You are a friendly AI assistant."},{"role":"user","content":"Hello, how are you?"}],"extra":{"temperature":0.7,"max_tokens":150},"isDraft":false,"notes":"Initial greeting template"}'

Accepted Keys:

slug
mode
content
extra
isDraft
notes

Example response:

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "slug": "greeting-template",
  "mode": "openai",
  "createdAt": "2023-06-01T12:00:00Z",
  "versions": [
    {
      "id": "789e0123-e45b-67d8-a901-234567890000",
      "content": [
        {
          "role": "system",
          "content": "You are a friendly AI assistant."
        },
        {
          "role": "user",
          "content": "Hello, how are you?"
        }
      ],
      "extra": {
        "temperature": 0.7,
        "max_tokens": 150
      },
      "isDraft": false,
      "notes": "Initial greeting template",
      "createdAt": "2023-06-01T12:00:00Z",
      "version": 1
    }
  ]
}

Request Body

PropertyTypeDescription
slugstring
modestring
contentarray
extraobject
testValuesobject
isDraftboolean
notesstring

Responses

200

Successful response

PropertyTypeDescription
idstring
namestring
slugstring
modestring
createdAtstring
groupstring
projectIdstring
versionsarray

Questions? We're here to help.

Email