Ana içeriğe geç

Create AI Prompt-Decorator Preset

Endpoint​

POST /apiops/settings/ai-prompt-decorator-presets/{presetName}/

Authentication​

Requires a Personal API Access Token with admin privileges.

Authorization: Bearer YOUR_TOKEN

Request​

Headers​

HeaderValueRequired
AuthorizationBearer {token}Yes
Content-Typeapplication/jsonYes

Path Parameters​

ParameterTypeRequiredDescription
presetNamestringYesName of the preset. Must match the name in the body when that field is present.

Query Parameters​

ParameterTypeRequiredDefaultDescription
projectIdstringNoadminScope the preset is created in. Omit for the admin/global scope, which every project can then import from.

Request Body​

{
"name": "support-tone",
"content": "Answer in a calm, professional tone and always offer a next step.",
"role": "system",
"position": "PREPEND",
"category": "tone",
"description": "House style for support assistants",
"enabled": true
}

Body Fields​

FieldTypeRequiredDescription
namestringNoPreset name. Defaults to presetName from the path when omitted; must match it otherwise.
contentstringYesInstruction text injected into the request's message list
rolestringNosystem (default), user or assistant
positionstringNoPREPEND (default) or APPEND
categorystringNoOptional category label
descriptionstringNoOptional description for display
enabledbooleanNoDefaults to true

id, projectId and builtIn in the body are ignored — the scope comes from the projectId query parameter and builtIn is server-owned, so a client cannot forge a built-in preset.

Response​

Success Response (200 OK)​

{
"status": "SUCCESS"
}

Error Response (400 Bad Request)​

Returned for a name mismatch, a missing content, an invalid role/position, a name that collides with an already-visible preset in a different scope, or a caller without the ADMIN role.

{
"status": "FAILURE",
"resultMessage": "AI prompt-decorator preset name in path (support-tone) does not match name in body (supportTone)!"
}

Error Response (401 Unauthorized)​

{
"status": "FAILURE",
"resultMessage": "Token is not valid!"
}

cURL Example​

curl -X POST \
"https://demo.apinizer.com/apiops/settings/ai-prompt-decorator-presets/support-tone/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"content": "Answer in a calm, professional tone and always offer a next step.",
"role": "system",
"position": "PREPEND",
"category": "tone",
"description": "House style for support assistants",
"enabled": true
}'

Notes and Warnings​

  • Upsert by Name:
    • When a preset with the same name already exists in the scope it is updated rather than duplicated — this includes a built-in (builtIn: true) row, which is not read-only on this endpoint. The call is safe to repeat from a CI/CD pipeline.
  • Validation:
    • content is required — an empty block would silently do nothing once imported into a policy
    • Blank role/position normalize to system/PREPEND; any other value is rejected
  • Name Uniqueness:
    • Names must be unique across the caller's visible set, so a project cannot shadow a built-in or admin-shared preset name
  • No Redeploy Implied:
    • Policies import presets as copies; creating or updating a preset never changes an already-deployed policy