Skip to main content

Update Prompt

Sprint 3

Update an existing prompt. All fields are optional - only provided fields will be updated.

Endpoint

PATCH /api/v1/prompts/{prompt_id}

Headers

HeaderRequiredDescription
AuthorizationYesBearer <access_token>
Content-TypeYesapplication/json

Path Parameters

ParameterTypeRequiredDescription
prompt_idintegerYesPrompt ID

Request Body

All fields are optional. Only provided fields will be updated.

{
"name": "Updated Sales Report",
"tags": ["sales", "updated"],
"metadata": {
"category": "reports"
}
}

Parameters

FieldTypeRequiredDescription
namestringNoPrompt name
tagsarray[string]NoTags for categorization
metadataobjectNoAdditional metadata

Response

Success (200)

{
"success": true,
"data": {
"id": 1,
"name": "Updated Sales Report",
"tags": ["sales", "updated"],
"metadata": {
"category": "reports"
},
"updated_at": "2024-12-01T11:00:00Z"
},
"message": "Prompt updated successfully"
}

Error Codes

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing authentication token
404NOT_FOUNDPrompt not found
500INTERNAL_SERVER_ERRORInternal server error

Features

  • Partial updates (only provided fields are updated)
  • Organization-scoped access control
  • Updates updated_at automatically

Example

curl -X PATCH "https://api.rivergen.com/api/v1/prompts/1" \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Updated Sales Report",
"tags": ["sales", "updated"]
}'