Aller au contenu

Create an organization preset

POST/api/public/v1/policy-presets beta

A new organization preset from its source: the confirmed intent policies of a draft or the ratified intent policies of a live AIP (intent_policy_ids), the chosen rules of a preset (preset), or typed sentences with their dimension (sentences). Rules are copied by the server; a sentence already in the preset with the same dimension is skipped and returned in skipped. 409 PRESET_NAME_EXISTS for a name taken in the organization (case-insensitive) or a built-in title; 422 PRESET_EMPTY when no rule remains.

Fenêtre de terminal
curl --fail-with-body -X POST 'https://app.openlatch.ai/api/public/v1/policy-presets' \
-H "Authorization: Bearer $OPENLATCH_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"name":"<preset_name>","description":"Created by the API examples.","source":{"sentences":[{"sentence":"Block a direct push to main.","dimension":"security"}]}}'
Rôle dans l’organisationCe point de terminaison
ownerAutorisé
adminAutorisé
editorAutorisé
viewerNon autorisé

Une clé porte le rôle que son propriétaire détient dans l’organisation. Voir Authentification.

Portée de clé d’API : presets:write

ParamètreTypeDescription
Idempotency-Keystring or nullOptional. Makes the request safe to retry: the same key and the same request, within 24 hours, returns the stored response with Idempotent-Replayed: true and runs once.
ChampTypeDescription
descriptionstring or null
namestringObligatoire.
sourceobjectObligatoire. Exactly one of the three: intent policy ids, a preset selection, or typed sentences.
source.intent_policy_idsarray of string (uuid) or null
source.presetobject or null
source.preset.intentsarray of objectObligatoire.
source.preset.keystringObligatoire.
source.sentencesarray of object or null
ChampTypeDescription
dataobjectObligatoire. A create or an add: the preset, and the sentences not added because already in it.
data.created_byobject or null
data.created_by.namestringObligatoire.
data.default_selectedbooleanObligatoire. False for a framework preset, otherwise true.
data.descriptionstringObligatoire.
data.frameworkobject or nullObligatoire. Set on a framework preset; null on every other.
data.framework.noticeobject or nullObligatoire.
data.framework.sourceobjectObligatoire.
data.keystringObligatoire.
data.kindstring — one of builtin, organizationObligatoire.
data.revisioninteger or null
data.rulesarray of objectObligatoire.
data.rules[].capabilityobject or null
data.rules[].citationobject or nullObligatoire. What the rule cites, for a framework preset's rule; null for every other.
data.rules[].dimensionstring — one of quality, economics, security, safety, complianceObligatoire.
data.rules[].intent_keystringObligatoire.
data.rules[].sentencestringObligatoire.
data.skippedarray of string
data.titlestringObligatoire.
{
"data": {
"created_by": {
"name": "release-bot"
},
"default_selected": false,
"description": "string",
"framework": {
"notice": "string",
"source": {
"framework_url": "https://app.openlatch.ai/",
"github_url": "https://app.openlatch.ai/",
"license_name": "release-bot",
"license_url": "https://app.openlatch.ai/",
"name": "release-bot",
"source_commit": "string",
"source_date": "string"
}
},
"key": "string",
"kind": "builtin",
"revision": 3,
"rules": [
{
"capability": "enforce",
"citation": {
"entries": [
{}
],
"items": [
{}
]
},
"dimension": "quality",
"intent_key": "string",
"sentence": "string"
}
],
"skipped": [
"string"
],
"title": "string"
}
}