Memory promotion
This topic describes RDS ContextDB memory promotion APIs for candidate generation, manual review, automatic ingestion settings, and templates.
Common information
Endpoint
https://context-database.aliyuncs.comAuthentication
All Data API operations are authenticated by a workspace-level API key. Use one of the following methods:
Method | Header format |
X-API-Key |
|
Token |
|
Bearer |
|
Unified response envelope
All operations return a unified envelope with business data in data:
Name | Type | Description | Example |
errorCode | integer | The error code. |
|
errorMessage | string | The error message, or |
|
requestId | string | The request ID to provide when troubleshooting. |
|
data | object/array | Business data as defined in each operation's response parameters; | See the individual operation. |
Error codes
errorCode | HTTP status code | Meaning |
0 | 200 | Success |
1001 | 400 | Invalid parameters, missing records, inoperable states, or missing target knowledge bases. |
1000 | 500 | Internal service error. |
Missing promotion records return HTTP 400 with errorCode 1001. Missing-template behavior varies: detail queries return HTTP 200 with null data, deletion succeeds idempotently, and generation falls back to a default template. Updating or selecting a default template returns HTTP 400.
Common conventions
Convention | Description |
Member identity | The server supplies |
Data isolation | Records are filtered strictly by |
Batch operation format | Batch actions use |
Timestamp format | All timestamps use UTC ISO 8601 with a |
Data API overview
The following table lists the operations covered in this topic.
API | Description |
Generate | Generates a promotion candidate asynchronously. |
ListPromotions | Lists the promotion records initiated by the current member by page. |
PromotionDetail | Retrieves a promotion's draft, evidence, doubts, and current status. |
ApprovePromotion | Approves a candidate for ingestion into the specified KB. |
RejectPromotion | Rejects a candidate. |
ResolveDoubts | Resolves generation doubts and optionally edits the title or content of the current member's pending_review record. |
BatchActionPromotions | Approves or rejects up to 50 candidates independently. |
BatchDeletePromotions | Permanently deletes up to 50 of the current member's own |
GetPromotionSettings | Retrieves automatic ingestion settings scoped to (workspace, member). |
UpdatePromotionSettings | Partially updates automatic ingestion settings for the current (workspace, member) only. |
ListPromotionTemplates | Lists active promotion templates visible to the caller, sorted by name ascending. |
CreatePromotionTemplate | Creates a template owned by the current member. |
GetPromotionTemplate | Retrieves a visible promotion template. |
UpdatePromotionTemplate | Updates a visible promotion template; a missing template returns HTTP 400. |
DeletePromotionTemplate | Soft-deletes a visible promotion template and renames it with a tombstone so the original name can be reused. |
SetDefaultPromotionTemplate | Sets the specified template as default and clears other visible defaults. |
ClearDefaultPromotionTemplate | Clears all visible template default flags. |
Memory Promotion API
Aggregates and promotes short-term memories into long-term knowledge base documents.
Generate
Description
Generates a promotion candidate asynchronously. knowledge_base_id is always optional: a supplied missing KB returns HTTP 400. If omitted with automatic ingestion enabled, uses default_kb_id from promotion settings; an unconfigured default causes no error. Without template_id, uses the member's default template, then the built-in template. Returns business data in the unified envelope's data field.
Generation immediately returns promotion_id and event_id with status generating. Completion changes status to pending_review; failure changes it to generation_failed. Two consecutive deterministic-check failures or unresolved source conflicts produce doubts for manual decisions through ResolveDoubts.
Request syntax
POST /v1/memory_promotions/generateRequest parameters
Name | Type | Required | Description | Example |
topic | string | Yes | The promotion topic; nonempty after trimming and at most 512 characters. Invalid length returns HTTP 400. |
|
knowledge_base_id | string | No | The target KB ID. If supplied, the KB must exist or HTTP 400 is returned. If omitted with automatic ingestion enabled, falls back to default_kb_id. |
|
template_id | string | No | The promotion template ID, resolved for the current workspace and member. Omitted, missing, deleted, or other-member IDs silently fall back to the member's default template, then the built-in template. Only a server warning is logged; no error or hint is returned. |
|
Response parameters (in the data field)
Name | Type | Description | Example |
promotion_id | string | The promotion record ID |
|
event_id | string | The asynchronous event ID |
|
status | string | The current status, fixed to |
|
ListPromotions
Description
Lists the promotion records initiated by the current member by page. The records can be filtered by status. The response uses the unified envelope structure, and business data is in the data field.
Request syntax
GET /v1/memory_promotionsRequest parameters
Name | Type | Required | Description | Example |
status | string | No | The status filter. See values below. Omission includes all statuses; invalid values return HTTP 400. |
|
page | integer | No | The page number. Default: |
|
page_size | integer | No | Items per page. Default: |
|
sort_by | string | No | Sort field: only quality_score is supported; other values return HTTP 400. Omission sorts by created_at descending. |
|
sort_order | string | No | Case-insensitive asc/desc. Requires sort_by; using it alone returns HTTP 400. Defaults to desc when sort_by is supplied. Null scores always sort last. |
|
status values:
Value | Description |
| Generating, including retries. Check attempt_count and last_error for progress. |
| Generated and awaiting manual review. |
| Approval ingestion in progress. |
| Approved and ingested, including automatic ingestion. |
| Rejected. |
| Generation failed. |
When sorting by quality_score, unscored records always come last. Ties use created_at descending, then ID ascending for stable ordering.
Response parameters (in the data field)
Name | Type | Description | Example |
promotions | array | The list of promotion records. For the fields of each element, see the following table | See the following table |
total | integer | The total number of entries |
|
page | integer | The current page number |
|
page_size | integer | The number of entries per page |
|
Elements of the promotions array: The fields are the same as those of the data field of PromotionDetail. See the response parameters of PromotionDetail below.
PromotionDetail
Description
Retrieves a promotion's draft, evidence, doubts, and current status. Only the current member's own records are accessible; missing or other-member records return HTTP 400. Returns data in a unified envelope.
Request syntax
GET /v1/memory_promotions/detailRequest parameters
Name | Type | Required | Description | Example |
promotion_id | string | Yes | The promotion record ID |
|
Response parameters (in the data field)
Name | Type | Description | Example |
promotion_id | string | The promotion record ID |
|
workspace_id | string | The workspace ID |
|
source_type | string | The source type. See values below. |
|
requested_by | string | The member ID of the initiator |
|
topic | string | The promotion topic |
|
title | string | The title of the generated document. Before generation, the value is null |
|
content | string | The content of the generated document. Before generation, the value is null |
|
whats_new | string | The description of new information compared with existing knowledge |
|
source_memory_ids | array | The list of source memory IDs |
|
source_member_ids | array | The list of source member IDs |
|
source_entity_ids | array | The list of source entity IDs |
|
excluded_memory_ids | array | The list of excluded memory IDs | Empty array |
memory_count | integer | The number of aggregated memories |
|
doubts | array | Generation doubts. See the element fields below. Empty if there are no doubts; cleared to null after regeneration. | See the following table |
doubt_resolutions | array | Doubt decisions, using ResolveDoubts request doubt_resolutions fields. Cleared to null after regeneration. | See ResolveDoubts. |
status | string | The status. Valid values: |
|
reviewed_by | string | The reviewer, or null before review. Automatic ingestion does not populate this field. |
|
reviewed_at | string | The review time. If the record is not reviewed, the value is null |
|
rejection_reason | string | The rejection reason. If the record is not rejected, the value is null |
|
target_kb_id | string | The target KB ID, set during generation or default-KB fallback; null if undecided. |
|
target_document_id | string | The ingested document ID, or null before ingestion. |
|
generate_event_id | string | The generation event ID |
|
last_error | string | The latest failure reason, at most 1,024 characters. Null if unavailable. |
|
attempt_count | integer | The number of generation attempts |
|
created_at | string | The creation time |
|
updated_at | string | The update time |
|
quality_score | float | The deterministically combined quality score in [0,1]. See the quality_score calculation below. Null before generation completes, for check failures converted to doubts, for outputs with no reusable content, and for older records. ResolveDoubts regeneration preserves the existing score rather than rescoring. |
|
auto_ingested | boolean | Indicates whether the record entered the knowledge base through the automatic ingestion channel, as distinguished from manual approval |
|
source_type values:
Value | Description |
| Manually initiated through Generate. |
| Automatically nominated by agent patrol. Legacy |
doubts elements generated by the pipeline. options and current_choice are required for manual decisions:
Name | Type | Description | Example |
title | string | The doubt title. |
|
description | string | The detailed doubt description. |
|
options | array | Decision options with |
|
current_choice | string | The pipeline's default option label. |
|
severity | string | Severity, fixed to |
|
source | string | The doubt source marker, present only for check-generated doubts. |
|
type | string | The doubt type marker, present only for check-generated doubts. |
|
reason | string | The check rejection reason, present only for check-generated doubts. |
|
quality_score calculation: combines relevance, coherence, cleanliness, and penalties. V2 multi-signal scoring is the default; V1 is the fallback.
V2 (default): score = clamp(0.40×relevance + 0.30×coherence + 0.30×cleanliness − 0.3×hasHighDoubt − 0.2×verificationDegraded − 0.2×lowConfidenceRatio)
V1 (fallback): score = clamp(0.9 − 0.3×hasHighDoubt − 0.2×verificationDegraded − 0.2×lowConfidenceRatio)
Component | Default weight | Value and source |
relevance | 0.40 | Topic relevance: |
coherence | 0.30 | LLM-judged coherence. Uses |
cleanliness | 0.30 | LLM-judged cleanliness, reflecting low noise. Uses |
hasHighDoubt | Subtract 0.3 | Whether any doubt has severity= |
verificationDegraded | Subtract 0.2 | Whether final auditing or deduplication degraded, such as budget-exhaustion fallback or skipped recall. Deducts 0.2 when true. The underlying marker is not exposed by PromotionDetail. |
lowConfidenceRatio | Subtract 0.2 × ratio | The fraction of LOW-confidence claims. Current agent claims do not carry confidence, so the ratio is 0 and no penalty is applied. |
Hard gate: publishable=false from final auditing forces the score to 0, bypassing weighted scoring. Otherwise, scores are clamped to [0,1]; NaN becomes 0.
The table shows default weights. The Data API does not expose scorer versions or individual component scores.
Check failures converted to doubts and explanatory outputs with no reusable content are unscored, leaving quality_score null. These records never trigger automatic ingestion.
ApprovePromotion
Description
Approves a candidate for ingestion into the specified KB. Only the current member's own pending_review record with saved nonempty title/content can be approved. Status changes to approving before ingestion, then approved on success. Business data is returned in data.
Request syntax
POST /v1/memory_promotions/approveRequest parameters
Name | Type | Required | Description | Example |
promotion_id | string | Yes | The promotion record ID |
|
knowledge_base_id | string | Yes | The target KB ID. A missing KB returns HTTP 400. |
|
Response parameters (in the data field)
Name | Type | Description | Example |
promotion_id | string | The promotion record ID |
|
status | string | The updated status |
|
target_kb_id | string | The destination knowledge base ID |
|
target_document_id | string | The ID of the knowledge base document that is written |
|
Validation and errors
Scenario | HTTP status code | Error message |
promotion_id is missing. | 400 |
|
knowledge_base_id is missing. | 400 |
|
The record is missing or belongs to another member. | 400 |
|
Status is not pending_review. | 400 |
|
title is empty. | 400 |
|
content is empty. | 400 |
|
RejectPromotion
Description
Rejects a candidate. Only the current member's own pending_review records are eligible. Returns business data in the envelope's data field.
Request syntax
POST /v1/memory_promotions/rejectRequest parameters
Name | Type | Required | Description | Example |
promotion_id | string | Yes | The promotion record ID |
|
reason | string | No | The rejection reason, at most 1,024 characters. Excess length returns HTTP 400; blank trimmed input is stored as null. |
|
Response parameters (in the data field)
Name | Type | Description | Example |
promotion_id | string | The promotion record ID |
|
status | string | The updated status |
|
ResolveDoubts
Description
Resolves generation doubts and optionally edits the title or content of the current member's pending_review record. Supply doubt_resolutions or nonempty title/content; omitting both returns HTTP 400. Edits alone preserve pending_review and return event_id=null. Decisions change status to generating and dispatch an event. Regeneration appends decisions as quotations, restores pending_review, and clears doubts and doubt_resolutions.
Request syntax
POST /v1/memory_promotions/resolve_doubtsRequest parameters
Name | Type | Required | Description | Example |
promotion_id | string | Yes | The promotion record ID |
|
doubt_resolutions | array | No | Doubt decisions, with fields below. Supply this list or title/content. |
|
title | string | No | The edited title used as the knowledge document name. Maximum: 255 characters; excess returns HTTP 400. |
|
content | string | No | The edited content |
|
doubt_resolutions elements:
Name | Type | Required | Description | Example |
index | integer | Yes | The zero-based doubts index from PromotionDetail. Missing or negative values return HTTP 400. No upper-bound validation: indexes beyond the array are silently ignored. |
|
choice | string | Yes | An option |
|
comment | string | No | The custom response, used when |
|
Response parameters (in the data field)
Name | Type | Description | Example |
promotion_id | string | The promotion record ID |
|
event_id | string | The regeneration event ID. If only the edits are saved, the value is null |
|
status | string |
|
|
Examples
Request body with decisions, triggering regeneration:
{
"promotion_id": "promo-001",
"doubt_resolutions": [
{
"index": 0,
"choice": "A"
},
{
"index": 1,
"choice": "custom",
"comment": "Use the latest memory as the source of truth"
}
]
}Request body with manual edits only, without regeneration:
{
"promotion_id": "promo-001",
"title": "User dietary preferences",
"content": "The user prefers Americano coffee..."
}BatchActionPromotions
Description
Approves or rejects up to 50 candidates independently. Individual failures do not affect other items; their exception messages appear in results[].error while HTTP remains 200. Returns data in a unified envelope.
Request syntax
POST /v1/memory_promotions/batchRequest parameters
Name | Type | Required | Description | Example |
action | string | Yes | The case-sensitive batch action: |
|
ids | array | Yes | A nonempty list of up to 50 promotion IDs, without blank entries. |
|
knowledge_base_id | string | Required for approve | The target KB shared by the batch, ignored for reject. If missing for approval, each item fails with |
|
reason | string | No | The shared rejection reason, optional for reject and at most 1,024 characters. |
|
Response parameters (in the data field)
Name | Type | Description | Example |
total | integer | The total number of entries |
|
succeeded | integer | The number of successful records |
|
failed | integer | The number of failed records |
|
results | array | The list of per-record results. For the fields of each element, see the following table | See the following table |
Elements of the results array:
Name | Type | Description | Example |
id | string | The promotion record ID |
|
success | boolean | Indicates whether the record is processed |
|
error | string | The failure reason. For successful records, this field is not returned |
|
Validation and errors
The following request-level validation failures reject the entire request without per-item results:
Scenario | HTTP status code | Error message |
The request body is missing. | 400 |
|
action is missing or blank. | 400 |
|
action is neither approve nor reject. | 400 |
|
ids is missing or empty. | 400 |
|
ids contains more than 50 entries. | 400 |
|
ids contains blank entries. | 400 |
|
Examples
Request body:
{
"action": "approve",
"ids": [
"promo-001",
"promo-002"
],
"knowledge_base_id": "kb-001"
}Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-abc123",
"data": {
"total": 2,
"succeeded": 2,
"failed": 0,
"results": [
{
"id": "promo-001",
"success": true
},
{
"id": "promo-002",
"success": true
}
]
}
}BatchDeletePromotions
Description
Permanently deletes up to 50 of the current member's own rejected candidates. Deletion cannot be undone. Ineligible items are skipped with reasons in results; eligible records are deleted together in one transaction. Returns data in a unified envelope.
Request syntax
DELETE /v1/memory_promotions/batchRequest parameters
Name | Type | Required | Description | Example |
ids | array | Yes | A nonempty list of up to 50 promotion IDs, without blank entries. |
|
Response parameters (in the data field)
Name | Type | Description | Example |
total | integer | The total number of entries |
|
succeeded | integer | The successful deletion count. |
|
failed | integer | The number of failed records |
|
results | array | The list of per-record results. For the fields of each element, see the following table | See the following table |
Elements of the results array:
Name | Type | Description | Example |
id | string | The promotion record ID |
|
success | boolean | Whether deletion succeeded. |
|
error | string | The failure reason. For successful records, this field is not returned |
|
Validation and errors
Scenario | HTTP status or result location | Error message |
ids is missing or empty. | 400 for the entire request. |
|
ids contains more than 50 entries. | 400 for the entire request. |
|
ids contains blank entries. | 400 for the entire request. |
|
The record is missing or belongs to another member. | 200, results[].error |
|
The record status is not rejected. | 200, results[].error |
|
Examples
Request body:
{
"ids": [
"promo-003",
"promo-004"
]
}Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-abc123",
"data": {
"total": 2,
"succeeded": 1,
"failed": 1,
"results": [
{
"id": "promo-003",
"success": true
},
{
"id": "promo-004",
"success": false,
"error": "promotion is not in rejected status, current: approved"
}
]
}
}GetPromotionSettings
Description
Retrieves automatic ingestion settings scoped to (workspace, member). Each member has independent settings in each workspace; the API key selects the member. Unconfigured members receive defaults without creating a record. Returns data in a unified envelope.
Request syntax
GET /v1/memory_promotions/settingsRequest parameters
None.
Response parameters (in the data field)
Name | Type | Description | Example |
auto_ingest_enabled | boolean | Specifies whether automatic ingestion for promotion is enabled |
|
auto_ingest_threshold | float | The automatic ingestion quality threshold in the inclusive range [0, 1]. |
|
default_kb_id | string | The default destination knowledge base ID. If it is not configured, the value is |
|
Defaults when unconfigured:
Name | Default | Description |
auto_ingest_enabled |
| Automatic ingestion is disabled; all candidates await manual review in pending_review. |
auto_ingest_threshold |
| The minimum score for automatic ingestion. Unscored records with null quality_score never qualify. |
default_kb_id |
| No default KB configured. |
Validation and errors
Scenario | HTTP status code | Error message |
The API key has no bound member identity. | 400 |
|
Examples
Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-abc123",
"data": {
"auto_ingest_enabled": true,
"auto_ingest_threshold": 0.8,
"default_kb_id": "kb-001"
}
}UpdatePromotionSettings
Description
Partially updates automatic ingestion settings for the current (workspace, member) only. Omitted fields remain unchanged. The first call creates a settings record if needed. Returns data in a unified envelope.
Request syntax
PUT /v1/memory_promotions/settingsRequest parameters
Name | Type | Required | Description | Example |
auto_ingest_enabled | boolean | No | Whether automatic promotion ingestion is enabled. Omission preserves the value. |
|
auto_ingest_threshold | float | No | The quality threshold in [0, 1]. Out-of-range values return HTTP 400, not clamping. Omission preserves the value. |
|
default_kb_id | string | No | The default target KB ID. Blank input clears it to |
|
Response parameters (in the data field)
Returns the complete updated settings:
Name | Type | Description | Example |
auto_ingest_enabled | boolean | The updated automatic ingestion switch. |
|
auto_ingest_threshold | float | The updated threshold in the inclusive range [0, 1]. |
|
default_kb_id | string | The updated default KB ID, or |
|
Validation and errors
Scenario | HTTP status code | Error message |
The API key has no bound member identity. | 400 |
|
auto_ingest_threshold is out of range. | 400 |
|
The effective switch is true but the default KB is empty. | 400 |
|
default_kb_id refers to a missing KB. | 400 | Reported by knowledge base validation. |
Validation uses supplied auto_ingest_enabled, otherwise the stored value; the same applies to default_kb_id. Therefore, changing only the threshold while already enabled does not require resupplying default_kb_id.
Examples
Request body:
{
"auto_ingest_enabled": true,
"auto_ingest_threshold": 0.7,
"default_kb_id": "kb-001"
}Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-abc123",
"data": {
"auto_ingest_enabled": true,
"auto_ingest_threshold": 0.7,
"default_kb_id": "kb-001"
}
}ListPromotionTemplates
Description
Lists active promotion templates visible to the caller. Templates are scoped to (workspace, member). Returns data in a unified envelope.
Request syntax
GET /v1/memory_promotions/templatesRequest parameters
None.
Response parameters (in the data field)
The data field is an array of template objects. For the fields of each element, see the following table:
Name | Type | Description | Example |
id | string | The template ID |
|
name | string | The template name |
|
is_default | boolean | Whether this is the default template for its owning member. |
|
sections | array | The ordered section list. See fields below. | See the following table |
content | string | The rendered Markdown text |
|
updatedAt | string | The update time. The field name uses camelCase, not snake_case. |
|
Elements of the sections array:
Name | Type | Description | Example |
level | integer | Heading level 1 to 3, corresponding to |
|
title | string | The single-line section title. |
|
guidance | string | Generation guidance, allowing multiple lines but no blank lines. |
|
Generation resolves explicit template_id and default templates only within templates owned by the current member.
Examples
Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-abc123",
"data": [
{
"id": "tpl-001",
"name": "Preference summary template",
"is_default": true,
"sections": [
{
"level": 2,
"title": "Overview",
"guidance": "Summarize the core preferences of the user"
},
{
"level": 2,
"title": "Details",
"guidance": "List specific preferences and supporting evidence"
}
],
"content": "## Overview\n...\n## Details\n...",
"updatedAt": "2026-07-01T08:00:00Z"
}
]
}CreatePromotionTemplate
Description
Creates a template owned by the current member. name must be unique within that member. Each member can have five active templates; exceeding the limit returns HTTP 400. Structured sections are rendered as Markdown and round-trip validated before storage. Returns a unified envelope.
Request syntax
POST /v1/memory_promotions/templatesRequest parameters
Name | Type | Required | Description | Example |
name | string | Yes | The trimmed nonempty name, at most 128 characters and unique within the member. |
|
is_default | boolean | No | Whether to set this template as default. Default: |
|
sections | array | Yes | The list of sections in document order. Quantity: 1 to 15 items. For the fields of each element, see the following table | See the following table |
Elements of the sections array:
Name | Type | Required | Description | Example |
level | integer | No | Heading level 1 to 3, corresponding to |
|
title | string | Yes | The nonempty single-line section title. Line breaks return HTTP 400. |
|
guidance | string | Yes | Nonempty generation guidance. Multiple lines are allowed; blank lines are prohibited. |
|
Response parameters (in the data field)
The created template with ListPromotionTemplates element fields: id, name, is_default, sections, content, and updatedAt.
Validation and errors
Scenario | HTTP status code | Error message |
sections is missing or empty. | 400 |
|
sections contains more than 15 entries. | 400 |
|
name is missing or blank. | 400 |
|
name exceeds 128 characters. | 400 |
|
The current member already has five active templates. | 400 |
|
A template with this name already exists. | 400 |
|
The section title is empty. | 400 |
|
The section title contains a line break. | 400 |
|
Section guidance is empty. | 400 |
|
Section guidance contains a blank line. | 400 |
|
level is out of range. | 400 |
|
The rendered content exceeds the length limit. | 400 |
|
The sections cannot be represented losslessly as template Markdown. | 400 |
|
Examples
Request body:
{
"name": "Preference summary template",
"is_default": true,
"sections": [
{
"level": 2,
"title": "Overview",
"guidance": "Summarize the core preferences of the user"
},
{
"level": 2,
"title": "Details",
"guidance": "List specific preferences and supporting evidence"
}
]
}Sample success response:
{
"errorCode": 0,
"errorMessage": null,
"requestId": "req-abc123",
"data": {
"id": "tpl-001",
"name": "Preference summary template",
"is_default": true,
"sections": [
{
"level": 2,
"title": "Overview",
"guidance": "Summarize the core preferences of the user"
},
{
"level": 2,
"title": "Details",
"guidance": "List specific preferences and supporting evidence"
}
],
"content": "## Overview\n...\n## Details\n...",
"updatedAt": "2026-07-01T08:00:00Z"
}
}GetPromotionTemplate
Description
Retrieves a visible promotion template. Missing, deleted, or invisible templates return HTTP 200 with null data, not HTTP 400. Returns a unified envelope.
Request syntax
GET /v1/memory_promotions/templates/{template_id}Request parameters
Name | Type | Required | Description | Example |
template_id | string | Yes | The template ID (path parameter) |
|
Response parameters (in the data field)
The template with ListPromotionTemplates fields: id, name, is_default, sections, content, and updatedAt. null if missing or invisible.
UpdatePromotionTemplate
Description
Updates a visible promotion template; a missing template returns HTTP 400. Supplied name must be unique within the actual owning member. Nonempty sections rebuilds all content; individual-section patches are unsupported. is_default=true claims the default, false clears this flag, and omission preserves it. Returns a unified envelope.
Request syntax
PUT /v1/memory_promotions/templates/{template_id}Request parameters
Name | Type | Required | Description | Example |
template_id | string | Yes | The template ID (path parameter) |
|
name | string | No | The name, at most 128 characters and unique within the owner. Omission or blank input preserves it. |
|
is_default | boolean | No | Default selection: |
|
sections | array | No | A nonempty array replaces all 1 to 15 sections, using CreatePromotionTemplate fields. Omission or an empty array preserves content. | See CreatePromotionTemplate |
Response parameters (in the data field)
The updated template with ListPromotionTemplates fields: id, name, is_default, sections, content, and updatedAt.
Validation and errors
Scenario | HTTP status code | Error message |
The request body is missing. | 400 |
|
The template is missing or invisible. | 400 |
|
name exceeds 128 characters. | 400 |
|
The new name duplicates another template owned by the same member. | 400 |
|
Section validation fails. | 400 | The section validation error from CreatePromotionTemplate. |
DeletePromotionTemplate
Description
Soft-deletes a visible promotion template and renames it with a tombstone so the original name can be reused. Idempotent: missing or deleted templates also return deleted=true without an error. Returns a unified envelope.
Request syntax
DELETE /v1/memory_promotions/templates/{template_id}Request parameters
Name | Type | Required | Description | Example |
template_id | string | Yes | The template ID (path parameter) |
|
Response parameters (in the data field)
Name | Type | Description | Example |
deleted | boolean | Fixed to |
|
SetDefaultPromotionTemplate
Description
Sets the specified template as default and clears other visible defaults. Missing templates return HTTP 400. Generation without template_id prioritizes the current member's default template. Returns a unified envelope.
Request syntax
POST /v1/memory_promotions/templates/{template_id}/set_defaultRequest parameters
Name | Type | Required | Description | Example |
template_id | string | Yes | The template ID (path parameter) |
|
Response parameters (in the data field)
The selected default template with ListPromotionTemplates fields; is_default is true.
Validation and errors
Scenario | HTTP status code | Error message |
The template does not exist. | 400 |
|
ClearDefaultPromotionTemplate
Description
Clears all visible template default flags. Generation then uses the built-in template. Succeeds idempotently if no default exists. Returns a unified envelope.
Request syntax
DELETE /v1/memory_promotions/templates/defaultRequest parameters
None.
Response parameters (in the data field)
Name | Type | Description | Example |
cleared | boolean | Fixed as |
|