Templates

Get a specific template

Get a specific prompt template and all its versions by its ID.

GET
/v1/templates/
id
curl --request GET \
  --url https://api.lunary.ai/v1/templates/{id} \
  --header 'Authorization: Bearer <api_key>' \
  --header 'Content-Type: application/json'

Example response:

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "name": "Customer Support Chat",
  "slug": "customer-support-chat",
  "mode": "openai",
  "createdAt": "2023-01-01T00:00:00Z",
  "projectId": "987e6543-e21b-12d3-a456-426614174000",
  "versions": [
    {
      "id": "abcd1234-e56f-78g9-h012-ijklmnopqrst",
      "templateId": "123e4567-e89b-12d3-a456-426614174000",
      "content": [
        {
          "role": "system",
          "content": "You are a helpful customer support agent."
        },
        {
          "role": "user",
          "content": "Hello, I have a question about my order."
        },
        {
          "role": "assistant",
          "content": "Of course! I'd be happy to help you with your order. Could you please provide me with your order number?"
        }
      ],
      "extra": {
        "temperature": 0.7,
        "maxTokens": 150
      },
      "testValues": {
        "orderNumber": "ORD-12345"
      },
      "isDraft": false,
      "notes": "Updated to improve response clarity",
      "createdAt": "2023-01-02T12:00:00Z",
      "version": 1
    }
  ]
}

Parameters

NameLocated InRequiredSchema
idpathYesstring

Responses

200

Successful response

PropertyTypeDescription
idstring
namestring
slugstring
modestring
createdAtstring
groupstring
projectIdstring
versionsarray

404

Template not found

Questions? We're here to help.

Email