Create a prompt fragment
POST/api/v1/prompt-fragments/create
Creates a reusable template block in the caller's project. The fragment ID must be unique within that project. Profiles that include the fragment share the stored text, so a later edit affects every referencing profile.
The following access conditions are preserved as declared intent and are not implemented by generated code: Authorized scoped domain action.
Use this in a guide: Reuse and update shared assistant instructions
Request
Responses
- 200
Fragment created; the stored record is echoed back
Create a reusable prompt fragment with a new fragmentId.
Section ID: DOC-MA-profiles-prompts-api-createPromptFragment#example-agent-profiles-createPromptFragment-request
Request example
{
"fragment": {
"fragmentId": "answer-style",
"name": "Answer style",
"content": "Use short paragraphs and explain any assumptions."
}
}
Guide request for Step 1: Create the block and include it in the profile. Replace example resource identifiers with your own authorized values.
Section ID: DOC-MA-profiles-prompts-api-createPromptFragment#example-cookbook-managed-agents-profiles-prompts-prompt-fragments-01-request
Request example
{
"fragment": {
"fragmentId": "safety",
"name": "Safety rules",
"content": "Never give medical advice. Refer the user to a clinician when asked."
}
}
Illustrative response shape; omitted default fields and actual outcomes depend on the operation.
Section ID: DOC-MA-profiles-prompts-api-createPromptFragment#example-agent-profiles-createPromptFragment-response
Response example
{
"fragment": {
"fragmentId": "example_123",
"name": "example",
"content": "Example text"
}
}
Illustrative response for Step 1: Create the block and include it in the profile. Replace example resource identifiers with your own authorized values.
Section ID: DOC-MA-profiles-prompts-api-createPromptFragment#example-cookbook-managed-agents-profiles-prompts-prompt-fragments-json-01-response
Response example
{
"fragment": {
"fragmentId": "safety",
"name": "Safety rules",
"content": "Never give medical advice. Refer the user to a clinician when asked."
}
}
Document ID: DOC-MA-profiles-prompts-api-createPromptFragment. Section identities and revisions.
| Section | Stable reference |
|---|---|
| Create a prompt fragment | DOC-MA-profiles-prompts-api-createPromptFragment#overview |
| Request | DOC-MA-profiles-prompts-api-createPromptFragment#request |
| Responses | DOC-MA-profiles-prompts-api-createPromptFragment#responses |