# Update thread metadata div strong 🔨 In Development — This section is still being developed and may change. Update thread metadata with partial merge support and visibility controls. NEW endpoint for enhanced thread management. Update thread metadata with partial merge support and visibility controls. This is a new endpoint that provides enhanced thread management capabilities beyond the standard update endpoint. #### Path Parameters **`thread_id`** string required The unique identifier of the thread to update. #### Request Body **`metadata`** object optional Custom key-value pairs for thread metadata. Performs partial update - merges with existing metadata. Maximum 16 key-value pairs. **`visibleInUi`** boolean optional Whether this thread should be visible in the user interface. Requires Bearer token authentication. Update Metadata ```bash curl -X PATCH "https://api.freddy.aitronos.com/v1/threads/thread_abc123/metadata" \ -H "Authorization: Bearer $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "metadata": { "category": "support", "priority": "high", "status": "resolved", "tags": ["billing", "resolved"] } }' ``` ```python import requests response = requests.patch( "https://api.freddy.aitronos.com/v1/threads/thread_abc123/metadata", headers={"Authorization": f"Bearer {api_key}"}, json={ "metadata": { "category": "support", "priority": "high", "status": "resolved", "tags": ["billing", "resolved"] } } ) thread = response.json() print(f"Updated thread metadata: {thread['metadata']}") ``` ```javascript const response = await fetch('https://api.freddy.aitronos.com/v1/threads/thread_abc123/metadata', { method: 'PATCH', headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ metadata: { category: 'support', priority: 'high', status: 'resolved', tags: ['billing', 'resolved'] } }) }); const thread = await response.json(); console.log('Updated thread metadata:', thread.metadata); ``` Hide from UI ```bash curl -X PATCH "https://api.freddy.aitronos.com/v1/threads/thread_abc123/metadata" \ -H "Authorization: Bearer $FREDDY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "visibleInUi": false }' ``` ```python import requests response = requests.patch( "https://api.freddy.aitronos.com/v1/threads/thread_abc123/metadata", headers={"Authorization": f"Bearer {api_key}"}, json={"visibleInUi": False} ) thread = response.json() print(f"Thread visibility: {thread['visibleInUi']}") ``` ```javascript const response = await fetch('https://api.freddy.aitronos.com/v1/threads/thread_abc123/metadata', { method: 'PATCH', headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ visibleInUi: false }) }); const thread = await response.json(); console.log(`Thread visibility: ${thread.visibleInUi}`); ``` ## Response 200 OK ```json { "id": "thread_abc123", "object": "thread", "createdAt": 1741476542, "updatedAt": 1741476800, "metadata": { "category": "support", "priority": "high", "status": "resolved", "tags": ["billing", "resolved"] }, "assistantId": "asst_support_agent", "organizationId": "ORG_123", "userId": "uid_user123", "title": "Customer Support Query", "visibleInUi": false, "messageCount": 5 } ``` Errors ```json 400 Bad Request { "error": { "message": "Invalid request parameters", "type": "invalid_request_error", "code": "invalid_parameters" } } ``` ```json 404 Not Found { "error": { "message": "Thread not found or access denied", "type": "not_found_error", "code": "thread_not_found" } } ``` ```json 422 Validation Error { "error": { "message": "Metadata cannot exceed 16 key-value pairs", "type": "validation_error", "code": "metadata_limit_exceeded", "param": "metadata" } } ``` ## Related Resources - [Threads Overview](/docs/documentation/core-concepts/threads-overview) - [Update Thread](/docs/api-reference/threads/update) - [Retrieve Thread](/docs/api-reference/threads/retrieve) - [Thread Context Modes](/docs/documentation/core-concepts/thread-context-modes)