Overview
AI Variables let you define reusable AI-powered fields for contacts and companies. The new OpenAPI section covers the full lifecycle:- List AI Variables:
GET /v1/ai-variables - Get one AI Variable:
GET /v1/ai-variables/{aiVariableId} - Create an AI Variable:
POST /v1/ai-variables - Update an AI Variable:
PATCH /v1/ai-variables/{aiVariableId} - Delete an AI Variable:
DELETE /v1/ai-variables/{aiVariableId} - List contact AI Variable folders:
GET /v1/ai-variables/folders/contacts - List company AI Variable folders:
GET /v1/ai-variables/folders/companies - Create, update, get, and delete folder endpoints under those same folder paths
- Contact fields:
GET /v1/contacts/fields - Company fields:
GET /v1/companies/fields
Mental Model
An AI Variable is defined by the prompt you write, the entity it belongs to, and the output format you expect back. Sendprompt as plain text and Enginy handles the internal prompt representation automatically.
Prompt Format
Reference fields with curly braces:id returned by the field-discovery endpoints.
If you send an unknown placeholder, the API returns a validation error starting with Invalid placeholders detected.
Request Format
Minimal create payload
Structured create payload
AI Variable Fields
outputSchema Format
outputSchema describes the expected AI output.
search Toggle
search is a boolean:
true: enable Deep Searchfalse: disable Deep Search
Folder Endpoints
AI Variables support folder CRUD for both entities:- Contact folders:
GET|POST /v1/ai-variables/folders/contacts - Contact folder detail/update/delete:
GET|PATCH|DELETE /v1/ai-variables/folders/contacts/{folderId} - Company folders:
GET|POST /v1/ai-variables/folders/companies - Company folder detail/update/delete:
GET|PATCH|DELETE /v1/ai-variables/folders/companies/{folderId}
Discovering Valid Field Names
Before writing prompts, fetch the available fields for the relevant entity:Contact fields
GET /v1/contacts/fields
Company fields
GET /v1/companies/fields
Each field object includes:
For contact variables,
GET /v1/contacts/fields includes both contact-backed placeholders and company-backed placeholders that are valid in contact prompts, such as {companyName}.
Typical Flow
- Call
GET /v1/contacts/fieldsorGET /v1/companies/fields - Build your prompt with the returned field
idvalues - Create the AI Variable with
POST /v1/ai-variables - Retrieve contacts or companies with the generated field through the normal entity endpoints
Notes
- Archived AI Variables are excluded from
GET /v1/ai-variablesunless you passincludeArchived=true - Updating
promptcauses Enginy to regenerate its internal prompt representation automatically - Deleting an AI Variable also removes its generated smart-field values from entity records