How to hide or remove a custom GPT from the sidebar via the API?

Hi everyone,

I’m trying to replicate a functionality similar to deleting chats in the ChatGPT interface, but in this case applied to custom GPTs in the sidebar. The goal is to programmatically hide or remove a custom GPT from the sidebar using OpenAI’s API, but so far, I haven’t been able to get it working correctly.

What I’ve tried:

I’ve been experimenting with different endpoints and requests, including /ces/v1/t using the PATCH method to modify the visibility state of the GPT. I used a request body formatted like this:

json

Copiar código

{
  "is_visible": false
}

I also included the necessary authentication headers and parameters, but even though the response returns { "success": true }, the GPT still shows up in the sidebar and nothing changes.

My goal:

I want to replicate the delete functionality provided for chats, but apply it to the custom GPTs listed in the sidebar. Essentially, I need a way to programmatically modify the visibility state or remove the GPT from the sidebar.

Example request:

Here’s an example of the code I’m using, where I attempt to hide a specific GPT:

javascript

Copiar código

const hideGPT = async () => {
    const token = await getToken(); // Obtaining the session token

    if (!token) {
        console.error("Error: Could not retrieve token.");
        return;
    }

    const url = 'https://chatgpt.com/ces/v1/t';
    const body = JSON.stringify({ is_visible: false });

    const response = await fetch(url, {
        method: 'PATCH',
        headers: {
            'Authorization': `Bearer ${token}`,
            'Content-Type': 'application/json',
        },
        body: body
    });

    const result = await response.json();
    console.log("Response:", result);
};

Question:

Has anyone successfully hidden or removed a custom GPT from the sidebar using the API or any other programmatic method? Is there an additional endpoint or parameters I might be missing? Any suggestions or examples would be greatly appreciated.

Thanks in advance!