1. Creating a Prompt Template
You can create new templates directly from your user dashboard.- Navigate to your Dashboard.
- Select the “Prompt Templates” section.
- Click the “Create New Template” button.
- Fill in the form:
- ID: A unique, machine-readable identifier for your template (e.g.,
doctor-assistant
,formal-email-writer
). Usekebab-case
. - Content: The body of your prompt. Use double curly braces
{{variable_name}}
to define placeholders that you can fill in later during your API call.
- ID: A unique, machine-readable identifier for your template (e.g.,
2. Using a Template in an API Call
Once your template is saved, you can use it by calling the/v1/responses
endpoint. Instead of the standard messages
array, you will provide a prompt
object.
The prompt
object must contain the id
of your template and a variables
object to fill in the placeholders you defined.
Example curl
Request:
This example calls the doctor-assistant
template we created and dynamically fills in the variables.