Metadata not deleting - using Node SDK

Hello, unsure if anyone else is experiencing this but I’m unable to delete metadata from assistants through the assistants API (using node sdk).

ADDING new metadata and UPDATING metadata still works. However, if I send a map without a existing pair(s), the metadata will not not be updated with the removed pairs. Is this expected behavior? If so, how do we explicitly remove metadata?


    console.log('>>>>>>>> metadata object', agentParams.metadata)

    const updateParams = {
      description: agentParams.description,
      instructions: agentParams.instructions,
      model: agentParams.model,
      metadata: agentParams.metadata,
    const openai = await getOpenAI(c)
    const assistant = await openai.beta.assistants.update(, updateParams)
    console.log('UPDATE PARAMS', updateParams)


>>>>>>>> metadata object Object {                                                                                                                                                                  
UPDATE PARAMS Object {                                                                                                                                                                             
  name: English Tutor,                                                                                                                                                                             
  description: Take care of English stuffs,                                                                                                                                                        
  instructions: You are a personal english tutor. Write and run code to answer english questions.,
  model: gpt-4-1106-preview,
  metadata: Object

What I receive from the backend:

  created_at: 1699777427,
  description: "Take care of English stuffs",
  file_ids: [],
  id: "asst_zZ0Td78363rsvRq2Pe7usNB5",
  instructions: "You are a personal english tutor. Write and run code to answer english questions.",
  metadata: {
    test: "123123"
  model: "gpt-4-1106-preview",
  name: "English Tutor",
  object: "assistant",
  tools: []

As you can see, despite sending an empty object (also tried with map), the API still sends me metadata back.

Steps to reproduce:

  1. Create an assistant with non-empty metadata.
  2. Update the assistant with an empty metadata object (to supposedly update to an empty metadata object)
  3. You will receive non-empty metadata

I’m seeing this too, but using the Python library. It must be an API level issue where it can’t be left empty? I’m going to try removing just a single key, maybe it just needs to have at least 1 left after 1 has been added in the past?

Just following up, I can’t seem to remove any keys from the metadata for assistants. This seems like a bug.

What happens if you try

  test: undefined

In python, with “None” I get this:

DEBUG:openai._base_client:HTTP Request: POST "400 Bad Request" APIError: Error code: 400 - {'error': {'message': '2 validation errors for Request\nbody -> metadata\n  instance of Missing expected (type=type_error.arbitrary_type; expected_arbitrary_type=Missing)\nbody -> metadata -> thread_FfzTmKEqFNkUbQPa2QCUNnvz\n  none is not an allowed value (type=type_error.none.not_allowed)', 'type': 'invalid_request_error', 'param': None, 'code': None}}
1 Like

Thanks for trying. Yeah, looks like a bug :beetle:. Can’t delete properties

Drats! The API was this close to not requiring a database. The dream is shattered, oh well!

This still happens in the Python SDK. it must be an issue with the API

Hi all, we do not currently support removing specific keys from metadata. You can try two alternatives:

  • If you want to clear your metadata entirely, you can call the update endpoint with metadata: {}.
  • If you want to clear a specific field, for now you can set it to an empty string like metadata: {"foo": ""}

We’re hoping to support properly unsetting values in the future.

Hi @atty-openai - thanks for the suggestions on this. I just tried setting metadata: {} using the update method via the Python SDK, but the returned object still contains all the previously added metadata fields.

I’m currently using version 1.16.2 of the Python SDK. Is this functionality available in newer versions or should I be doing something differently?